Skip to content
This repository was archived by the owner on Feb 27, 2025. It is now read-only.

Commit 9871fad

Browse files
Fix off-by-one in ioctl_EVIOCG_bits
This bug caused values at the end of the list to not be reported back. Example: On my system, SW_PEN_INSERTED (0x0f) is the last switch constant. That is, SW_MAX=SW_PEN_INSERTED. Other tools (python-libevdev) correctly reported this switch as 'set' but python-evdev did not. This commit fixes this issue.
1 parent 0cdf86a commit 9871fad

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

evdev/input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ ioctl_EVIOCG_bits(PyObject *self, PyObject *args)
413413
return NULL;
414414

415415
PyObject* res = PyList_New(0);
416-
for (int i=0; i<max; i++) {
416+
for (int i=0; i<=max; i++) {
417417
if (test_bit(bytes, i)) {
418418
PyList_Append(res, Py_BuildValue("i", i));
419419
}

0 commit comments

Comments
 (0)