Linux wedge (driver) for Microvision Flic barcode scanner

I have a couple of Flic barcode scanners that have been collecting dust on the shelf for a couple of years. Last time I used these I was using Windows XP as my primary operating system. Just the other day I installed Tellico and decided to catalogue my huge collection of books. A barcode scanner sure would make my life easier. So now I needed a Linux driver for these fine devices. It took me about 6 hours to conclude that the only software wedge available for the Flic on Linux is closed source payware and only supports tethered connections not BlueTooth. As a nostalgic guy who dreams of the “good old days, when men where men and wrote their own drivers” I thought; “hey, it’s only serial communication, how hard can it be?”. So I sat down and wrote my own software wedge for the Flic barcode scanner in Perl. It took me all of one night. And now I’m sharing it with you:

NOTICE: Update: Version 1.1 is now out. This version fixes a race condition that could cause the linebreak to be inserted before or somewhere in the barcode itself. Download is available below.

Installation instructions

These instructions are for Debian based operating systems (like Ubuntu), but the procedure should be quite similar on any Linux system.

Before using this software you should reset your barcode scanner to factory defaults by scanning the barcode in the user manual. Some of the non-default settings available on the scanner are (not yet?) supported by this software.

  • Download the latest source
  • open a terminal
  • unpack the downloaded file to any directory you like
  • Make sure the two Perl programs are runnable
  • Install the required Perl modules and applications
  • Go ahead and add a global shortcut for the pop application. If you don’t know how to do this follow the example in my global keyboard shortcut guide, but add a shortcut to /path/to/pop instead of /usr/bin/emacs

Tethered use

This has been tested with the serial cable that comes with the Flic and also the serial cable connected via a R232-USB adapter, but any cable from Microvision should work.

  • First find out which port the scanner is connected to for example /dev/ttyUSB0. I will use /dev/ttyUSB0 in all of the examples from now on. Just switch out /dev/ttyUSB0 with whatever port your scanner is connected to.
  • Open a terminal
  • Start the application
  • Start scanning barcodes. Every time you scan a code you should see the text
  • in the terminal where xxxxxxxxx is the barcode you scanned.
  • You can also disconnect the barcode scanner from the cable, go away and scan a whole bunch of barcodes, come back and reconnect the scanner. All of the scanned codes should be pushed automatically and the scanner gives you a little blipblipblip to let you know that it’s memory is empty.
  • Now open a text document in your editor of choice and hit the global shortcut key you previously added. The first barcode you scanned should now be inserted.
  • The terminal should now show the text
  • This can be repeated as many times as you needed.
  • Pushing and poping can be done in any order, at any time.

–noserver

If you add the –noserver switch when starting the application the application will automatically pop barcodes as soon as you scan them.

–linefeed

If you add the –linefeed switch when starting the application the software will simulate pressing enter after a barcode is poped. –linefeed works both in –noserver and regular mode.

BlueTooth use

  • Open a terminal.
  • Click the scan button on the barcode reader to make sure it’s in discoverable mode.
  • Enter the command hcitool scan
  • The result should be a list somewhat like this:
  • Now copy the MAC address (list of numbers with colons) next to the name of you barcode scanner.
  • Enter the command hcitool cc 00:A0:96:0B:21:78 (exchanging the MAC address for the one you found previously).
  • The bluetooth icon on your menubar should start blinking and a popup should show asking you to enter a pincode. (My computer sometimes doesn’t show the popup. If this happens to you just doubleclick on the blinking BlueTooth icon and you will be requested the pincode).
  • Enter the pincode 0000 (The standard pincode for Microvision barcode readers).
  • Go into BlueTooth preferences (right click on the BlueTooth icon) and tag the barcode reader as Trusted.
  • Open /etc/bluetooth/rfcomm.conf as root in your editor of choice
  • Add the following entry to the file (using the MAC address you previously copied):
  • If you already have an entry for rfcomm0 just replace 0 with a higher number.
  • Run the command sudo /etc/init.d/bluetooth restart

You can now use the software in exactly the same manner as described under tethered use. Just replace /dev/ttyUSB0 with /dev/rfcomm0. Make sure always to put the scanner in discoverable mode (by clicking the scan button) before starting the software.

Automatic bluetooth reconnect

I just received the following script that should enable automatic bluetooth reconnect (I have not tested the script) from Ravikiran Vishnuvajhala:

 

Enjoy!

I’m happy to receive feedback, tips or questions.

Leave a Reply