Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pywinusb.hid as hid
- from time import sleep
- import re
- import linecache
- vendor_id = 0x6688
- product_id = 0x6850
- devices = hid.HidDeviceFilter(vendor_id=vendor_id, product_id=product_id).get_devices()
- def sample_handler(data):
- for i in data:
- if data[9]!=0:
- print(data[9])
- return
- if devices:
- device = devices[0]
- device.open()
- device.set_raw_data_handler(sample_handler)
- print("------------")
- while device.is_plugged():
- # just keep the device opened to receive events
- sleep(0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement