2

I'm trying to build a headless system using a Raspberry Pi; I have two programs runnning on it, one to catch all the input from a barcode reader (a simple keyboard emulation device) and one to display some graphics on a hdmi lcd screen using just the framebuffer (no X or DM envolved). The reader program reads the input from the stdin; it is basically a scanf cycle that reads chars and doesn't print anything. The barcorde reader prints there its chars and the reader program reads them until the "\n" char. The display program embeds an http server that wait some request and paint the graphics on the framebuffer. I run my two programs in two different screen sessions using:

screen -DmS reader ./reader_server &
S1=$!
screen -DmS graphics ./graphics_server &
S2=$!
wait $S1 $S2

I use two different screen sessions in the hope that the reading printed by the barcode reader and readed by the reader program doesn't interfere with the display session. Everything works fine, both programs start on boot, the reader program awaits in its own session and the graphics program draw its stuff over the local tty... The problem is that when I try to read some barcode the input is printed on the local tty, breaking my graphics and popping-up console pieces throught of it! My question is: is there a way to send/redirect every keyboard input to my screen session where my reader program wait for it?

  • I'm not sure I correctly understood your problem. Please edit your question and add more details what the programs reader_server and graphics_server do. Why do you need two screen sessions? If reader_server writes the data to stdout and graphics_server displays the data from stdin you could do something like reader_server | graphics_server in a script and run this script in the background (or in a screen session if you need this). – Bodo May 17 at 13:46
  • 1
    if you do not what the barcode typed on an emulated keyboard, then why do you use a keyboard emulator in the first place? Sounds strange ... There is a pretty neat system for dealing with inputs from multiple devices and writing to different visible and invisible outputs and organizing the whole stuff into neatly isolated sessions. It's called X. Maybe you want to give it a try. – Bananguin May 17 at 14:16
  • @Bodo edited as you asked. – bymere May 17 at 14:42
  • Can the barcode reader work in a different mode? (other than keyboard emulation) – Bodo May 17 at 14:49
  • No... only in keyboard emulation mode! – bymere May 17 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.