1

I would like to read the touchpad input from /dev/input/eventX. Although many questions ( Get mouse deltas using Python! (in Linux) ) answer how to do so, they do not quite answer how to convert the data obtained into integer form.

It is not obvious to me how to convert them. And also how does one write into a eventX file. Please help me!

Python code that I am currently using :

file = open("/dev/input/event1","rb")
while 1:
  buf = file.read(16)
  print buf

EDIT: I am aware of tools like xdotool that do this, but I really need it in the code form.

2
  • @stovfl done... Commented Apr 16, 2017 at 15:21
  • Your linked Question, Answer explain this well. It's a 3 Byte value, buf[0] = button, buf[1:3] = x, y. Commented Apr 16, 2017 at 18:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.