test.py 763 B

123456789101112131415161718192021222324
  1. import usb.core
  2. import usb.util
  3. import time
  4. # Find our device
  5. dev = usb.core.find(idVendor=0x1430, idProduct=0x0150)
  6. if dev is None:
  7. raise ValueError('Device not found')
  8. try:
  9. dev.detach_kernel_driver(0)
  10. except:
  11. pass
  12. dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"C\xff\x00\x00", timeout=None)
  13. time.sleep(0.001)
  14. while True:
  15. dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"J\x00\xff\x00\x00\xD0\x07", timeout=None)
  16. time.sleep(3)
  17. dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"J\x00\x00\xff\x00\xD0\x07", timeout=None)
  18. time.sleep(3)
  19. dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"J\x00\x00\x00\xff\xD0\x07", timeout=None)
  20. time.sleep(3)