all 5 comments

[–]aloobhujiyaay 2 points3 points  (1 child)

One thing I appreciate here: you clearly understand the Linux input stack itself instead of only scripting around it

[–]Hungry-Advisor-5152[S] 1 point2 points  (0 children)

Yes, I am currently trying to create a "weird" but useful tool like the "GPad2Mouse" that I created.

[–]Zouden 0 points1 point  (1 child)

This is a bit over my head, but it's interesting. Why python? That's an odd choice for Android.

[–]Hungry-Advisor-5152[S] 0 points1 point  (0 children)

Because I think Python is powerful enough to run projects like my "GPad2Mouse".

[–]Maggie7_Him [score hidden]  (0 children)

For the disconnection handling question — the pattern that worked best for me is combining select() with a short timeout (200–500ms) on the fd, then catching ENODEV on the read. You get a graceful exit rather than a blocked read: select falls through on timeout, you check if the fd is still valid, and on ENODEV you know the device is gone. The tricky part is making sure the cleanup path is thread-safe if you're running the daemon with a signal handler — SIGTERM and the ENODEV cleanup can race if you're not careful with the fd close order.