Answer the question
In order to leave comments, you need to log in
How to catch and count mousemove events in bash in ubuntu?
I've been fighting for several hours, I can not understand what's what. I need to write a bash script on the ubuntu desktop that will be run by cron every minute, and send a post request to my script that the mouse was moved on the computer or the buttons on the keyboard were pressed.
And I got stuck at the very beginning. I can not normally catch these events. Ubuntu 14.04, installed input-events executing code
$ sudo /usr/bin/input-events 5
/dev/input/event5
bustype : BUS_PCI
vendor : 0x80ee
product : 0xcafe
version : 1027
name : "VirtualBox mouse integration"
bits ev : EV_SYN EV_KEY EV_ABS
waiting for events
22:01:12.603834: EV_ABS ABS_X 21648
22:01:12.603834: EV_ABS ABS_Y 39061
22:01:12.603834: EV_SYN code=0 value=0
22:01:12.611939: EV_ABS ABS_X 21580
22:01:12.611939: EV_SYN code=0 value=0
22:01:12.622667: EV_ABS ABS_X 21512
22:01:12.622667: EV_SYN code=0 value=0
22:01:12.627384: EV_ABS ABS_X 21478
22:01:12.627384: EV_SYN code=0 value=0
22:01:12.635220: EV_ABS ABS_X 21443
22:01:12.635220: EV_SYN code=0 value=0
22:01:12.647422: EV_ABS ABS_X 21375
22:01:12.647422: EV_SYN code=0 value=0
22:01:12.652264: EV_ABS ABS_X 21341
22:01:12.652264: EV_SYN code=0 value=0
22:01:12.659410: EV_ABS ABS_X 21307
22:01:12.659410: EV_SYN code=0 value=0
22:01:12.667808: EV_ABS ABS_Y 39006
22:01:12.667808: EV_SYN code=0 value=0
22:01:12.675614: EV_ABS ABS_X 21273
22:01:12.675614: EV_SYN code=0 value=0
22:01:12.700349: EV_ABS ABS_X 21239
22:01:12.700349: EV_SYN code=0 value=0
$ sudo timeout 10 "/usr/bin/inputvents" 5 | wc -l
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question