Hi,

As other people with the same problem may find this bug report, I will just write down the workaround I found, sufficient for my usage and somehow based on http://ubuntuforums.org/showthread.php?t=2263143.

Adapt the following script to match the output of the barcode scanner and what you want to be displayed:

#!/bin/bash

# infinite loop
while true; do
  # read input number by number
  while read -n1 char; do
    if [ "$char" = "0" ]; then
      # we print keycode 19, which means "0"
      xdotool key 19
      lineReturnDone="false"
    elif [ "$char" != "" ]; then
      # we print the number using his keycode
      xdotool key "$(( char + 9 ))"
      lineReturnDone="false"
    else
      # we print one line return
      if [ "$lineReturnDone" != "true" ]; then
        xdotool key "36"
        lineReturnDone="true"
      fi
    fi
  done < /dev/ttyS0
done

Here, note the workaround for the "line return" (if I understood well, my barcode scanner sends two ASCII "NUL" character after the numbers, but I want a line return instead). Note also that it will only write output to X server, not to TTY.

Finally, start this script when X session starts.

Best regards,
Yvan

Reply via email to