Skip to content

Instantly share code, notes, and snippets.

Created February 11, 2017 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/47b516294023055d44505c3331a64657 to your computer and use it in GitHub Desktop.
Save anonymous/47b516294023055d44505c3331a64657 to your computer and use it in GitHub Desktop.
import usb.core
import usb.util
import usb.backend.libusb1
import sys
from time import sleep
VENDOR_ID = 0x046D
PRODUCT_ID = 0xC31D
INTERFACE = 0
BACKEND = usb.backend.libusb1.get_backend(find_library=lambda x: "libusb-1.0.dll")
dev = None
while dev is None:
print ("Waiting for device...", end="\r")
dev = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID, backend=BACKEND)
sleep (0.1)
print ("Device found! ")
dev.set_configuration()
#print (dev)
endpoint = dev[0][(0,0)][0]
print (endpoint.bEndpointAddress)
while True:
t_list = []
try:
read = dev.ctrl_transfer(0x81, 11, 0, 0, 4) #read 8 bytes
print(read)
t_list.append(read)
except:
continue
#print (t_list, end="\r")
#print (t_list[2], end="\n\n")
sleep (0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment