How to find mouse/keybd /dev files?

How to find mouse/keybd /dev files?

Post by Rick Walk » Tue, 21 Nov 1995 04:00:00


I'm porting a typing/mousing monitor to Linux.  (This is a little Tcl/Tk
script that pops up a window after a certain amount of typing/mousing
activity to remind you to take a break).  This program has been widely
used at HP for the last 3 years, and I thought it would be nice to
release it to the Linux community.

Currently, I look at the access time of the mouse and keyboard /dev files
to monitor the amount of activity.  Everytime the mouse, etc. is moved,
the /dev file is "touched" by X11.

On HP-UX, it is easy to find out which device files are used: start
looking at /dev/hil7 and scan down to /dev/hil0.  The first file that is
"busy" is the mouse, and the second "busy" file is usually the keyboard.

Is their a similiar trick that can be used for Linux?  

Even better...  Is their a way to query X11 for the current mouse and
keyboard dev files?  (This would make the script platform independant).

Any other tricks that might work?

Rick Walker

BTW, this is a non-commercial program developed simply to help out those
people suffering from repetitive stress injury.  It will soon be
posted/uploaded to the appropriate Linux archives.


1. How does X11 find keybd/mouse devs?

I would like to know how X11 figures out which dev files to use
for console (keyboard) and mouse.  I assume that it inheirits this
info from the original console login process?  (Or is this info in
some global config file?)

I have a typing monitor program that I wish to port to X11.  

I've looked at xautolock and the technique used there is a mess:
(traverse the entire widget hierarchy, put in a callback for every key
stroke event, run a sleep loop to make sure and recognize new windows as
they are created...)

All I need is to poll the access times from the keyboard and mouse devs,
so is their anyway to "sneak around" X11 and figure out what the /dev
files are?

(In a reasonably portable way :-)).


2. Quality PC Software [telnet negotiation]

3. help w/ /dev/mouse (/dev/psaux) in X and "cannot find gpm"

4. Windoze NT emulator

5. switch box for monitor/keybd/mouse 4 multi-systems

6. Ximian Gnome & Redhat 7.2

7. PS/2 Keybd mouse

8. Pipes don't work in crontab

9. how to find the file corresponding to the file descriptor in the /dev/fd

10. PS/2 mouse and keybd conflict ...

11. Good keybd, mouse, monitor switch

12. USB Keybd+mouse chaining?

13. How can i find out which port in /dev my mouse is connected to?