LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 07-01-2005, 02:06 AM   #1
floydigus
LQ Newbie
 
Registered: Apr 2005
Distribution: suse
Posts: 5

Rep: Reputation: 0
Question How to capture clicks from mouse to a file


Hi,

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.

Cheers!
 
Old 07-01-2005, 03:09 AM   #2
RandomLinuxNewb
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 101

Rep: Reputation: 15
I would imagine you could watch /dev/psaux for changes. Go grab an old ball mouse take the ball out and use
Code:
tail -f /dev/psaux
Then start clicking away and see if the screen is updated, also make sure that it doesn't get updated if the mouse is just sitting still. If it is being updated only with clicks then you would need to use
Code:
stat --format=%Y /dev/psaux
in a script that runs as a cron job every few seconds or what ever is needed.
 
Old 07-02-2005, 01:40 AM   #3
floydigus
LQ Newbie
 
Registered: Apr 2005
Distribution: suse
Posts: 5

Original Poster
Rep: Reputation: 0
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
random mouse clicks SuSE 9.3 MichaelLange Linux - Hardware 3 03-09-2006 05:10 PM
Mouse clicks link to alt-func? Doolspin Linux - Software 2 02-20-2005 11:22 AM
Simulated mouse clicks in linux? devilkin Programming 2 02-14-2005 07:59 AM
Middle mouse clicks stopped being recognized KETrel Linux - Hardware 1 10-04-2004 07:14 PM
Mouse pointer clicks a few centimeters to the left. jtolds Linux - General 2 11-25-2003 12:21 PM


All times are GMT -5. The time now is 07:29 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration