Sponsored Content
Top Forums Shell Programming and Scripting Sending key events to background script Post 302498175 by Snowman on Sunday 20th of February 2011 06:13:03 AM
Old 02-20-2011
Sending key events to background script

Hi,

short summary:
I need to send keystrokes from USB keyboard to background (bash-)script. I guess I have to use read on the right devive board but how and which?

My details:

I got a small home server with some VMs using KVM/Qemu, all are suse 11.3. But in general I work on a client using a keyboard switch. Additionally, I have a scanner (HP Officejet 6500).

Now I want to send scans into a VM. I did not get the scan button to work but I want to achieve a similar solution. I bought a numerical keyboard with USB connector, connected it to the server and fowarded the port into the target VM.
Next there should be a background process listening to that kayboard and running a variety of scanimage scripts when the numbers are pressed.

I found the keyboard device under /dev/input/by-id/... and probably also under /dev/bus/usb/001/00[1-4]. Unfortunately, the output looks very "raw". I guess there must be an other device to connect to?

Thank you for your help,
Snowman
 

8 More Discussions You Might Find Interesting

1. Programming

Sending INtr key for remote terminal

Hi folks, Just wondering if anyone knows how to send intr/break key to remote tty (shell), a simple example would be great! thx (2 Replies)
Discussion started by: andryk
2 Replies

2. UNIX for Dummies Questions & Answers

Creating keymaps/key events

Hi all, Total newbie here so sorry for any offence caused... Anyway totally a windows slave, only ever used that, closest i got to programming was in DOS and HTML, yeah i know doesn't compare but just setting up the background. Have installed Cygwin and have learned a bit about Unix and... (0 Replies)
Discussion started by: newbiex25
0 Replies

3. Shell Programming and Scripting

How to include RETURN KEY with Background process "&" in Shell Script

Hello All, I am a newbie in Shell script programming, and maybe you can help me with my query. I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script. The mntServer.ksh script contains: #!/bin/ksh... (1 Reply)
Discussion started by: racbern
1 Replies

4. Programming

capture key board events using C program

hi This is mahesh please can any one post source of 'c'. to capture key board events. thank u (1 Reply)
Discussion started by: smahesh2007
1 Replies

5. Shell Programming and Scripting

sending email as background process

Hi All, Solaris Bash v3x I have a script that accepts an error code, and if the error code is not 0 then an email is sent using mailx to details the error. I want to be able to implement the functiuonlity whereby i can send the email in a background process so the script can continue with... (3 Replies)
Discussion started by: satnamx
3 Replies

6. Shell Programming and Scripting

Sending Key Presses

Hi. Im wondering if there is a way to output key presses using a script? Something like this: key=down key=down key=up So say if it was sent to Firefox it would make the window scroll down twice then up once. (1 Reply)
Discussion started by: Grizzly
1 Replies

7. Programming

Simulating background X11 events

Hi everybody! I've following this forum for a while but now it is my turn to do a question since a did not find the answer anywhere (I've been searching for days and there is no way). I am working on a client-server platform where the server renders 3D models and sends images to the client... (3 Replies)
Discussion started by: benderz
3 Replies

8. Shell Programming and Scripting

Need help regarding sending sleep to background

Hi, can we print anything, when sleep is running..? like printing dots(.. . . . . . . . .) to indicate that some process is going on...? i mean, can we send sleep to background, proceed with printing, till sleep is going on... in s single step. I have written a funtion to solve this. ... (1 Reply)
Discussion started by: Dpu
1 Replies
RATMENU(1)						      General Commands Manual							RATMENU(1)

NAME
ratmenu - create a menu to run commands SYNOPSIS
ratmenu [ -display displayname ] [ -font fname ] [ -fg foreground-color ] [ -bg background-color ] [ -io item-offset ] [ -label name ] [ -shell prog ] [ -align {left|center|right} ] [ -style {snazzy|dreary} ] [ -persist ] [ -version ] [ menuitem command ] ... DESCRIPTION
ratmenu is a simple program that accepts a list of menu item and command pairs on the command line. It creates a window that consists of nothing but a menu. When a particular item is selected, the corresponding command is executed. ratmenu does not recognize any usage of the rodent. It is entirely keystroke operated. Menu items must be followed by a command. The syntax is based on that of the dialog program. ratmenu accepts the following command line options. -display displayname Use the X display displayname, instead of the default display. -font fname (X Resource: font) Use the font fname, instead of the default font. -label name Change both the window and icon labels of the window to name. The default label is the last component of the path used to run ratmenu, typically, ratmenu. -fg foreground-color (X Resource: fgcolor) Set the foreground color to foreground-color. By default, the foreground color is black. -bg background-color (X Resource: bgcolor) Set the background color to background-color. By default, the background color is white. -io item-offset Set the first selected item to item-offset. By default, the first item is the top-most one, or item-offset 1. The next item down would be at item-offset 2. -style {snazzy|dreary} (X Resource: style) The default style is snazzy, where the highlight bar, which shows the currently selected item, remains stationary while all the menu items are rotated up or down when the cursor keys are moved. In dreary mode, the highlight bar moves up and down the menu as it does on all conventional keyboard controlled menus. -align {left|center|right} (X Resource: align) Align the text of the menu entries to the left, right, or center. Defaults to left. This is different from 9menu, which defaults to center. -shell prog Use prog as the shell to run commands, instead of /bin/sh. A popular alternative shell is rc(1). If the shell cannot be executed, ratmenu will silently fall back to using /bin/sh. -back prevmenu prevmenu is a command or shell script to run when the back key is pressed, usually a script that has ratmenu showing the pre- vious menu. Used to create nested menus, it gives the user a way to back out and return to the previous menu. Note that you can use this option for other things too. The command specified by the -back option is executed when the user hits one of the "back" keys. -persist (X Resource: persist) Ordinarily, ratmenu exits if a new window pops up on top of it, or if you switch to another window. This option tells ratmenu to hang around, like a regular window. -version This option prints the version of ratmenu on the standard output, and then exits with an exit value of zero. KEYSTROKES
The Up keystrokes move the selection to the next item up. The Down keystrokes move the selection to the next item down. When the selec- tion reaches the top or bottom, it scrolls around to the other side on pressing of the appropriate keystroke. The Select keystrokes execute the command corresponding to the currently selected menu item, and exit ratmenu. The Exit keystrokes quit ratmenu without doing anything. Up 'k', Up_arrow, BackSpace, '-', C-p Down 'j', Down_arrow, Space, Tab, '+', C-n, C-i Select 'l', Right_arrow, Return, C-f, C-m, C-j Back 'h', Left_arrow, C-b Exit 'q', Escape, C-g CONFIGURATION USING X RESOURCES
You can configure some items using xrdb to load appropriate X resources. There is an example configuration in the file /usr/share/doc/rat- menu/Xresources.ratmenu which shows all possible configuration items. Give it a look; it is fairly easy to figure out. EXAMPLES
ratmenu -label "Remotes xterm" acme "rsh acme xterm" herman "rsh herman 9term" & ratmenu -label 'X progs' ghostview ghostview xdvi xdvi xeyes xeyes xneko xneko & ratmenu -back ~/bin/mypreviousmenu "X Eyes" xeyes & SEE ALSO
ratpoison(1), ratpoisonrc(5), dialog(1) xrdb(1) Ratpoison Desktop Users Manual. AUTHORS
The initial idea for this program was by Arnold Robbins, after having worked with John Mackin's GWM Blit emulation. Matty Farrow wrote a version using libXg, from which some ideas were borrowed. This code was written by David Hogan and Arnold Robbins. Rich Salz motivated the -shell option. Jonathan Walther modified this code to play nicely with the ratpoison window manager by removing handling of mouse events and iconification. Zrajm C Akfohg made many improvements in his ratmen fork, including X resource handling, some of which were folded back in. Ratpoison Desktop For X Oct 10 2001 RATMENU(1)
All times are GMT -4. The time now is 03:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy