I’m hoping to connect two USB barcode scanners to a single computer, allowing two people to scan ticket barcodes simultaneously. If both people scan at the same time, however, the input from STDIN will get messy.
Is there a way to set up different STDIN streams, each tied to a specific USB port? The console script is in Ruby, though pointers in any language would be much appreciated.
Try connecting 2 USB barcode scanners first and test if what you are afraid of happens. I suspect all barcode digits are sent in a single burst while interrupts from other keyboard-like devices are on hold – so you won’t get two barcodes “interlaced” together.
It’s impossible to have more than one stdin, not literally. Other options will depend based on the OS you are on – on linux maybe the drivers provide you different character devices for different scanners. On Windows i believe you will have to learn talking the USB HID protocol… best if you don’t have to do any of that.