| Index: embios/trunk/tools/embios.py |
| — | — | @@ -26,6 +26,7 @@ |
| 27 | 27 | import inspect
|
| 28 | 28 | import re
|
| 29 | 29 | import time
|
| | 30 | +import struct
|
| 30 | 31 |
|
| 31 | 32 | from functools import wraps
|
| 32 | 33 |
|
| — | — | @@ -387,7 +388,8 @@ |
| 388 | 389 | slave = self._hexint(slave)
|
| 389 | 390 | addr = self._hexint(addr)
|
| 390 | 391 | size = self._hexint(size)
|
| 391 | | - self.embios.i2cread(bus, slave, addr, size)
|
| | 392 | + for i in range(size):
|
| | 393 | + print("%02X: %02X" % (addr + i, struct.unpack("B", self.embios.i2cread(bus, slave, addr + i, 1))[0]))
|
| 392 | 394 |
|
| 393 | 395 | @command
|
| 394 | 396 | def i2cwrite(self, bus, slave, addr, *args):
|
| Index: embios/trunk/tools/libembios.py |
| — | — | @@ -233,7 +233,7 @@ |
| 234 | 234 | raise ValueError("Size must be a number between 1 and 256")
|
| 235 | 235 | if size == 256:
|
| 236 | 236 | size = 0
|
| 237 | | - return self.lib.monitorcommand(struct.pack("IBBBBII%ds" % size, 9, index, slaveaddr, startaddr, size, 0, 0, data), "III" % size, (None, None, None))
|
| | 237 | + return self.lib.monitorcommand(struct.pack("IBBBBII%ds" % size, 9, index, slaveaddr, startaddr, size, 0, 0, data), "III", (None, None, None))
|
| 238 | 238 |
|
| 239 | 239 | def usbcread(self):
|
| 240 | 240 | """ Reads one packet with the maximal cin size """
|
| — | — | @@ -258,7 +258,7 @@ |
| 259 | 259 | identified with the specified bitmask
|
| 260 | 260 | """
|
| 261 | 261 | cin_maxsize = self.lib.dev.packetsizelimit["cin"] - self.lib.headersize
|
| 262 | | - resp = self.lib.monitorcommand(struct.pack("IIII", 14, cin_maxsize, 0, 0), "III%ds" % cin_maxsize, ("size", None, None))
|
| | 262 | + resp = self.lib.monitorcommand(struct.pack("IIII", 13, cin_maxsize, 0, 0), "III%ds" % cin_maxsize, ("size", None, None))
|
| 263 | 263 | resp.data = resp.data[size:]
|
| 264 | 264 | resp.maxsize = cin_maxsize
|
| 265 | 265 | return resp
|
| — | — | @@ -271,7 +271,7 @@ |
| 272 | 272 | size = len(data)
|
| 273 | 273 | while len(data) > 0:
|
| 274 | 274 | writesize = min(cin_maxsize, len(data))
|
| 275 | | - resp = self.lib.monitorcommand(struct.pack("IIII%ds" % writesize, 13, writesize, 0, 0, data[:writesize]), "III", (None, None, None))
|
| | 275 | + resp = self.lib.monitorcommand(struct.pack("IIII%ds" % writesize, 12, writesize, 0, 0, data[:writesize]), "III", (None, None, None))
|
| 276 | 276 | data = data[writesize:]
|
| 277 | 277 | return size
|
| 278 | 278 |
|