What's the downside of using a long timeout on endpoint.read() (barcode scanner) #473
-
I'm currently trying to get scanned values from a barcode scanner. The rough script I'm using is the following: while True:
try:
# Wait up to 0.5 seconds for data. 500 = 0.5 second timeout.
data = ep.read(1000, 500)
Some Operation here that takes for example 2s ...
except usb.core.USBError:
# Timed out. End of the data stream. Print the scan line.
if len(line) > 0:
print line
line = '' With 500ms (0.5s) timeout, I often get incomplete scanned values from I'd like to capture all 10 digits in one |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Maybe you can try 5s first to see if that helps. If that does not work then increase the timeout valaue. It should be okay to increase the timeout value in your use case. |
Beta Was this translation helpful? Give feedback.
Maybe you can try 5s first to see if that helps. If that does not work then increase the timeout valaue. It should be okay to increase the timeout value in your use case.