Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. Index: tools/emcore.py
  2. ===================================================================
  3. --- tools/emcore.py (revision 755)
  4. +++ tools/emcore.py (working copy)
  5. @@ -177,12 +177,16 @@
  6.  
  7. elif infotype == "mallocpoolbounds":
  8. resp = self.emcore.getmallocpoolbounds()
  9. - self.logger.info("The malloc pool is 0x%X - 0x%X" % (
  10. + self.logger.info("The malloc pool is 0x%X - 0x%X\n" % (
  11. self.emcore.lib.dev.mallocpool.lower,
  12. self.emcore.lib.dev.mallocpool.upper - 1))
  13.  
  14. + elif infotype == "serialnumber":
  15. + resp = self.emcore.getserialnumber()
  16. + self.logger.info("The serial number is %s\n" % self.emcore.lib.dev.serialnumber)
  17. +
  18. else:
  19. - raise ArgumentTypeError("one out of 'version', 'packetsize', 'mallocpoolbounds'", infotype)
  20. + raise ArgumentTypeError("one out of 'version', 'packetsize', 'mallocpoolbounds', 'serialnumber'", infotype)
  21.  
  22. @command
  23. def reset(self, force=False):
  24. @@ -1247,4 +1251,4 @@
  25. interface = Commandline()
  26. interface._parsecommand(sys.argv[1], sys.argv[2:])
  27. except KeyboardInterrupt:
  28. - sys.exit()
  29. \ No newline at end of file
  30. + sys.exit()
  31. Index: tools/libemcore.py
  32. ===================================================================
  33. --- tools/libemcore.py (revision 755)
  34. +++ tools/libemcore.py (working copy)
  35. @@ -200,6 +200,14 @@
  36. return resp
  37.  
  38. @command()
  39. + def getserialnumber(self):
  40. + """ This returns the serial number of the device (if supported) """
  41. + resp = self.lib.monitorcommand(struct.pack("<IIII", 1, 3, 0, 0), "III16s", (None, None, None, "sn"))
  42. + self.logger.debug("Serial number: %s\n" % resp.sn)
  43. + self.lib.dev.serialnumber = resp.sn
  44. + return resp
  45. +
  46. + @command()
  47. def reset(self, force=False):
  48. """ Reboot the device """
  49. if force:
  50. @@ -1041,6 +1049,8 @@
  51. self.mallocpool.lower = None
  52. self.mallocpool.upper = None
  53.  
  54. + self.serialnumber = None
  55. +
  56. def __del__(self):
  57. self.disconnect()
  58.  
  59. Index: usb/usb.c
  60. ===================================================================
  61. --- usb/usb.c (revision 755)
  62. +++ usb/usb.c (working copy)
  63. @@ -389,6 +389,12 @@
  64. dbgsendbuf[1] = (uint32_t)&_poolstart;
  65. dbgsendbuf[2] = (uint32_t)&_poolend;
  66. break;
  67. +#if 0x47324e49 == PLATFORM_ID
  68. + case 3: // GET SERIAL NUMBER
  69. + size = 32;
  70. + memcpy(&dbgsendbuf[4], (void *)(0x2202bdf0 + 0x18), 16);
  71. + break;
  72. +#endif
  73. default:
  74. dbgsendbuf[0] = 2;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement