LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Detecting the keyboard and mouse (https://www.linuxquestions.org/questions/linux-hardware-18/detecting-the-keyboard-and-mouse-685325/)

sameer.nalawade 11-22-2008 01:33 AM

Detecting the keyboard and mouse
 
Hello guys,
i am writing a c program to detect the keyboard and mouse. In fact i am doing it right now by reading the file /proc/bus/input/devices. Program is working with few exceptions.
First problem is if you remove ps2 mouse or keyboard there is no change in /proc/bus/input/devices so it is still showing mouse and keyboard is connected when it is not. It works fine with USB Keyboard and mouse though.(it works ps2 but needs system reboot only then /proc/bus/input/devices file reflects changes.)
Second i am looking for the string "mouse" and "keyboard" in this file(obviously bad idea:tisk:). For some keyboards and mice there is no string "mouse" and "keyboard" in the entry NAME:<name of device> .
so i am looking for some way i can do it without using string comparison and which works for ps2.
i am using 2.6.21-1.3194.fc7.


All times are GMT -5. The time now is 01:27 PM.