I'm trying to implement driver mechanism for usb barcode scanner on Centos.
Using PyUSB,
Here is high-level code. I am trying to achieve is to be able to read QR-Codes and BarCodes when someone scans and send it to message queue without user interaction.
dev = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
if dev.is_kernel_driver_active(0) is True:
dev.detach_kernel_driver(0)
dev.set_configuration()
dev.reset()
data = dev.read(endpoint.bEndpointAddress, 120,
timeout=10000)
currentData = list(chunks(data))
This code work fine on the same system with Ubuntu operating system. But on Centos 7 , All I hear rapid beeps, and nothing read from the scanner.
Here is everything installed on Centos, almost similar to Ubuntu that I ran on the same machine.
"libgusb.x86_64 0.2.9-1.el7 @base
libgusb-devel.x86_64 0.2.9-1.el7 @base
libusb.x86_64 1:0.1.4-3.el7 @base
libusb-devel.x86_64 1:0.1.4-3.el7 @base
libusbmuxd.x86_64 1.0.10-5.el7 @base
libusbmuxd-devel.x86_64 1.0.10-5.el7 @base
libusbmuxd-utils.x86_64 1.0.10-5.el7 @base
libusbx.x86_64 1.0.20-1.el7 @base
libusbx-devel.x86_64 1.0.20-1.el7 @base
pyusb.noarch 1.0.0-0.11.b1.el7 @base
usb_modeswitch.x86_64 2.4.0-5.el7 @base
usb_modeswitch-data.noarch 20160612-2.el7 @base
usbmuxd.x86_64 1.1.0-1.el7 @base
usbredir.x86_64 0.7.1-2.el7 @base
usbutils.x86_64 007-5.el7 @base"
Not sure what's the isse.
If I run, bellow block in loop,
print("Waiting to Read")
data = dev.read(endpoint.bEndpointAddress, 120,
timeout=10000)
currentData = list(chunks(data))
Output is Waiting to read