I recently purchased a USB-based barcode scanner with the intention of using it with Delicious Library to do a home inventory (their Bluetooth scanner is just to pricey for me). Unfortunately, the scanner model I purchased - a Datalogic QuickScan QD2130 - has problems acting as a keyboard with OS X. It works fine under Windows, but when connected to my Mac, it sits in a disabled mode and won’t scan any barcodes. Leafing through the manual, I noticed that it will also act as an RS-232 device over USB, and that gave me an idea… Use the scanner as a serial device, and add items to Delicious Library via AppleScript!
OS X doesn’t have drivers for USB/RS-232 bridges out of the box, but there are plenty of generic drivers out there. Following this example, I used the 2303 driver from Prolific. To get the driver to work with the barcode scanner, it’s necessary to jump through a few hoops (specific to my model scanner, but others are most likely similar):
- Before installing the driver, connect the scanner to an available USB port, so we can configure it as a simulated RS-232 device.
- Since the OS has disabled the scanner, press and hold the trigger for about 5 seconds, until it beeps.
- Scan the programming barcode to place the scanner in “USB-COM-STD” mode. The scanner will then reinitialize in that mode.
- Open System Profiler, and select USB from the Contents list. In the device tree, find the barcode scanner and select it.
- Make a note of the values listed for Product ID and Vendor ID (in my case, they were 0x4204 and 0x05f9, respectively).
- Edit the Info.plist file for the driver as detailed in the example; note that the IDs displayed by System Profiler are hexadecimal, and the plist requires decimal values, so you’ll have to convert them (mine worked out to be 16900 and 1529).
The scanner should now be recognized as a serial device. To test this, I opened Terminal and ran
screen /dev/tty.usbmodem3d11 (your device name may be different). I then scanned a barcode and watched the results appear in Terminal. Magic! With that part working, I installed Art Coughlin’s SerialPort X Scripting Addition, and put together an AppleScript to read data from the scanner’s serial port and send it to Delicious Library. If you’ve gone through the same steps, you can download Delicious Barcode scanner and run it for yourself. It will prompt you to select the relevant serial port, and will stay running until you quit Delicious Library.
Hopefully, someone will find this helpful. Feel free to ask any questions in the comments.
UPDATE Delicous Barcode Scanner is now extra delicious.