Guest User

Untitled

a guest
Dec 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import usb, usb.core, usb.util, usb.backend.libusb1
  2.  
  3. ...snippet...
  4.  
  5. # usb.core.find()
  6. # find our device
  7.  
  8. dev = usb.core.find(idVendor= ...., idProduct= ....)
  9. #dev_1 = usb.util.find_descriptor(cfg, find_all =True)
  10.  
  11. # was it found?
  12. if dev is None:
  13. raise ValueError('Device not found')
  14.  
  15. #x = dev.set_configuration()
  16. #print (dev)
  17. #print (help(usb.core))
  18. if usb.core.find(find_all=True, bDeviceClass=7) is None:
  19. raise ValueError('No printer found')
Add Comment
Please, Sign In to add comment