Redirect the barcode scanner entry to a specific widget in linux

advertisements

I have a Symbol LS2208 barcode scanner and works OK in my linux box (Kubuntu 8.10 Intrepid Ibex). Whenever you scan a barcode the scanner (connected to an USB port) sends the reading to wherever the text caret is. I would like to redirect all the readings from the scanner to an specific widget in my application (i.e. a text edit control). How can I do it? Though I use C++ with Qt GUI library sample code is welcome in any language or GUI library.


I don't know the answer, but here are some suggestions to find out what your options are:

  1. Install an event filter on QCoreApplication::instance() (or reimplement QCoreApplication::notify())
  2. In event filter handler, output each event looking for anything useful:

    void eventFilter(QObject *obj, QEvent *evt) {
        qDebug() << obj << evt;
    }
    
    
  3. Examine the debug output to determine which events are triggered by the scanner.

qDebug() understands virtually every type and should give you reasonable output that will allow you to tell whether the it's coming in as keyboard events or something else.