Hello community, here is the log from the commit of package python-evdev for openSUSE:Factory checked in at 2019-05-14 13:43:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-evdev (Old) and /work/SRC/openSUSE:Factory/.python-evdev.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-evdev" Tue May 14 13:43:47 2019 rev:5 rq:702767 version:1.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-evdev/python-evdev.changes 2019-03-01 16:50:05.909738567 +0100 +++ /work/SRC/openSUSE:Factory/.python-evdev.new.5148/python-evdev.changes 2019-05-14 13:43:48.636696303 +0200 @@ -1,0 +2,7 @@ +Tue May 14 07:09:23 UTC 2019 - Ondřej Súkup <mimi...@gmail.com> + +- update to 1.2.0 + * Add UInput support for the resolution parameter in AbsInfo + * Vendor and product identifiers can be greater or equal to 0x8000 + +------------------------------------------------------------------- Old: ---- v1.1.2.tar.gz New: ---- v1.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-evdev.spec ++++++ --- /var/tmp/diff_new_pack.iLFOdi/_old 2019-05-14 13:43:50.164699535 +0200 +++ /var/tmp/diff_new_pack.iLFOdi/_new 2019-05-14 13:43:50.168699544 +0200 @@ -19,7 +19,7 @@ %define modname evdev %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-evdev -Version: 1.1.2 +Version: 1.2.0 Release: 0 Summary: Python bindings to the Linux input handling subsystem License: BSD-3-Clause ++++++ v1.1.2.tar.gz -> v1.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.1.2/docs/changelog.rst new/python-evdev-1.2.0/docs/changelog.rst --- old/python-evdev-1.1.2/docs/changelog.rst 2018-09-01 19:45:42.000000000 +0200 +++ new/python-evdev-1.2.0/docs/changelog.rst 2019-04-07 17:40:25.000000000 +0200 @@ -1,6 +1,17 @@ Changelog --------- +1.2.0 (Apr 7, 2019) +==================== + +- Add UInput support for the resolution parameter in AbsInfo. This brings + support for the new method of uinput device setup, which was `introduced in + Linux 4.5`_ (thanks to `@LinusCDE`_). + +- Vendor and product identifiers can be greater or equal to `0x8000` (thanks + `@ivaradi`_). + + 1.1.2 (Sep 1, 2018) ==================== @@ -12,7 +23,7 @@ 1.1.0 (Aug 27, 2018) ==================== -- Add support for handling force-feedback effect uploads (many thanks to `@ndreys`). +- Add support for handling force-feedback effect uploads (many thanks to `@ndreys`_). - Fix typo preventing ff effects that need left coefficients from working. @@ -352,7 +363,10 @@ .. _`@forsenonlhaimaisentito`: https://github.com/forsenonlhaimaisentito .. _`@paulo-raca`: https://github.com/paulo-raca .. _`@ndreys`: https://github.com/ndreys +.. _`@LinusCDE`: https://github.com/gvalkov/python-evdev/pulls/LinusCDE +.. _`ivaradi`: https://github.com/gvalkov/python-evdev/pull/104 +.. _`introduced in Linux 4.5`: https://github.com/torvalds/linux/commit/052876f8e5aec887d22c4d06e54aa5531ffcec75 .. _issue21121: http://bugs.python.org/issue21121 .. _`#63`: https://github.com/gvalkov/python-evdev/issues/63 .. _`#63`: https://github.com/gvalkov/python-evdev/issues/67 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.1.2/docs/conf.py new/python-evdev-1.2.0/docs/conf.py --- old/python-evdev-1.1.2/docs/conf.py 2018-09-01 19:45:42.000000000 +0200 +++ new/python-evdev-1.2.0/docs/conf.py 2019-04-07 17:40:25.000000000 +0200 @@ -60,7 +60,7 @@ # built documents. # # The full version, including alpha/beta/rc tags. -release = '1.1.2' +release = '1.2.0' # The short X.Y version. version = release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.1.2/evdev/input.c new/python-evdev-1.2.0/evdev/input.c --- old/python-evdev-1.1.2/evdev/input.c 2018-09-01 19:45:42.000000000 +0200 +++ new/python-evdev-1.2.0/evdev/input.c 2019-04-07 17:40:25.000000000 +0200 @@ -250,7 +250,10 @@ ret = PyArg_ParseTuple(args, "i", &fd); if (!ret) return NULL; - ioctl(fd, EVIOCGREP, &rep); + ret = ioctl(fd, EVIOCGREP, &rep); + if (ret == -1) + return NULL; + return Py_BuildValue("(ii)", rep[0], rep[1]); } @@ -265,6 +268,9 @@ if (!ret) return NULL; ret = ioctl(fd, EVIOCSREP, &rep); + if (ret == -1) + return NULL; + return Py_BuildValue("i", ret); } @@ -277,6 +283,9 @@ if (!ret) return NULL; ret = ioctl(fd, EVIOCGVERSION, &res); + if (ret == -1) + return NULL; + return Py_BuildValue("i", res); } @@ -338,6 +347,9 @@ break; } + if (ret == -1) + return NULL; + PyObject* res = PyList_New(0); for (int i=0; i<max; i++) { if (test_bit(bytes, i)) { @@ -357,6 +369,9 @@ if (!ret) return NULL; ret = ioctl(fd, EVIOCGEFFECTS, &res); + if (ret == -1) + return NULL; + return Py_BuildValue("i", res); } @@ -381,7 +396,7 @@ effect->u.constant.envelope.attack_level, effect->u.constant.envelope.fade_length, effect->u.constant.envelope.fade_level); - + break; case FF_RUMBLE: fprintf(stderr, " rumble: (%d, %d)\n", effect->u.rumble.strong_magnitude, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.1.2/evdev/uinput.c new/python-evdev-1.2.0/evdev/uinput.c --- old/python-evdev-1.1.2/evdev/uinput.c 2018-09-01 19:45:42.000000000 +0200 +++ new/python-evdev-1.2.0/evdev/uinput.c 2019-04-07 17:40:25.000000000 +0200 @@ -74,6 +74,70 @@ } +// Different kernel versions have different device setup methods. You can read +// more about it here: +// https://github.com/torvalds/linux/commit/052876f8e5aec887d22c4d06e54aa5531ffcec75 + +// Setup function for kernel >= v4.5 +#if defined(UI_DEV_SETUP) && defined(UI_ABS_SETUP) +static PyObject * +uinput_setup(PyObject *self, PyObject *args) { + int fd, len, i; + uint16_t vendor, product, version, bustype; + + PyObject *absinfo = NULL, *item = NULL; + + struct uinput_abs_setup abs_setup; + + const char* name; + int ret = PyArg_ParseTuple(args, "isHHHHO", &fd, &name, &vendor, + &product, &version, &bustype, &absinfo); + if (!ret) return NULL; + + // Setup absinfo: + len = PyList_Size(absinfo); + for (i=0; i<len; i++) { + + // item -> (ABS_X, 0, 255, 0, 0, 0, 0) + item = PyList_GetItem(absinfo, i); + + memset(&abs_setup, 0, sizeof(abs_setup)); // Clear struct + abs_setup.code = PyLong_AsLong(PyList_GetItem(item, 0)); + abs_setup.absinfo.value = PyLong_AsLong(PyList_GetItem(item, 1)); + abs_setup.absinfo.minimum = PyLong_AsLong(PyList_GetItem(item, 2)); + abs_setup.absinfo.maximum = PyLong_AsLong(PyList_GetItem(item, 3)); + abs_setup.absinfo.fuzz = PyLong_AsLong(PyList_GetItem(item, 4)); + abs_setup.absinfo.flat = PyLong_AsLong(PyList_GetItem(item, 5)); + abs_setup.absinfo.resolution = PyLong_AsLong(PyList_GetItem(item, 6)); + + if(ioctl(fd, UI_ABS_SETUP, &abs_setup) < 0) + goto on_err; + } + + // Setup evdev: + struct uinput_setup usetup; + + memset(&usetup, 0, sizeof(usetup)); + strncpy(usetup.name, name, sizeof(usetup.name) - 1); + usetup.id.vendor = vendor; + usetup.id.product = product; + usetup.id.version = version; + usetup.id.bustype = bustype; + usetup.ff_effects_max = FF_MAX_EFFECTS; + + if(ioctl(fd, UI_DEV_SETUP, &usetup) < 0) + goto on_err; + + Py_RETURN_NONE; + + on_err: + _uinput_close(fd); + PyErr_SetFromErrno(PyExc_IOError); + return NULL; +} + +// Fallback setup function (Linux <= 4.5 and FreeBSD). +#else static PyObject * uinput_setup(PyObject *self, PyObject *args) { int fd, len, i, abscode; @@ -84,12 +148,12 @@ struct uinput_user_dev uidev; const char* name; - int ret = PyArg_ParseTuple(args, "ishhhhO", &fd, &name, &vendor, + int ret = PyArg_ParseTuple(args, "isHHHHO", &fd, &name, &vendor, &product, &version, &bustype, &absinfo); if (!ret) return NULL; memset(&uidev, 0, sizeof(uidev)); - strncpy(uidev.name, name, UINPUT_MAX_NAME_SIZE); + strncpy(uidev.name, name, sizeof(uidev.name) - 1); uidev.id.vendor = vendor; uidev.id.product = product; uidev.id.version = version; @@ -112,14 +176,6 @@ if (write(fd, &uidev, sizeof(uidev)) != sizeof(uidev)) goto on_err; - /* if (ioctl(fd, UI_SET_EVBIT, EV_KEY) < 0) */ - /* goto on_err; */ - /* int i; */ - /* for (i=0; i<KEY_MAX && fd; i++) { */ - /* if (ioctl(fd, UI_SET_KEYBIT, i) < 0) */ - /* goto on_err; */ - /* } */ - Py_RETURN_NONE; on_err: @@ -127,6 +183,8 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } +#endif + static PyObject * uinput_create(PyObject *self, PyObject *args) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.1.2/setup.cfg new/python-evdev-1.2.0/setup.cfg --- old/python-evdev-1.1.2/setup.cfg 2018-09-01 19:45:42.000000000 +0200 +++ new/python-evdev-1.2.0/setup.cfg 2019-04-07 17:40:25.000000000 +0200 @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.1.2 +current_version = 1.2.0 message = Bump version: {current_version} -> {new_version} commit = True tag = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.1.2/setup.py new/python-evdev-1.2.0/setup.py --- old/python-evdev-1.1.2/setup.py 2018-09-01 19:45:42.000000000 +0200 +++ new/python-evdev-1.2.0/setup.py 2019-04-07 17:40:25.000000000 +0200 @@ -44,7 +44,7 @@ #----------------------------------------------------------------------------- kw = { 'name': 'evdev', - 'version': '1.1.2', + 'version': '1.2.0', 'description': 'Bindings to the Linux input handling subsystem', 'long_description': open(pjoin(here, 'README.rst')).read(),