Quote:
Originally Posted by kovidgoyal
EDIT: Looking at my code, I always sent 8bytes as the key, never 4
Hmm the screen lock code is still 4 characters in length, so this seems to be pretty pointless.
|
The --log-packets says 4 and the source code I have says 4...
Code:
class UnlockDevice(ShortCommand):
""" Unlock the device """
NUMBER = 0x106 #: Command number
def __init__(self, key=0x312d):
ShortCommand.__init__(self, \
number=UnlockDevice.NUMBER, type=0x01, command=key)
class ShortCommand(Command):
""" A L{Command} whoose data section is 4 bytes long """
SIZE = 20 #: Packet size in bytes
# Usually carries additional information
command = field(start=16, fmt=DWORD)
def __init__(self, number=0x00, type=0x00, command=0x00):
"""
@param number: L{Command.number}
@param type: L{Command.type}
@param command: L{ShortCommand.command}
"""
Command.__init__(self, ShortCommand.SIZE)
self.number = number
self.type = type
self.length = 4
self.command = command
I believe the hard coded "self.length = 4" seals the deal.
Code:
res = self.send_validated_command(SetBulkSize(size=0x028000))
if res.code != 0:
raise ProtocolError("Unable to set bulk size.")
self.send_validated_command(UnlockDevice(key=0x312d))