Home > other >  Under Linux system, to monitor the mouse problem
Under Linux system, to monitor the mouse problem

Time:11-19

 
With the open ('/dev/input/event5 ', 'rb') as f:
While True:
Data=https://bbs.csdn.net/topics/f.read (24)
Time_sec time_usec, type_, code, value=https://bbs.csdn.net/topics/struct.unpack (" QQHHi ", data)
If code 272 and value===1: https://bbs.csdn.net/topics/=
Print (" {} {} \ ttype={} \ tcode={} \ tvalue=https://bbs.csdn.net/topics/{} ". The format (time_sec, time_usec type_, code, value))


This code can monitor the left mouse button click event, but there is a problem, it did not run directly in the IDE, the need to use command line in the outside, such as sudo python3 XXX. P y this way, on the Internet to check the along while didn't find a solution, for the great god

CodePudding user response:

In addition, the feedback information, how to convert the xy coordinates, consult:
1605674116.178547 type=1 code=272 value=https://bbs.csdn.net/topics/1
1605674118.74571 type=1 code=272 value=https://bbs.csdn.net/topics/1
1605674118.970539 type=1 code=272 value=https://bbs.csdn.net/topics/1
1605674119.402534 type=1 code=272 value=https://bbs.csdn.net/topics/1
  • Related