| Index: emcore/trunk/tools/emcore.py | 
| — | — | @@ -266,7 +266,7 @@ | 
| 267 | 267 | integer = to_int(integer) | 
| 268 | 268 | if integer > 0xFFFFFFFF: | 
| 269 | 269 | raise ArgumentError("Specified integer too long") | 
| 270 |  | -        data = struct.pack("I", integer)
 | 
|  | 270 | +        data = struct.pack("<I", integer) | 
| 271 | 271 | self.emcore.write(addr, data) | 
| 272 | 272 | self.logger.info("Integer '0x%X' written successfully to 0x%X\n" % (integer, addr)) | 
| 273 | 273 |  | 
| — | — | @@ -278,7 +278,7 @@ | 
| 279 | 279 | """ | 
| 280 | 280 | addr = to_int(addr) | 
| 281 | 281 | data = self.emcore.read(addr, 4) | 
| 282 |  | -        integer = struct.unpack("I", data)[0]
 | 
|  | 282 | +        integer = struct.unpack("<I", data)[0] | 
| 283 | 283 | self.logger.info("Read '0x%X' from address 0x%X\n" % (integer, addr)) | 
| 284 | 284 |  | 
| 285 | 285 | @command | 
| — | — | @@ -295,7 +295,7 @@ | 
| 296 | 296 | addr = to_int(addr) | 
| 297 | 297 | size = to_int(size) | 
| 298 | 298 | data = self.emcore.i2cread(bus, slave, addr, size) | 
| 299 |  | -        bytes = struct.unpack("%dB" % len(data), data)
 | 
|  | 299 | +        bytes = struct.unpack("<%dB" % len(data), data) | 
| 300 | 300 | self.logger.info("Data read from I2C:\n") | 
| 301 | 301 | for index, byte in enumerate(bytes): | 
| 302 | 302 | self.logger.info("%02X: %02X\n" % (addr + index, byte)) | 
| Index: emcore/trunk/tools/libemcore.py | 
| — | — | @@ -133,7 +133,7 @@ | 
| 134 | 134 | """ Reads the memory from location 'addr' with size 'size' | 
| 135 | 135 | from the device. | 
| 136 | 136 | """ | 
| 137 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 4, addr, size, 0), "III%ds" % size, (None, None, None, "data"))
 | 
|  | 137 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 4, addr, size, 0), "III%ds" % size, (None, None, None, "data")) | 
| 138 | 138 | return resp.data | 
| 139 | 139 |  | 
| 140 | 140 | @command() | 
| — | — | @@ -141,7 +141,7 @@ | 
| 142 | 142 | """ Writes the data in 'data' to the location 'addr' | 
| 143 | 143 | in the memory of the device. | 
| 144 | 144 | """ | 
| 145 |  | -        return self.lib.monitorcommand(struct.pack("IIII%ds" % len(data), 5, addr, len(data), 0, data), "III", (None, None, None))
 | 
|  | 145 | +        return self.lib.monitorcommand(struct.pack("<IIII%ds" % len(data), 5, addr, len(data), 0, data), "III", (None, None, None)) | 
| 146 | 146 |  | 
| 147 | 147 | @command() | 
| 148 | 148 | def _readdma(self, addr, size): | 
| — | — | @@ -148,8 +148,8 @@ | 
| 149 | 149 | """ Reads the memory from location 'addr' with size 'size' | 
| 150 | 150 | from the device. This uses DMA and the data in endpoint. | 
| 151 | 151 | """ | 
| 152 |  | -        self.lib.monitorcommand(struct.pack("IIII", 6, addr, size, 0), "III", (None, None, None))
 | 
| 153 |  | -        return struct.unpack("%ds" % size, self.lib.dev.din(size))[0]
 | 
|  | 152 | +        self.lib.monitorcommand(struct.pack("<IIII", 6, addr, size, 0), "III", (None, None, None)) | 
|  | 153 | +        return struct.unpack("<%ds" % size, self.lib.dev.din(size))[0] | 
| 154 | 154 |  | 
| 155 | 155 | @command() | 
| 156 | 156 | def _writedma(self, addr, data): | 
| — | — | @@ -156,13 +156,13 @@ | 
| 157 | 157 | """ Writes the data in 'data' to the location 'addr' | 
| 158 | 158 | in the memory of the device. This uses DMA and the data out endpoint. | 
| 159 | 159 | """ | 
| 160 |  | -        self.lib.monitorcommand(struct.pack("IIII", 7, addr, len(data), 0), "III", (None, None, None))
 | 
|  | 160 | +        self.lib.monitorcommand(struct.pack("<IIII", 7, addr, len(data), 0), "III", (None, None, None)) | 
| 161 | 161 | return self.lib.dev.dout(data) | 
| 162 | 162 |  | 
| 163 | 163 | @command() | 
| 164 | 164 | def getversioninfo(self): | 
| 165 | 165 | """ This returns the emCORE version and device information. """ | 
| 166 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 1, 0, 0, 0), "IBBBBI", ("revision", "majorv", "minorv", "patchv", "swtypeid", "hwtypeid"))
 | 
|  | 166 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 1, 0, 0, 0), "IBBBBI", ("revision", "majorv", "minorv", "patchv", "swtypeid", "hwtypeid")) | 
| 167 | 167 | self.lib.dev.version.revision = resp.revision | 
| 168 | 168 | self.lib.dev.version.majorv = resp.majorv | 
| 169 | 169 | self.lib.dev.version.minorv = resp.minorv | 
| — | — | @@ -178,7 +178,7 @@ | 
| 179 | 179 | """ This returns the emCORE max packet size information. | 
| 180 | 180 | It also sets the properties of the device object accordingly. | 
| 181 | 181 | """ | 
| 182 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 1, 1, 0, 0), "HHII", ("coutmax", "cinmax", "doutmax", "dinmax"))
 | 
|  | 182 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 1, 1, 0, 0), "HHII", ("coutmax", "cinmax", "doutmax", "dinmax")) | 
| 183 | 183 | self.logger.debug("Device cout packet size limit = %d\n" % resp.coutmax) | 
| 184 | 184 | self.lib.dev.packetsizelimit.cout = resp.coutmax | 
| 185 | 185 | self.logger.debug("Device cin packet size limit = %d\n" % resp.cinmax) | 
| — | — | @@ -192,7 +192,7 @@ | 
| 193 | 193 | @command() | 
| 194 | 194 | def getusermemrange(self): | 
| 195 | 195 | """ This returns the memory range the user has access to. """ | 
| 196 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 1, 2, 0, 0), "III", ("lower", "upper", None))
 | 
|  | 196 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 1, 2, 0, 0), "III", ("lower", "upper", None)) | 
| 197 | 197 | self.logger.debug("Device user memory = 0x%X - 0x%X\n" % (resp.lower, resp.upper)) | 
| 198 | 198 | self.lib.dev.usermem.lower = resp.lower | 
| 199 | 199 | self.lib.dev.usermem.upper = resp.upper | 
| — | — | @@ -202,17 +202,17 @@ | 
| 203 | 203 | def reset(self, force=False): | 
| 204 | 204 | """ Reboot the device """ | 
| 205 | 205 | if force: | 
| 206 |  | -            return self.lib.monitorcommand(struct.pack("IIII", 2, 0, 0, 0))
 | 
|  | 206 | +            return self.lib.monitorcommand(struct.pack("<IIII", 2, 0, 0, 0)) | 
| 207 | 207 | else: | 
| 208 |  | -            return self.lib.monitorcommand(struct.pack("IIII", 2, 1, 0, 0), "III", (None, None, None))
 | 
|  | 208 | +            return self.lib.monitorcommand(struct.pack("<IIII", 2, 1, 0, 0), "III", (None, None, None)) | 
| 209 | 209 |  | 
| 210 | 210 | @command() | 
| 211 | 211 | def poweroff(self, force=False): | 
| 212 | 212 | """ Powers the device off. """ | 
| 213 | 213 | if force: | 
| 214 |  | -            return self.lib.monitorcommand(struct.pack("IIII", 3, 0, 0, 0))
 | 
|  | 214 | +            return self.lib.monitorcommand(struct.pack("<IIII", 3, 0, 0, 0)) | 
| 215 | 215 | else: | 
| 216 |  | -            return self.lib.monitorcommand(struct.pack("IIII", 3, 1, 0, 0), "III", (None, None, None))
 | 
|  | 216 | +            return self.lib.monitorcommand(struct.pack("<IIII", 3, 1, 0, 0), "III", (None, None, None)) | 
| 217 | 217 |  | 
| 218 | 218 | @command() | 
| 219 | 219 | def read(self, addr, size): | 
| — | — | @@ -302,7 +302,7 @@ | 
| 303 | 303 | """ Reads data from an i2c slave """ | 
| 304 | 304 | data = "" | 
| 305 | 305 | for i in range(size): | 
| 306 |  | -            resp = self.lib.monitorcommand(struct.pack("IBBBBII", 8, index, slaveaddr, startaddr + i, 1, 0, 0), "III1s", (None, None, None, "data"))
 | 
|  | 306 | +            resp = self.lib.monitorcommand(struct.pack("<IBBBBII", 8, index, slaveaddr, startaddr + i, 1, 0, 0), "III1s", (None, None, None, "data")) | 
| 307 | 307 | data += resp.data | 
| 308 | 308 | return data | 
| 309 | 309 |  | 
| — | — | @@ -314,13 +314,13 @@ | 
| 315 | 315 | raise ArgumentError("Size must be a number between 1 and 256") | 
| 316 | 316 | if size == 256: | 
| 317 | 317 | size = 0 | 
| 318 |  | -        return self.lib.monitorcommand(struct.pack("IBBBBII%ds" % size, 9, index, slaveaddr, startaddr, size, 0, 0, data), "III", (None, None, None))
 | 
|  | 318 | +        return self.lib.monitorcommand(struct.pack("<IBBBBII%ds" % size, 9, index, slaveaddr, startaddr, size, 0, 0, data), "III", (None, None, None)) | 
| 319 | 319 |  | 
| 320 | 320 | @command() | 
| 321 | 321 | def usbcread(self): | 
| 322 | 322 | """ Reads one packet with the maximal cin size """ | 
| 323 | 323 | cin_maxsize = self.lib.dev.packetsizelimit.cin - self.lib.headersize | 
| 324 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 10, cin_maxsize, 0, 0), "III%ds" % cin_maxsize, ("validsize", "buffersize", "queuesize", "data"))
 | 
|  | 324 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 10, cin_maxsize, 0, 0), "III%ds" % cin_maxsize, ("validsize", "buffersize", "queuesize", "data")) | 
| 325 | 325 | resp.data = resp.data[:resp.validsize] | 
| 326 | 326 | resp.maxsize = cin_maxsize | 
| 327 | 327 | return resp | 
| — | — | @@ -332,7 +332,7 @@ | 
| 333 | 333 | size = len(data) | 
| 334 | 334 | while len(data) > 0: | 
| 335 | 335 | writesize = min(cin_maxsize, len(data)) | 
| 336 |  | -            resp = self.lib.monitorcommand(struct.pack("IIII%ds" % writesize, 11, writesize, 0, 0, data[:writesize]), "III", ("validsize", "buffersize", "freesize"))
 | 
|  | 336 | +            resp = self.lib.monitorcommand(struct.pack("<IIII%ds" % writesize, 11, writesize, 0, 0, data[:writesize]), "III", ("validsize", "buffersize", "freesize")) | 
| 337 | 337 | data = data[resp.validsize:] | 
| 338 | 338 | return size | 
| 339 | 339 |  | 
| — | — | @@ -342,7 +342,7 @@ | 
| 343 | 343 | identified with the specified bitmask | 
| 344 | 344 | """ | 
| 345 | 345 | cin_maxsize = self.lib.dev.packetsizelimit.cin - self.lib.headersize | 
| 346 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 13, bitmask, cin_maxsize, 0), "III%ds" % cin_maxsize, ("size", None, None))
 | 
|  | 346 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 13, bitmask, cin_maxsize, 0), "III%ds" % cin_maxsize, ("size", None, None)) | 
| 347 | 347 | resp.data = resp.data[size:] | 
| 348 | 348 | resp.maxsize = cin_maxsize | 
| 349 | 349 | return resp | 
| — | — | @@ -356,7 +356,7 @@ | 
| 357 | 357 | size = len(data) | 
| 358 | 358 | while len(data) > 0: | 
| 359 | 359 | writesize = min(cin_maxsize, len(data)) | 
| 360 |  | -            resp = self.lib.monitorcommand(struct.pack("IIII%ds" % writesize, 12, bitmask, writesize, 0, data[:writesize]), "III", (None, None, None))
 | 
|  | 360 | +            resp = self.lib.monitorcommand(struct.pack("<IIII%ds" % writesize, 12, bitmask, writesize, 0, data[:writesize]), "III", (None, None, None)) | 
| 361 | 361 | data = data[writesize:] | 
| 362 | 362 | return size | 
| 363 | 363 |  | 
| — | — | @@ -363,13 +363,13 @@ | 
| 364 | 364 | @command() | 
| 365 | 365 | def cflush(self, bitmask): | 
| 366 | 366 | """ Flushes the consoles specified with 'bitmask' """ | 
| 367 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 14, bitmask, 0, 0), "III", (None, None, None))
 | 
|  | 367 | +        return self.lib.monitorcommand(struct.pack("<IIII", 14, bitmask, 0, 0), "III", (None, None, None)) | 
| 368 | 368 |  | 
| 369 | 369 | @command() | 
| 370 | 370 | def getprocinfo(self): | 
| 371 | 371 | """ Gets current state of the scheduler """ | 
| 372 | 372 | schedulerstate = self.lockscheduler() | 
| 373 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 15, 0, 0, 0), "III", ("structver", "structptr", None))
 | 
|  | 373 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 15, 0, 0, 0), "III", ("structver", "structptr", None)) | 
| 374 | 374 | if resp.structver != 2: | 
| 375 | 375 | raise DeviceError("Unsupported thread struct version!") | 
| 376 | 376 |  | 
| — | — | @@ -395,29 +395,29 @@ | 
| 396 | 396 | @command() | 
| 397 | 397 | def lockscheduler(self, freeze=True): | 
| 398 | 398 | """ Freezes/Unfreezes the scheduler """ | 
| 399 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 16, 1 if freeze else 0, 0, 0), "III", ("before", None, None))
 | 
|  | 399 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 16, 1 if freeze else 0, 0, 0), "III", ("before", None, None)) | 
| 400 | 400 | return True if resp.before == 1 else False | 
| 401 | 401 |  | 
| 402 | 402 | @command() | 
| 403 | 403 | def unlockscheduler(self): | 
| 404 | 404 | """ Unfreezes the scheduler """ | 
| 405 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 16, 0, 0, 0), "III", ("before", None, None))
 | 
|  | 405 | +        return self.lib.monitorcommand(struct.pack("<IIII", 16, 0, 0, 0), "III", ("before", None, None)) | 
| 406 | 406 |  | 
| 407 | 407 | @command() | 
| 408 | 408 | def suspendthread(self, id, suspend=True): | 
| 409 | 409 | """ Suspends the thread with the specified id """ | 
| 410 |  | -        resp = self.lib.monitorcommand(struct.pack("IIII", 17, 1 if suspend else 0, id, 0), "III", ("before", None, None))
 | 
|  | 410 | +        resp = self.lib.monitorcommand(struct.pack("<IIII", 17, 1 if suspend else 0, id, 0), "III", ("before", None, None)) | 
| 411 | 411 | return True if resp.before == 1 else False | 
| 412 | 412 |  | 
| 413 | 413 | @command() | 
| 414 | 414 | def resumethread(self, id): | 
| 415 | 415 | """ Resumes the thread with the specified id """ | 
| 416 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 17, 0, id, 0), "III", ("before", None, None))
 | 
|  | 416 | +        return self.lib.monitorcommand(struct.pack("<IIII", 17, 0, id, 0), "III", ("before", None, None)) | 
| 417 | 417 |  | 
| 418 | 418 | @command() | 
| 419 | 419 | def killthread(self, id): | 
| 420 | 420 | """ Kills the thread with the specified id """ | 
| 421 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 18, id, 0, 0), "III", ("before", None, None))
 | 
|  | 421 | +        return self.lib.monitorcommand(struct.pack("<IIII", 18, id, 0, 0), "III", ("before", None, None)) | 
| 422 | 422 |  | 
| 423 | 423 | @command() | 
| 424 | 424 | def createthread(self, nameptr, entrypoint, stackptr, stacksize, threadtype, priority, state): | 
| — | — | @@ -436,7 +436,7 @@ | 
| 437 | 437 | state = 1 | 
| 438 | 438 | else: | 
| 439 | 439 | raise ArgumentError("State must be either 'ready' or 'suspended'") | 
| 440 |  | -        resp = self.lib.monitorcommand(struct.pack("IIIIIIII", 19, nameptr, entrypoint, stackptr, stacksize, threadtype, priority, state), "III", ("threadptr", None, None))
 | 
|  | 440 | +        resp = self.lib.monitorcommand(struct.pack("<IIIIIIII", 19, nameptr, entrypoint, stackptr, stacksize, threadtype, priority, state), "III", ("threadptr", None, None)) | 
| 441 | 441 | if resp.threadptr < 0: | 
| 442 | 442 | raise DeviceError("The device returned the error code %d" % resp.threadptr) | 
| 443 | 443 | return resp | 
| — | — | @@ -444,12 +444,12 @@ | 
| 445 | 445 | @command() | 
| 446 | 446 | def flushcaches(self): | 
| 447 | 447 | """ Flushes the CPU instruction and data cache """ | 
| 448 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 20, 0, 0, 0), "III", (None, None, None))
 | 
|  | 448 | +        return self.lib.monitorcommand(struct.pack("<IIII", 20, 0, 0, 0), "III", (None, None, None)) | 
| 449 | 449 |  | 
| 450 | 450 | @command() | 
| 451 | 451 | def execimage(self, addr): | 
| 452 | 452 | """ Runs the emCORE app at 'addr' """ | 
| 453 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 21, addr, 0, 0), "III", ("thread", None, None))
 | 
|  | 453 | +        return self.lib.monitorcommand(struct.pack("<IIII", 21, addr, 0, 0), "III", ("thread", None, None)) | 
| 454 | 454 |  | 
| 455 | 455 | @command() | 
| 456 | 456 | def run(self, app): | 
| — | — | @@ -466,7 +466,7 @@ | 
| 467 | 467 | """ Copies the data in the bootflash at 'flashaddr' of the specified size | 
| 468 | 468 | to the memory at addr 'memaddr' | 
| 469 | 469 | """ | 
| 470 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 22, memaddr, flashaddr, size), "III", (None, None, None))
 | 
|  | 470 | +        return self.lib.monitorcommand(struct.pack("<IIII", 22, memaddr, flashaddr, size), "III", (None, None, None)) | 
| 471 | 471 |  | 
| 472 | 472 | @command(timeout = 30000) | 
| 473 | 473 | def bootflashwrite(self, memaddr, flashaddr, size): | 
| — | — | @@ -473,13 +473,13 @@ | 
| 474 | 474 | """ Copies the data in the memory at 'memaddr' of the specified size | 
| 475 | 475 | to the boot flash at addr 'flashaddr' | 
| 476 | 476 | """ | 
| 477 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 23, memaddr, flashaddr, size), "III", (None, None, None))
 | 
|  | 477 | +        return self.lib.monitorcommand(struct.pack("<IIII", 23, memaddr, flashaddr, size), "III", (None, None, None)) | 
| 478 | 478 |  | 
| 479 | 479 | @command() | 
| 480 | 480 | def execfirmware(self, targetaddr, addr, size): | 
| 481 | 481 | """ Moves the firmware at 'addr' with size 'size' to 'targetaddr' and passes all control to it. """ | 
| 482 | 482 | self.logger.debug("Moving firmware at 0x%X with the size %d to 0x%X and executing it\n" % (addr, size, targetaddr)) | 
| 483 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 24, targetaddr, addr, size))
 | 
|  | 483 | +        return self.lib.monitorcommand(struct.pack("<IIII", 24, targetaddr, addr, size)) | 
| 484 | 484 |  | 
| 485 | 485 | @command(timeout = 30000) | 
| 486 | 486 | def aesencrypt(self, addr, size, keyindex): | 
| — | — | @@ -486,7 +486,7 @@ | 
| 487 | 487 | """ Encrypts the buffer at 'addr' with the specified size | 
| 488 | 488 | with the hardware AES key index 'keyindex' | 
| 489 | 489 | """ | 
| 490 |  | -        return self.lib.monitorcommand(struct.pack("IBBHII", 25, 1, 0, keyindex, addr, size), "III", (None, None, None))
 | 
|  | 490 | +        return self.lib.monitorcommand(struct.pack("<IBBHII", 25, 1, 0, keyindex, addr, size), "III", (None, None, None)) | 
| 491 | 491 |  | 
| 492 | 492 | @command(timeout = 30000) | 
| 493 | 493 | def aesdecrypt(self, addr, size, keyindex): | 
| — | — | @@ -493,12 +493,12 @@ | 
| 494 | 494 | """ Decrypts the buffer at 'addr' with the specified size | 
| 495 | 495 | with the hardware AES key index 'keyindex' | 
| 496 | 496 | """ | 
| 497 |  | -        return self.lib.monitorcommand(struct.pack("IBBHII", 25, 0, 0, keyindex, addr, size), "III", (None, None, None))
 | 
|  | 497 | +        return self.lib.monitorcommand(struct.pack("<IBBHII", 25, 0, 0, keyindex, addr, size), "III", (None, None, None)) | 
| 498 | 498 |  | 
| 499 | 499 | @command(timeout = 30000) | 
| 500 | 500 | def hmac_sha1(self, addr, size, destination): | 
| 501 | 501 | """ Generates a HMAC-SHA1 hash of the buffer and saves it to 'destination' """ | 
| 502 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 26, addr, size, destination), "III", (None, None, None))
 | 
|  | 502 | +        return self.lib.monitorcommand(struct.pack("<IIII", 26, addr, size, destination), "III", (None, None, None)) | 
| 503 | 503 |  | 
| 504 | 504 | @command(target = 0x47324e49) | 
| 505 | 505 | def ipodnano2g_getnandinfo(self): | 
| — | — | @@ -505,7 +505,7 @@ | 
| 506 | 506 | """ Target-specific function: ipodnano2g | 
| 507 | 507 | Gathers some information about the NAND chip used | 
| 508 | 508 | """ | 
| 509 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 0xffff0001, 0, 0, 0), "IHHHH", ("type", "pagesperblock", "banks", "userblocks", "blocks"))
 | 
|  | 509 | +        return self.lib.monitorcommand(struct.pack("<IIII", 0xffff0001, 0, 0, 0), "IHHHH", ("type", "pagesperblock", "banks", "userblocks", "blocks")) | 
| 510 | 510 |  | 
| 511 | 511 | @command(timeout = 30000, target = 0x47324e49) | 
| 512 | 512 | def ipodnano2g_nandread(self, addr, start, count, doecc, checkempty): | 
| — | — | @@ -512,7 +512,7 @@ | 
| 513 | 513 | """ Target-specific function: ipodnano2g | 
| 514 | 514 | Reads data from the NAND chip into memory | 
| 515 | 515 | """ | 
| 516 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 0xffff0002, addr | (0x80000000 if doecc else 0) | (0x40000000 if checkempty else 0), start, count), "III", (None, None, None))
 | 
|  | 516 | +        return self.lib.monitorcommand(struct.pack("<IIII", 0xffff0002, addr | (0x80000000 if doecc else 0) | (0x40000000 if checkempty else 0), start, count), "III", (None, None, None)) | 
| 517 | 517 |  | 
| 518 | 518 | @command(timeout = 30000, target = 0x47324e49) | 
| 519 | 519 | def ipodnano2g_nandwrite(self, addr, start, count, doecc): | 
| — | — | @@ -519,7 +519,7 @@ | 
| 520 | 520 | """ Target-specific function: ipodnano2g | 
| 521 | 521 | Writes data to the NAND chip | 
| 522 | 522 | """ | 
| 523 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 0xffff0003, addr | (0x80000000 if doecc else 0), start, count), "III", (None, None, None))
 | 
|  | 523 | +        return self.lib.monitorcommand(struct.pack("<IIII", 0xffff0003, addr | (0x80000000 if doecc else 0), start, count), "III", (None, None, None)) | 
| 524 | 524 |  | 
| 525 | 525 | @command(timeout = 30000, target = 0x47324e49) | 
| 526 | 526 | def ipodnano2g_nanderase(self, addr, start, count): | 
| — | — | @@ -526,7 +526,7 @@ | 
| 527 | 527 | """ Target-specific function: ipodnano2g | 
| 528 | 528 | Erases blocks on the NAND chip and stores the results to memory | 
| 529 | 529 | """ | 
| 530 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 0xffff0004, addr, start, count), "III", (None, None, None))
 | 
|  | 530 | +        return self.lib.monitorcommand(struct.pack("<IIII", 0xffff0004, addr, start, count), "III", (None, None, None)) | 
| 531 | 531 |  | 
| 532 | 532 | @command(target = 0x4c435049) | 
| 533 | 533 | def ipodclassic_gethddinfo(self): | 
| — | — | @@ -533,7 +533,7 @@ | 
| 534 | 534 | """ Target-specific function: ipodclassic | 
| 535 | 535 | Gather information about the hard disk drive | 
| 536 | 536 | """ | 
| 537 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 0xffff0001, 0, 0, 0), "IQQII", ("identifyptr", "totalsectors", "virtualsectors", "bbtptr", "bbtsize"))
 | 
|  | 537 | +        return self.lib.monitorcommand(struct.pack("<IIII", 0xffff0001, 0, 0, 0), "IQQII", ("identifyptr", "totalsectors", "virtualsectors", "bbtptr", "bbtsize")) | 
| 538 | 538 |  | 
| 539 | 539 | @command(timeout = 30000, target = 0x4c435049) | 
| 540 | 540 | def ipodclassic_hddaccess(self, type, sector, count, addr): | 
| — | — | @@ -540,7 +540,7 @@ | 
| 541 | 541 | """ Target-specific function: ipodclassic | 
| 542 | 542 | Access the hard disk, type = 0 (read) / 1 (write) | 
| 543 | 543 | """ | 
| 544 |  | -        rc = self.lib.monitorcommand(struct.pack("IIQIIII", 0xffff0002, type, sector, count, addr, 0, 0), "III", ("rc", None, None))
 | 
|  | 544 | +        rc = self.lib.monitorcommand(struct.pack("<IIQIIII", 0xffff0002, type, sector, count, addr, 0, 0), "III", ("rc", None, None)) | 
| 545 | 545 | if (rc > 0x80000000): | 
| 546 | 546 | raise DeviceError("HDD access (type=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (type, sector, count, addr, rc)) | 
| 547 | 547 |  | 
| — | — | @@ -575,7 +575,7 @@ | 
| 576 | 576 | def storage_get_info(self, volume): | 
| 577 | 577 | """ Get information about a storage device """ | 
| 578 | 578 | self.logger.debug("Getting storage information\n") | 
| 579 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 27, volume, 0, 0), "IIIIIIII", ("version", None, None, "sectorsize", "numsectors", "vendorptr", "productptr", "revisionptr"))
 | 
|  | 579 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 27, volume, 0, 0), "IIIIIIII", ("version", None, None, "sectorsize", "numsectors", "vendorptr", "productptr", "revisionptr")) | 
| 580 | 580 | if result.version != 1: | 
| 581 | 581 | raise ValueError("Unknown version of storage_info struct: %d" % result.version) | 
| 582 | 582 | result.vendor = self.readstring(result.vendorptr) | 
| — | — | @@ -593,7 +593,7 @@ | 
| 594 | 594 | def storage_read_sectors_md(self, volume, sector, count, addr): | 
| 595 | 595 | """ Read sectors from as storage device """ | 
| 596 | 596 | self.logger.debug("Reading %d sectors from disk at volume %d, sector %d to memory at 0x%X\n" % (count, volume, sector, addr)) | 
| 597 |  | -        result = self.lib.monitorcommand(struct.pack("IIQIIII", 28, volume, sector, count, addr, 0, 0), "III", ("rc", None, None))
 | 
|  | 597 | +        result = self.lib.monitorcommand(struct.pack("<IIQIIII", 28, volume, sector, count, addr, 0, 0), "III", ("rc", None, None)) | 
| 598 | 598 | self.logger.debug("Read sectors, result: 0x%X\n" % result.rc) | 
| 599 | 599 | if result.rc > 0x80000000: | 
| 600 | 600 | raise DeviceError("storage_read_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc)) | 
| — | — | @@ -602,7 +602,7 @@ | 
| 603 | 603 | def storage_write_sectors_md(self, volume, sector, count, addr): | 
| 604 | 604 | """ Read sectors from as storage device """ | 
| 605 | 605 | self.logger.debug("Writing %d sectors from memory at 0x%X to disk at volume %d, sector %d\n" % (count, addr, volume, sector)) | 
| 606 |  | -        result = self.lib.monitorcommand(struct.pack("IIQIIII", 29, volume, sector, count, addr, 0, 0), "III", ("rc", None, None))
 | 
|  | 606 | +        result = self.lib.monitorcommand(struct.pack("<IIQIIII", 29, volume, sector, count, addr, 0, 0), "III", ("rc", None, None)) | 
| 607 | 607 | self.logger.debug("Wrote sectors, result: 0x%X\n" % result.rc) | 
| 608 | 608 | if result.rc > 0x80000000: | 
| 609 | 609 | raise DeviceError("storage_write_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc)) | 
| — | — | @@ -612,7 +612,7 @@ | 
| 613 | 613 | """ Enables/disables flushing the FAT cache after every transaction """ | 
| 614 | 614 | if state != 0: self.logger.debug("Enabling FAT flushing\n") | 
| 615 | 615 | else: self.logger.debug("Disabling FAT flushing\n") | 
| 616 |  | -        self.lib.monitorcommand(struct.pack("IIII", 58, state, 0, 0), "III", (None, None, None))
 | 
|  | 616 | +        self.lib.monitorcommand(struct.pack("<IIII", 58, state, 0, 0), "III", (None, None, None)) | 
| 617 | 617 | if state != 0: self.logger.debug("Enabled FAT flushing\n") | 
| 618 | 618 | else: self.logger.debug("Disabled FAT flushing\n") | 
| 619 | 619 |  | 
| — | — | @@ -620,7 +620,7 @@ | 
| 621 | 621 | def file_open(self, filename, mode): | 
| 622 | 622 | """ Opens a file and returns the handle """ | 
| 623 | 623 | self.logger.debug("Opening remote file %s with mode %d\n" % (filename, mode)) | 
| 624 |  | -        result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 30, mode, 0, 0, filename, 0), "III", ("fd", None, None))
 | 
|  | 624 | +        result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(filename), 30, mode, 0, 0, filename, 0), "III", ("fd", None, None)) | 
| 625 | 625 | if result.fd > 0x80000000: | 
| 626 | 626 | raise DeviceError("file_open(filename=\"%s\", mode=0x%X) failed with RC=0x%08X, errno=%d" % (filename, mode, result.fd, self.errno())) | 
| 627 | 627 | self.logger.debug("Opened file as handle 0x%X\n" % result.fd) | 
| — | — | @@ -630,7 +630,7 @@ | 
| 631 | 631 | def file_size(self, fd): | 
| 632 | 632 | """ Gets the size of a file referenced by a handle """ | 
| 633 | 633 | self.logger.debug("Getting file size of handle 0x%X\n" % fd) | 
| 634 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 31, fd, 0, 0), "III", ("size", None, None))
 | 
|  | 634 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 31, fd, 0, 0), "III", ("size", None, None)) | 
| 635 | 635 | if result.size > 0x80000000: | 
| 636 | 636 | raise DeviceError("file_size(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.size, self.errno())) | 
| 637 | 637 | self.logger.debug("Got file size: %d bytes\n" % result.size) | 
| — | — | @@ -646,7 +646,7 @@ | 
| 647 | 647 | malloc = False | 
| 648 | 648 | self.logger.debug("Reading %d bytes from file handle 0x%X to 0x%X\n" % (size, fd, addr)) | 
| 649 | 649 | try: | 
| 650 |  | -            result = self.lib.monitorcommand(struct.pack("IIII", 32, fd, addr, size), "III", ("rc", None, None))
 | 
|  | 650 | +            result = self.lib.monitorcommand(struct.pack("<IIII", 32, fd, addr, size), "III", ("rc", None, None)) | 
| 651 | 651 | if result.rc > 0x80000000: | 
| 652 | 652 | raise DeviceError("file_read(fd=%d, addr=0x%08X, size=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, addr, size, result.rc, self.errno())) | 
| 653 | 653 | except: | 
| — | — | @@ -660,7 +660,7 @@ | 
| 661 | 661 | def file_write(self, fd, size, addr): | 
| 662 | 662 | """ Writes data from a file referenced by a handle. """ | 
| 663 | 663 | self.logger.debug("Writing %d bytes from 0x%X to file handle 0x%X\n" % (size, addr, fd)) | 
| 664 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 33, fd, addr, size), "III", ("rc", None, None))
 | 
|  | 664 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 33, fd, addr, size), "III", ("rc", None, None)) | 
| 665 | 665 | if result.rc > 0x80000000: | 
| 666 | 666 | raise DeviceError("file_write(fd=%d, addr=0x%08X, size=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, addr, size, result.rc, self.errno())) | 
| 667 | 667 | self.logger.debug("File write result: 0x%X\n" % result.rc) | 
| — | — | @@ -670,7 +670,7 @@ | 
| 671 | 671 | def file_seek(self, fd, offset, whence): | 
| 672 | 672 | """ Seeks the file handle to the specified position in the file """ | 
| 673 | 673 | self.logger.debug("Seeking file handle 0x%X to whence=%d, offset=0x%X\n" % (fd, whence, offset)) | 
| 674 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 34, fd, offset, whence), "III", ("rc", None, None))
 | 
|  | 674 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 34, fd, offset, whence), "III", ("rc", None, None)) | 
| 675 | 675 | if result.rc > 0x80000000: | 
| 676 | 676 | raise DeviceError("file_seek(fd=%d, offset=0x%08X, whence=%d) failed with RC=0x%08X, errno=%d" % (fd, offset, whence, result.rc, self.errno())) | 
| 677 | 677 | self.logger.debug("File seek result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -680,7 +680,7 @@ | 
| 681 | 681 | def file_truncate(self, fd, length): | 
| 682 | 682 | """ Truncates a file referenced by a handle to a specified length """ | 
| 683 | 683 | self.logger.debug("Truncating file with handle 0x%X to 0x%X bytes\n" % (fd, length)) | 
| 684 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 35, fd, offset, 0), "III", ("rc", None, None))
 | 
|  | 684 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 35, fd, offset, 0), "III", ("rc", None, None)) | 
| 685 | 685 | if result.rc > 0x80000000: | 
| 686 | 686 | raise DeviceError("file_truncate(fd=%d, length=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, length, result.rc, self.errno())) | 
| 687 | 687 | self.logger.debug("File truncate result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -690,7 +690,7 @@ | 
| 691 | 691 | def file_sync(self, fd): | 
| 692 | 692 | """ Flushes a file handles' buffers """ | 
| 693 | 693 | self.logger.debug("Flushing buffers of file with handle 0x%X\n" % (fd)) | 
| 694 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 36, fd, 0, 0), "III", ("rc", None, None))
 | 
|  | 694 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 36, fd, 0, 0), "III", ("rc", None, None)) | 
| 695 | 695 | if result.rc > 0x80000000: | 
| 696 | 696 | raise DeviceError("file_sync(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.rc, self.errno())) | 
| 697 | 697 | self.logger.debug("File flush result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -700,7 +700,7 @@ | 
| 701 | 701 | def file_close(self, fd): | 
| 702 | 702 | """ Closes a file handle """ | 
| 703 | 703 | self.logger.debug("Closing file handle 0x%X\n" % (fd)) | 
| 704 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 37, fd, 0, 0), "III", ("rc", None, None))
 | 
|  | 704 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 37, fd, 0, 0), "III", ("rc", None, None)) | 
| 705 | 705 | if result.rc > 0x80000000: | 
| 706 | 706 | raise DeviceError("file_close(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.rc, self.errno())) | 
| 707 | 707 | self.logger.debug("File close result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -710,7 +710,7 @@ | 
| 711 | 711 | def file_close_all(self): | 
| 712 | 712 | """ Closes all file handles opened through the debugger """ | 
| 713 | 713 | self.logger.debug("Closing all files that were opened via USB\n") | 
| 714 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 38, 0, 0, 0), "III", ("rc", None, None))
 | 
|  | 714 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 38, 0, 0, 0), "III", ("rc", None, None)) | 
| 715 | 715 | if result.rc > 0x80000000: | 
| 716 | 716 | raise DeviceError("file_close_all() failed with RC=0x%08X, errno=%d" % (result.rc, self.errno())) | 
| 717 | 717 | self.logger.debug("Closed %d files\n" % (result.rc)) | 
| — | — | @@ -720,7 +720,7 @@ | 
| 721 | 721 | def file_kill_all(self, volume): | 
| 722 | 722 | """ Kills all file handles of a volume (in the whole system) """ | 
| 723 | 723 | self.logger.debug("Killing all file handles of volume %d\n" % (volume)) | 
| 724 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 39, volume, 0, 0), "III", ("rc", None, None))
 | 
|  | 724 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 39, volume, 0, 0), "III", ("rc", None, None)) | 
| 725 | 725 | if result.rc > 0x80000000: | 
| 726 | 726 | raise DeviceError("file_kill_all() failed with RC=0x%08X, errno=%d" % (result.rc, self.errno())) | 
| 727 | 727 | self.logger.debug("Closed %d files\n" % (result.rc)) | 
| — | — | @@ -730,7 +730,7 @@ | 
| 731 | 731 | def file_unlink(self, filename): | 
| 732 | 732 | """ Removes a file """ | 
| 733 | 733 | self.logger.debug("Deleting file %s\n" % (filename)) | 
| 734 |  | -        result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 40, 0, 0, 0, filename, 0), "III", ("rc", None, None))
 | 
|  | 734 | +        result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(filename), 40, 0, 0, 0, filename, 0), "III", ("rc", None, None)) | 
| 735 | 735 | if result.rc > 0x80000000: | 
| 736 | 736 | raise DeviceError("file_unlink(filename=\"%s\") failed with RC=0x%08X, errno=%d" % (filename, result.rc, self.errno())) | 
| 737 | 737 | self.logger.debug("Delete file result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -740,7 +740,7 @@ | 
| 741 | 741 | def file_rename(self, oldname, newname): | 
| 742 | 742 | """ Renames a file """ | 
| 743 | 743 | self.logger.debug("Renaming file %s to %s\n" % (oldname, newname)) | 
| 744 |  | -        result = self.lib.monitorcommand(struct.pack("IIII248s%dsB" % min(247, len(newname)), 41, 0, 0, 0, oldname, newname, 0), "III", ("rc", None, None))
 | 
|  | 744 | +        result = self.lib.monitorcommand(struct.pack("<IIII248s%dsB" % min(247, len(newname)), 41, 0, 0, 0, oldname, newname, 0), "III", ("rc", None, None)) | 
| 745 | 745 | if result.rc > 0x80000000: | 
| 746 | 746 | raise DeviceError("file_rename(oldname=\"%s\", newname=\"%s\") failed with RC=0x%08X, errno=%d" % (oldname, newname, result.rc, self.errno())) | 
| 747 | 747 | self.logger.debug("Rename file result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -750,7 +750,7 @@ | 
| 751 | 751 | def dir_open(self, dirname): | 
| 752 | 752 | """ Opens a directory and returns the handle """ | 
| 753 | 753 | self.logger.debug("Opening directory %s\n" % (dirname)) | 
| 754 |  | -        result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 42, 0, 0, 0, dirname, 0), "III", ("handle", None, None))
 | 
|  | 754 | +        result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dirname), 42, 0, 0, 0, dirname, 0), "III", ("handle", None, None)) | 
| 755 | 755 | if result.handle == 0: | 
| 756 | 756 | raise DeviceError("dir_open(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.handle, self.errno())) | 
| 757 | 757 | self.logger.debug("Opened directory as handle 0x%X\n" % (result.handle)) | 
| — | — | @@ -760,7 +760,7 @@ | 
| 761 | 761 | def dir_read(self, handle): | 
| 762 | 762 | """ Reads the next entry from a directory """ | 
| 763 | 763 | self.logger.debug("Reading next entry of directory handle 0x%X\n" % (handle)) | 
| 764 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 43, handle, 0, 0), "III", ("version", "maxpath", "ptr"))
 | 
|  | 764 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 43, handle, 0, 0), "III", ("version", "maxpath", "ptr")) | 
| 765 | 765 | if result.ptr == 0: | 
| 766 | 766 | raise DeviceError("dir_read(handle=0x%08X) failed with RC=0x%08X, errno=%d" % (handle, result.ptr, self.errno())) | 
| 767 | 767 | if result.version != 1: | 
| — | — | @@ -767,7 +767,7 @@ | 
| 768 | 768 | raise ValueError("Unknown version of dirent struct: %d" % result.version) | 
| 769 | 769 | dirent = self.read(result.ptr, result.maxpath + 16) | 
| 770 | 770 | ret = Bunch() | 
| 771 |  | -        (ret.name, ret.attributes, ret.size, ret.startcluster, ret.wrtdate, ret.wrttime) = struct.unpack("%dsIIIHH" % result.maxpath, dirent)
 | 
|  | 771 | +        (ret.name, ret.attributes, ret.size, ret.startcluster, ret.wrtdate, ret.wrttime) = struct.unpack("<%dsIIIHH" % result.maxpath, dirent) | 
| 772 | 772 | ret.name = ret.name[:ret.name.index('\x00')] | 
| 773 | 773 | self.logger.debug("Read directory entry:\n") | 
| 774 | 774 | self.logger.debug("Name: %s\n" % ret.name) | 
| — | — | @@ -782,7 +782,7 @@ | 
| 783 | 783 | def dir_close(self, handle): | 
| 784 | 784 | """ Closes a directory handle """ | 
| 785 | 785 | self.logger.debug("Closing directory handle 0x%X\n" % (handle)) | 
| 786 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 44, handle, 0, 0), "III", ("rc", None, None))
 | 
|  | 786 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 44, handle, 0, 0), "III", ("rc", None, None)) | 
| 787 | 787 | if result.rc > 0x80000000: | 
| 788 | 788 | raise DeviceError("dir_close(handle=0x%08X) failed with RC=0x%08X, errno=%d" % (handle, result.rc, self.errno())) | 
| 789 | 789 | self.logger.debug("Close directory result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -792,7 +792,7 @@ | 
| 793 | 793 | def dir_close_all(self): | 
| 794 | 794 | """ Closes all directory handles opened through the debugger """ | 
| 795 | 795 | self.logger.debug("Closing all directories that were opened via USB\n") | 
| 796 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 45, 0, 0, 0), "III", ("rc", None, None))
 | 
|  | 796 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 45, 0, 0, 0), "III", ("rc", None, None)) | 
| 797 | 797 | if result.rc > 0x80000000: | 
| 798 | 798 | raise DeviceError("dir_close_all() failed with RC=0x%08X, errno=%d" % (result.rc, self.errno())) | 
| 799 | 799 | self.logger.debug("Closed %d directories\n" % (result.rc)) | 
| — | — | @@ -802,7 +802,7 @@ | 
| 803 | 803 | def dir_kill_all(self, volume): | 
| 804 | 804 | """ Kills all directory handles of a volume (in the whole system) """ | 
| 805 | 805 | self.logger.debug("Closing all directories of volume %d\n" % (volume)) | 
| 806 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 46, volume, 0, 0), "III", ("rc", None, None))
 | 
|  | 806 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 46, volume, 0, 0), "III", ("rc", None, None)) | 
| 807 | 807 | if result.rc > 0x80000000: | 
| 808 | 808 | raise DeviceError("dir_kill_all() failed with RC=0x%08X, errno=%d" % (result.rc, self.errno())) | 
| 809 | 809 | self.logger.debug("Closed %d directories\n" % (result.rc)) | 
| — | — | @@ -812,7 +812,7 @@ | 
| 813 | 813 | def dir_create(self, dirname): | 
| 814 | 814 | """ Creates a directory """ | 
| 815 | 815 | self.logger.debug("Creating directory %s\n" % (dirname)) | 
| 816 |  | -        result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 47, 0, 0, 0, dirname, 0), "III", ("rc", None, None))
 | 
|  | 816 | +        result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dirname), 47, 0, 0, 0, dirname, 0), "III", ("rc", None, None)) | 
| 817 | 817 | if result.rc > 0x80000000: | 
| 818 | 818 | raise DeviceError("dir_create(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.rc, self.errno())) | 
| 819 | 819 | self.logger.debug("Create directory result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -822,7 +822,7 @@ | 
| 823 | 823 | def dir_remove(self, dirname): | 
| 824 | 824 | """ Removes an (empty) directory """ | 
| 825 | 825 | self.logger.debug("Removing directory %s\n" % (dirname)) | 
| 826 |  | -        result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 48, 0, 0, 0, dirname, 0), "III", ("rc", None, None))
 | 
|  | 826 | +        result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dirname), 48, 0, 0, 0, dirname, 0), "III", ("rc", None, None)) | 
| 827 | 827 | if result.rc > 0x80000000: | 
| 828 | 828 | raise DeviceError("dir_remove(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.rc, self.errno())) | 
| 829 | 829 | self.logger.debug("Remove directory result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -832,7 +832,7 @@ | 
| 833 | 833 | def errno(self): | 
| 834 | 834 | """ Returns the number of the last error that happened """ | 
| 835 | 835 | self.logger.debug("Getting last error number\n") | 
| 836 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 49, 0, 0, 0), "III", ("errno", None, None))
 | 
|  | 836 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 49, 0, 0, 0), "III", ("errno", None, None)) | 
| 837 | 837 | self.logger.debug("Last error: 0x%X\n" % (result.errno)) | 
| 838 | 838 | return result.errno | 
| 839 | 839 |  | 
| — | — | @@ -840,7 +840,7 @@ | 
| 841 | 841 | def disk_mount(self, volume): | 
| 842 | 842 | """ Mounts a volume """ | 
| 843 | 843 | self.logger.debug("Mounting volume %d\n" % (volume)) | 
| 844 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 50, volume, 0, 0), "III", ("rc", None, None))
 | 
|  | 844 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 50, volume, 0, 0), "III", ("rc", None, None)) | 
| 845 | 845 | if result.rc > 0x80000000: | 
| 846 | 846 | raise DeviceError("disk_mount(volume=%d) failed with RC=0x%08X, errno=%d" % (volume, result.rc, self.errno())) | 
| 847 | 847 | self.logger.debug("Mount volume result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -850,7 +850,7 @@ | 
| 851 | 851 | def disk_unmount(self, volume): | 
| 852 | 852 | """ Unmounts a volume """ | 
| 853 | 853 | self.logger.debug("Unmounting volume %d\n" % (volume)) | 
| 854 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 51, volume, 0, 0), "III", ("rc", None, None))
 | 
|  | 854 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 51, volume, 0, 0), "III", ("rc", None, None)) | 
| 855 | 855 | if result.rc > 0x80000000: | 
| 856 | 856 | raise DeviceError("disk_unmount(volume=%d) failed with RC=0x%08X, errno=%d" % (volume, result.rc, self.errno())) | 
| 857 | 857 | self.logger.debug("Unmount volume result: 0x%X\n" % (result.rc)) | 
| — | — | @@ -860,7 +860,7 @@ | 
| 861 | 861 | def malloc(self, size): | 
| 862 | 862 | """ Allocates 'size' bytes and returns a pointer to the allocated memory """ | 
| 863 | 863 | self.logger.debug("Allocating %d bytes of memory\n" % size) | 
| 864 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 52, size, 0, 0), "III", ("ptr", None, None))
 | 
|  | 864 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 52, size, 0, 0), "III", ("ptr", None, None)) | 
| 865 | 865 | self.logger.debug("Allocated %d bytes of memory at 0x%X\n" % (size, result.ptr)) | 
| 866 | 866 | return result.ptr | 
| 867 | 867 |  | 
| — | — | @@ -868,7 +868,7 @@ | 
| 869 | 869 | def memalign(self, align, size): | 
| 870 | 870 | """ Allocates 'size' bytes aligned to 'align' and returns a pointer to the allocated memory """ | 
| 871 | 871 | self.logger.debug("Allocating %d bytes of memory aligned to 0x%X\n" % (size, align)) | 
| 872 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 53, align, size, 0), "III", ("ptr", None, None))
 | 
|  | 872 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 53, align, size, 0), "III", ("ptr", None, None)) | 
| 873 | 873 | self.logger.debug("Allocated %d bytes of memory at 0x%X\n" % (size, result.ptr)) | 
| 874 | 874 | return result.ptr | 
| 875 | 875 |  | 
| — | — | @@ -879,7 +879,7 @@ | 
| 880 | 880 | Returns a pointer to the reallocated memory. | 
| 881 | 881 | """ | 
| 882 | 882 | self.logger.debug("Reallocating 0x%X to have the new size %d\n" % (ptr, size)) | 
| 883 |  | -        result = self.lib.monitorcommand(struct.pack("IIII", 54, ptr, size, 0), "III", ("ptr", None, None))
 | 
|  | 883 | +        result = self.lib.monitorcommand(struct.pack("<IIII", 54, ptr, size, 0), "III", ("ptr", None, None)) | 
| 884 | 884 | self.logger.debug("Reallocated memory at 0x%X to 0x%X with the new size %d\n" % (ptr, result.ptr, size)) | 
| 885 | 885 | return result.ptr | 
| 886 | 886 |  | 
| — | — | @@ -887,19 +887,19 @@ | 
| 888 | 888 | def reownalloc(self, ptr, owner): | 
| 889 | 889 | """ Changes the owner of the memory allocation 'ptr' to the thread struct at addr 'owner' """ | 
| 890 | 890 | self.logger.debug("Changing owner of the memory region 0x%X to 0x%X\n" % (ptr, owner)) | 
| 891 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 55, ptr, owner, 0), "III", (None, None, None))
 | 
|  | 891 | +        return self.lib.monitorcommand(struct.pack("<IIII", 55, ptr, owner, 0), "III", (None, None, None)) | 
| 892 | 892 |  | 
| 893 | 893 | @command() | 
| 894 | 894 | def free(self, ptr): | 
| 895 | 895 | """ Frees the memory space pointed to by 'ptr' """ | 
| 896 | 896 | self.logger.debug("Freeing the memory region at 0x%X\n" % ptr) | 
| 897 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 56, ptr, 0, 0), "III", (None, None, None))
 | 
|  | 897 | +        return self.lib.monitorcommand(struct.pack("<IIII", 56, ptr, 0, 0), "III", (None, None, None)) | 
| 898 | 898 |  | 
| 899 | 899 | @command() | 
| 900 | 900 | def free_all(self): | 
| 901 | 901 | """ Frees all memory allocations created by the monitor thread """ | 
| 902 | 902 | self.logger.debug("Freeing all memory allocations created by the monitor thread\n") | 
| 903 |  | -        return self.lib.monitorcommand(struct.pack("IIII", 57, 0, 0, 0), "III", (None, None, None))
 | 
|  | 903 | +        return self.lib.monitorcommand(struct.pack("<IIII", 57, 0, 0, 0), "III", (None, None, None)) | 
| 904 | 904 |  | 
| 905 | 905 |  | 
| 906 | 906 | class Lib(object): |