gvalkov/python-evdev — pull request #29 by spasche (2014-07-05 20:23:22+00:00)
Title: API to access active keys

Hello,

I recently had the need to know if keys were active when my application starts. The Linux input API exposes a EVIOCGKEY ioctl to retrieve active keys. This pull request exposes that API.

By the way, I fixed a potential buffer overflow in the ioctl_capabilities function. If EV_MAX is 9 for instance, two bytes are needed to store all the bits, but 9 / 8 would return 1. That might be the cause of the "const int _fd = fd;" workaround (the ioctl overflows the bits buffer and writes to another stack variable). I tried removing that workaround, but I couldn't reproduce the issue before or after my change.

Sylvain