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). 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.