Skip to content

Commit cf0cf38

Browse files
committed
fixup! m1n1.fw.mtp: Fix parsing of init messages
1 parent e92f59d commit cf0cf38

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

proxyclient/m1n1/fw/mtp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InitBlock(ConstructClass):
2525
Switch(this.type, {
2626
0: HIDDescriptor,
2727
1: GPIOInit,
28-
2: GreedyBytes, # Unknown 6 bytes
28+
2: GreedyBytes, # Unknown 6 bytes terminator
2929
7: GreedyBytes, # Device name
3030
}, default=GreedyBytes))
3131
)
@@ -255,7 +255,6 @@ def report(self, msg):
255255
self.log(f"Got HID descriptor for {iface}:")
256256
iface.descriptor = blk.payload.descriptor
257257
self.log(hexdump(iface.descriptor))
258-
iface.initialize()
259258
elif isinstance(blk.payload, GPIOInit):
260259
self.log(f"GPIO Init: {blk.payload}")
261260
prop = getattr(self.proto.node[msg.device_name],
@@ -264,6 +263,8 @@ def report(self, msg):
264263
val = prop.args[1]
265264
self.log(f"GPIO key: {key}")
266265
self.gpios[(msg.device_id, blk.payload.gpio_id)] = key, val
266+
if not msg.more_packets:
267+
iface.initialize()
267268
elif isinstance(msg, GPIORequestMsg):
268269
self.log(f"GPIO request: {msg}")
269270
smcep = self.proto.smc.epmap[0x20]

0 commit comments

Comments
 (0)