pweichel
08-11-2005, 11:37 PM
Hi all,
I have written a user space program which traps keyboard input from
several input sources using select() function on the /dev/input/eventX
files.
It works nicely, but how can i detect from that same program if user
decides to pull-out a USB connected keyboard or insert another in the
USB port of the embedded Linux system ?
B.Rgds.
Peter
Denmark
Marco Cavallini
09-11-2005, 02:47 AM
> I have written a user space program which traps keyboard input from
> several input sources using select() function on the /dev/input/eventX
> files.
>
> It works nicely, but how can i detect from that same program if user
> decides to pull-out a USB connected keyboard or insert another in the
> USB port of the embedded Linux system ?
Take a look at libusb
--
Marco Cavallini
================================================== ===
Koan s.a.s. - Software Engineering
Linux and WinCE solutions for Embedded and Real-Time Software
Klinux : the embedded distribution for industrial applications
- Atmel AT91 ARM Third Party Consultant
- Intel PCA Developer Network Member
- Microsoft Windows Embedded Partner
Via Pascoli, 3 - 24121 Bergamo - ITALIA
Tel. +39-(0)35-255.235 - Fax +39-178-223.9748
http://www.koansoftware.com - http://www.klinux.org
================================================== ===
Sven Geggus
09-11-2005, 06:00 AM
pweichel <runtime@mail.dk> wrote:
> It works nicely, but how can i detect from that same program if user
> decides to pull-out a USB connected keyboard or insert another in the
> USB port of the embedded Linux system ?
The kernel is running the /sbin/hotplug executable in such a case. Do
whatever yo need to do in this executabole which could be any kind of
executable (bash-script,ELF-binary, etc.). You could simply send a signal
from /sbin/hotplug to your Process which causes it to reopen devices e.g.
Sven
--
"If you continue running Windows, your system may become unstable."
(Windows 95 BSOD)
/me is giggls@ircnet, http://sven.gegg.us/ on the Web
pweichel
11-11-2005, 12:39 AM
Hi Sven,
Thank you for your input.
The /sbin/hotplug is not default installed on my ARM board running
embedded Linux version 2.6.13.2. Is it a shell program or a binary
executable ?
Can it be cross compiled if binary ?
How can it "signal" my process ?
Can it for example send a message or is it by calling another binary
program ?
Does hotplug tell mee which device i.e. keyboard, barcode scanner or
other USB device has been changed ?
Peter
Captain Dondo
11-11-2005, 02:49 AM
On Thu, 10 Nov 2005 03:39:42 -0800, pweichel wrote:
> Hi Sven,
>
> Thank you for your input.
>
> The /sbin/hotplug is not default installed on my ARM board running
> embedded Linux version 2.6.13.2. Is it a shell program or a binary
> executable ?
> Can it be cross compiled if binary ?
>
> How can it "signal" my process ?
> Can it for example send a message or is it by calling another binary
> program ?
> Does hotplug tell mee which device i.e. keyboard, barcode scanner or
> other USB device has been changed ?
Ummm... Google for hotplug - 1st hit.
http://linux-hotplug.sourceforge.net/
Sven Geggus
14-11-2005, 12:01 AM
pweichel <runtime@mail.dk> wrote:
> The /sbin/hotplug is not default installed on my ARM board running
> embedded Linux version 2.6.13.2. Is it a shell program or a binary
> executable ?
Whatever you wand it to be. The Standard Linux hotplug script is written in
bash and is somewhat slow for this reason. Have a look at
http://linux-hotplug.sourceforge.net/ for details.
I use a very small script in one of my applications for detecting USB events
instead of the Standard script.
> How can it "signal" my process ?
Using kill from whithin a shell-script or corresponding system-call from C.
Sven
--
Der "normale Bürger" ist nicht an der TU Dresden und schreibt auch
nicht mit mutt. (Ulli Kuhnle in de.comp.os.unix.discussion)
/me is giggls@ircnet, http://sven.gegg.us/ on the Web