python - How to Detect event generated by USB device into raspberry pi -
hello geniuses want detect event generated usb device attached barcode scanner.now want barcode scanner plugged in usb port of raspberry pi.now when scan how can rpi detect usb device has generated event. hopefully pyusb works, , in case can follow this guide if whatever reason doesn't work, open /dev/tty device direclty standard: with open('/dev/tty4', 'rb') fh: event in fh.read(8) note /dev/tty out-of-the-hat example, device might end somewhere else. check dmsg , lsusb determine device got mounted, if @ mounted or discovered. might need specific drivers scanner.