Advertisement
Guest User

Untitled

a guest
Jul 7th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. import usb.core
  2. import usb.util
  3.  
  4. VENDOR_ID = 0x0C45
  5. PRODUCT_ID = 0x7100
  6.  
  7. # find our device
  8. device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
  9.  
  10. # was it found?
  11. if device is None:
  12.     sys.exit("Could not find BitFenix Recon.")
  13.  
  14. # make sure the hiddev kernel driver is not active
  15. if device.is_kernel_driver_active(0):
  16.     try:
  17.         device.detach_kernel_driver(0)
  18.     except usb.core.USBError as e:
  19.         sys.exit("Could not detatch kernel driver: %s" % str(e))
  20.  
  21. try:
  22.     device.set_configuration()
  23.     #device.reset()
  24.     usb.util.claim_interface(device, 0)
  25. except usb.core.USBError as e:
  26.     sys.exit("Could not set configuration: %s" % str(e))
  27.    
  28. endpoint = device[0][(0,0)][0]
  29. while 1:
  30.     try:
  31.         print endpoint.bEndpointAddress
  32.         print device.read(endpoint.bEndpointAddress, 8)
  33.     except usb.core.USBError as e:
  34.         print e
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement