1

I use a 2D barcode scanner to scan the barcode (CODE128) off a smartphone screen. I have a program (python script) to listen for the scanned data while the code is being scanned, however, the issue is that sometimes the data received in the python script is not complete (e.g. less number of digits than expected), but the scanner beeps so it's inside the python script where the data is partially lost/not captured sometimes.

So I was wondering, is there a way to give a command to the USB scanner to beep from the Python program only after the script validates the received digits? So if the received digits are not correct, then don't let the scanner beep, otherwise, let the scanner beep.

If this helps, I'm using this python script for listening to scanned data.

(the barcode scanner is Eyoyo EY-H1)

Sam
  • 475
  • 1
  • 7
  • 19
  • That would depend on the specific scanner you're using. Consult its documentation. – Ken White Feb 23 '23 at 02:47
  • @KenWhitethe instruction manual that comes with it, contains many QR codes that I can scan to change settings, but I would like to issue beeps conditionally from the python code. It also has QRcode setting to switch between HID-KBW(which is the default and what I'm using), USB HID-POS interface, which I'm not sure what that is, and once I switch to it, my computer cannot find the device anymore – Sam Feb 23 '23 at 02:59
  • Wanted to see if you had this figured out? My initial thought on this is no. You'd have to turn off the scanner beep and have your script do that. This python script is "tricking" the system into treating the scanner like a COM device. By default out of the box, this scanner is a USB "keyboard" (HID-KBW = Human Interface Device - Keyboard). So when you scan a barcode it just "types" the numbers. Your script attempts to decouple the typing. But when you change it to HID-POS, it converts the device into a serial COM device. You'd need to adjust your script to use something like pyserial. – Matt Winer May 18 '23 at 10:58

0 Answers0