@@ -33,17 +33,6 @@ int test_bit(const char* bitmask, int bit) {
3333}
3434
3535
36- // Useful for comparing input events as seen in the extension module
37- // and as seen in python
38- // static void
39- // print_event(struct input_event *ev) {
40- // fprintf(stderr, "[so] event: time %ld.%06ld, code %02d, type %02d, val %02d\n",
41- // ev->time.tv_sec, ev->time.tv_usec,
42- // ev->code, ev->type, ev->value
43- // );
44- // }
45-
46-
4736// Read input event from a device and return a tuple that mimics input_event
4837static PyObject *
4938device_read (PyObject * self , PyObject * args )
@@ -354,6 +343,18 @@ get_sw_led_snd(PyObject *self, PyObject *args)
354343}
355344
356345
346+ static PyObject *
347+ ioctl_EVIOCGEFFECTS (PyObject * self , PyObject * args )
348+ {
349+ int fd , ret , res ;
350+ ret = PyArg_ParseTuple (args , "i" , & fd );
351+ if (!ret ) return NULL ;
352+
353+ ret = ioctl (fd , EVIOCGEFFECTS , & res );
354+ return Py_BuildValue ("i" , res );
355+ }
356+
357+
357358static PyMethodDef MethodTable [] = {
358359 { "unpack" , event_unpack , METH_VARARGS , "unpack a single input event" },
359360 { "ioctl_devinfo" , ioctl_devinfo , METH_VARARGS , "fetch input device info" },
@@ -362,6 +363,7 @@ static PyMethodDef MethodTable[] = {
362363 { "ioctl_EVIOCSREP" , ioctl_EVIOCSREP , METH_VARARGS },
363364 { "ioctl_EVIOCGVERSION" , ioctl_EVIOCGVERSION , METH_VARARGS },
364365 { "ioctl_EVIOCGRAB" , ioctl_EVIOCGRAB , METH_VARARGS },
366+ { "ioctl_EVIOCGEFFECTS" , ioctl_EVIOCGEFFECTS , METH_VARARGS , "fetch the number of effects the device can keep in its memory." },
365367 { "get_sw_led_snd" , get_sw_led_snd , METH_VARARGS },
366368 { "device_read" , device_read , METH_VARARGS , "read an input event from a device" },
367369 { "device_read_many" , device_read_many , METH_VARARGS , "read all available input events from a device" },
0 commit comments