|
@@ -13,30 +13,30 @@ if dev is None:
|
|
|
raise ValueError("Device Not Found!")
|
|
|
|
|
|
|
|
|
-if dev.is_kernel_driver_active(0):
|
|
|
- try:
|
|
|
- dev.detach_kernel_driver(0)
|
|
|
- detached = True
|
|
|
- print("Kernel detached")
|
|
|
- except USBError as e:
|
|
|
- exit("Failed detaching kernel driver!")
|
|
|
-else:
|
|
|
- print("No Kernel Attached!")
|
|
|
-
|
|
|
-try:
|
|
|
- util.claim_interface(dev, 0)
|
|
|
- print("Claimed Device!")
|
|
|
-except:
|
|
|
- endpoint = dev[0][(0,0)][0]
|
|
|
- data = dev.read(endpoint.bEndpointAddress, 0x0040)
|
|
|
- print(type(data))
|
|
|
- print(data)
|
|
|
-
|
|
|
-if detached:
|
|
|
- dev.attach_kernel_driver(0)
|
|
|
- print("Kernel attached")
|
|
|
-
|
|
|
-exit()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -44,14 +44,19 @@ exit()
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+dev.reset()
|
|
|
+
|
|
|
|
|
|
cfg = dev.get_active_configuration()
|
|
|
|
|
|
-print(cfg)
|
|
|
+
|
|
|
|
|
|
|
|
|
intf = cfg[(0, 0)]
|
|
|
|
|
|
+print(intf)
|
|
|
+
|
|
|
|
|
|
|
|
|
ep = util.find_descriptor(
|
|
@@ -59,8 +64,8 @@ ep = util.find_descriptor(
|
|
|
custom_match = \
|
|
|
lambda e: \
|
|
|
util.endpoint_direction(e.bEndpointAddress) == \
|
|
|
- util.ENDPOINT_OUT)
|
|
|
+ util.ENDPOINT_IN)
|
|
|
|
|
|
assert ep is not None
|
|
|
-
|
|
|
-ep.write('0x57E3E817,32,1\n')
|
|
|
+
|
|
|
+ep.write(b'0x57E3E817,32,1\n')
|