How to capture clicks from mouse to a file
I'm planning a project to hack a mouse to monitor the CO2 being generated by my homebrew beer, and I could use some suggestions about how to capture the input from the mouse.
What I'm planning is something like the weather flaps you see on the vertical exhaust pipes on tractors. This will be placed over the airlock on a fermenter and close a circuit when the flap goes up. That circuit would be one of the mouse button circuits.
All I need is to log a date and time to a file when that 'button' is 'clicked'. Is there a way I can do that from a bash script - perhaps using /dev/psaux?
I'm using Suse, a ps2 mouse and the serial and paralell ports are occupied with other (beer related) devices.
I would imagine you could watch /dev/psaux for changes. Go grab an old ball mouse take the ball out and use
Can read /dev/psaux, just can't make sense of it
Thanks for the pointer, RLN, you inspired me to plug the mouse in and have play.
Tail doesn't work on /dev/psaux at all - it just sits there until I ctrl-c.
Cat /dev/psaux does, however, show some stuff.
Moving the ball shows this kind of thing:
Clicking the buttons also has an effect but these seem to be getting interpreted as control characters as they just move the cursor around the terminal window. Left click moves the cursor one space right on button down and then one space back again on button up. Right click moves the cursor to a new line on button down and then to the right of the previous line on button up. Perhaps this is binary data - do I just need to read it differently?
|All times are GMT -5. The time now is 10:24 AM.|