@@ -247,6 +247,63 @@ ioctl_devinfo(PyObject *self, PyObject *args)
247247}
248248
249249
250+ static PyObject *
251+ ioctl_EVIOCGABS (PyObject * self , PyObject * args )
252+ {
253+ int fd , ev_code ;
254+ struct input_absinfo absinfo ;
255+ PyObject * py_absinfo = NULL ;
256+
257+ int ret = PyArg_ParseTuple (args , "ii" , & fd , & ev_code );
258+ if (!ret ) return NULL ;
259+
260+ memset (& absinfo , 0 , sizeof (absinfo ));
261+ ret = ioctl (fd , EVIOCGABS (ev_code ), & absinfo );
262+ if (ret == -1 ) {
263+ PyErr_SetFromErrno (PyExc_IOError );
264+ return NULL ;
265+ }
266+
267+ py_absinfo = Py_BuildValue ("(iiiiii)" ,
268+ absinfo .value ,
269+ absinfo .minimum ,
270+ absinfo .maximum ,
271+ absinfo .fuzz ,
272+ absinfo .flat ,
273+ absinfo .resolution );
274+ return py_absinfo ;
275+ }
276+
277+
278+ static PyObject *
279+ ioctl_EVIOCSABS (PyObject * self , PyObject * args )
280+ {
281+ int fd , ev_code ;
282+ struct input_absinfo absinfo ;
283+
284+ int ret = PyArg_ParseTuple (args ,
285+ "ii(iiiiii)" ,
286+ & fd ,
287+ & ev_code ,
288+ & absinfo .value ,
289+ & absinfo .minimum ,
290+ & absinfo .maximum ,
291+ & absinfo .fuzz ,
292+ & absinfo .flat ,
293+ & absinfo .resolution );
294+ if (!ret ) return NULL ;
295+
296+ ret = ioctl (fd , EVIOCSABS (ev_code ), & absinfo );
297+ if (ret == -1 ) {
298+ PyErr_SetFromErrno (PyExc_IOError );
299+ return NULL ;
300+ }
301+
302+ Py_INCREF (Py_None );
303+ return Py_None ;
304+ }
305+
306+
250307static PyObject *
251308ioctl_EVIOCGREP (PyObject * self , PyObject * args )
252309{
@@ -485,6 +542,8 @@ ioctl_EVIOCGPROP(PyObject *self, PyObject *args)
485542static PyMethodDef MethodTable [] = {
486543 { "ioctl_devinfo" , ioctl_devinfo , METH_VARARGS , "fetch input device info" },
487544 { "ioctl_capabilities" , ioctl_capabilities , METH_VARARGS , "fetch input device capabilities" },
545+ { "ioctl_EVIOCGABS" , ioctl_EVIOCGABS , METH_VARARGS , "get input device absinfo" },
546+ { "ioctl_EVIOCSABS" , ioctl_EVIOCSABS , METH_VARARGS , "set input device absinfo" },
488547 { "ioctl_EVIOCGREP" , ioctl_EVIOCGREP , METH_VARARGS },
489548 { "ioctl_EVIOCSREP" , ioctl_EVIOCSREP , METH_VARARGS },
490549 { "ioctl_EVIOCGVERSION" , ioctl_EVIOCGVERSION , METH_VARARGS },
0 commit comments