def gate(method, buf_io, arg2): # the "callgate" into the bootloader # - only spuratically implemented (say it like in _Clueless_) # - none of the error checking is repeated here # - not trying too hard to fake the hardware-related features if method == 0: # version string hc = b'2.0.0 time=20180220.092345 git=master@f8d1758' buf_io[0:len(hc)] = hc return len(hc) if method == 16: if len(buf_io) < 8: return ERANGE return pin_prefix(buf_io[0:arg2], buf_io) if method == 18: from sim_secel import pin_stuff return pin_stuff(arg2, buf_io) if method == 4: # control the green/red light global genuine_led if arg2 == 1: # clear it genuine_led = False led_pipe.write(bytes([0x10])) return 1 if genuine_led else 0 if method == 5: # are we a brick? No. return 0 if method == 6: # do we have 608? return ENOENT if not version.has_608 else 0 if method == 19: # bag number if arg2 == 0: buf_io[0:32] = b'CSIM0000' + b'\0' * (32 - 8) if arg2 == 1: # not supported: write return buf_io if method == 21: # high water mark if arg2 == 0: buf_io[0:8] = b'\x18\x07\x11\x19S\x08\x00\x00' return 0 if method == 20: # read 608 config bytes (128) assert len(buf_io) == 128 buf_io[:] = b'\x01#\xbf\x0b\x00\x00`\x03CP,\xbf\xeeap\x00\xe1\x00a\x00\x00\x00\x8f-\x8f\x80\x8fC\xaf\x80\x00C\x00C\x8fG\xc3C\xc3C\xc7G\x00G\x00\x00\x8fM\x8fC\x00\x00\x00\x00\x1f\xff\x00\x1a\x00\x1a\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xea\xff\x02\x15\x00\x00\x00\x00<\x00\\\x00\xbc\x01\xfc\x01\xbc\x01\x9c\x01\x9c\x01\xfc\x01\xdc\x03\xdc\x03\xdc\x07\x9c\x01<\x00\xfc\x01\xdc\x01<\x00' return 0 return ENOENT
def gate(method, buf_io, arg2): # the "callgate" into the bootloader # - only spuratically implemented (say it like in _Clueless_) # - none of the error checking is repeated here # - not trying too hard to fake the hardware-related features if method == 0: # version string hc = b'1.0.0 time=20180220.092345 git=master@f8d1758' buf_io[0:len(hc)] = hc return len(hc) if method == 16: if len(buf_io) < 8: return ERANGE return pin_prefix(buf_io[0:arg2], buf_io) if method == 18: from sim_secel import pin_stuff return pin_stuff(arg2, buf_io) if method == 4: # control the green/red light global genuine_led if arg2 == 1: # clear it genuine_led = False led_pipe.write(bytes([0x10])) return 1 if genuine_led else 0 if method == 5: # are we a brick? No. return 0 if method == 19: # bag number if arg2 == 0: buf_io[0:32] = b'CSIM0000' + b'\0' * (32 - 8) if arg2 == 1: # not supported: write return buf_io if method == 21: # high water mark if arg2 == 0: buf_io[0:8] = b'\x18\x07\x11\x19S\x08\x00\x00' return 0 return ENOENT