import python-evdev-1.1.2-3.el8

This commit is contained in:
CentOS Sources 2019-05-07 02:19:09 -04:00 committed by Andrew Lukoshko
commit 6bf78ae2d2
5 changed files with 229 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/python-evdev-1.1.2.tar.gz

1
.python-evdev.metadata Normal file
View File

@ -0,0 +1 @@
a4317e06e927d4eb85b0af81e05fdc37964b54a0 SOURCES/python-evdev-1.1.2.tar.gz

View File

@ -0,0 +1,69 @@
From 061417d37f48ca6d77d6a5aacc4faa94be31cf62 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 5 Oct 2018 08:41:07 +1000
Subject: [PATCH] input: fix ioctl return value handling()
If any of those ioctls fail, the returned data is undefined.
---
evdev/input.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/evdev/input.c b/evdev/input.c
index b37d3b7..67b9348 100644
--- a/evdev/input.c
+++ b/evdev/input.c
@@ -250,7 +250,10 @@ ioctl_EVIOCGREP(PyObject *self, PyObject *args)
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 @@ ioctl_EVIOCSREP(PyObject *self, PyObject *args)
if (!ret) return NULL;
ret = ioctl(fd, EVIOCSREP, &rep);
+ if (ret == -1)
+ return NULL;
+
return Py_BuildValue("i", ret);
}
@@ -277,6 +283,9 @@ ioctl_EVIOCGVERSION(PyObject *self, PyObject *args)
if (!ret) return NULL;
ret = ioctl(fd, EVIOCGVERSION, &res);
+ if (ret == -1)
+ return NULL;
+
return Py_BuildValue("i", res);
}
@@ -338,6 +347,9 @@ ioctl_EVIOCG_bits(PyObject *self, PyObject *args)
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 @@ ioctl_EVIOCGEFFECTS(PyObject *self, PyObject *args)
if (!ret) return NULL;
ret = ioctl(fd, EVIOCGEFFECTS, &res);
+ if (ret == -1)
+ return NULL;
+
return Py_BuildValue("i", res);
}
--
2.17.1

View File

@ -0,0 +1,25 @@
From 9c027ce3e5564375a20cfcb4a8d95df2565af793 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 5 Oct 2018 08:32:13 +1000
Subject: [PATCH] input: fix unintended fallthrough
---
evdev/input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/evdev/input.c b/evdev/input.c
index b3e6e08..b37d3b7 100644
--- a/evdev/input.c
+++ b/evdev/input.c
@@ -381,7 +381,7 @@ void print_ff_effect(struct ff_effect* effect) {
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,
--
2.17.1

133
SPECS/python-evdev.spec Normal file
View File

@ -0,0 +1,133 @@
%if 0%{?rhel} && 0%{?rhel} < 8
%bcond_without legacy_python
%endif
Name: python-evdev
Version: 1.1.2
Release: 3%{?dist}
Summary: Python bindings for the Linux input handling subsystem
License: BSD
URL: https://python-evdev.readthedocs.io
Source0: https://github.com/gvalkov/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: kernel-headers
%if %{with legacy_python}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%endif
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Patch01: 0001-input-fix-ioctl-return-value-handling.patch
Patch02: 0001-input-fix-unintended-fallthrough.patch
%global _description \
This package provides python bindings to the generic input event interface in \
Linux. The evdev interface serves the purpose of passing events generated in \
the kernel directly to userspace through character devices that are typically \
located in /dev/input/. \
\
This package also comes with bindings to uinput, the userspace input subsystem. \
Uinput allows userspace programs to create and handle input devices that can \
inject events directly into the input subsystem. \
\
In other words, python-evdev allows you to read and write input events on Linux. \
An event can be a key or button press, a mouse movement or a tap on a \
touchscreen.
%description %{_description}
%if %{with legacy_python}
%package -n python2-evdev
Summary: %{summary}
%{?python_provide:%python_provide python2-evdev}
%description -n python2-evdev %{_description}
%endif
%package -n python3-evdev
Summary: %{summary}
%{?python_provide:%python_provide python3-evdev}
%description -n python3-evdev %{_description}
#------------------------------------------------------------------------------
%prep
%autosetup -p1
#------------------------------------------------------------------------------
%build
%if %{with legacy_python}
%py2_build
%endif
%py3_build
#------------------------------------------------------------------------------
%install
%if %{with legacy_python}
%py2_install
%endif
%py3_install
#------------------------------------------------------------------------------
%if %{with legacy_python}
%files -n python2-evdev
%license LICENSE
%doc README.rst
%{python2_sitearch}/evdev/
%{python2_sitearch}/evdev-%{version}-py%{python2_version}.egg-info/
%endif
%files -n python3-evdev
%license LICENSE
%doc README.rst
%{python3_sitearch}/evdev/
%{python3_sitearch}/evdev-%{version}-py%{python3_version}.egg-info/
#------------------------------------------------------------------------------
%changelog
* Fri Oct 05 2018 Peter Hutterer <peter.hutterer@redhat.com> 1.1.2-3
- Fix coverity complaints
* Wed Sep 26 2018 Peter Hutterer <peter.hutterer@redhat.com> 1.1.2-2
- Don't build with python2 on RHEL8
* Wed Sep 26 2018 Peter Hutterer <peter.hutterer@redhat.com> 1.1.2-1
- Bump to version 1.1.2
* Tue Jul 31 2018 Florian Weimer <fweimer@redhat.com> - 1.0.0-2
- Rebuild with fixed binutils
* Sat Jul 28 2018 Georgi Valkov <georgi.t.valkov@gmail.com> - 1.0.0-1
- Bump to version 1.0.0
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.7.0-3
- Rebuilt for Python 3.7
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Tue Aug 22 2017 Georgi Valkov <georgi.t.valkov@gmail.com> - 0.7.0-1
- Bump to version 0.7.0
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.6.1-2
- Rebuild for Python 3.6
* Sun Jun 05 2016 Georgi Valkov <georgi.t.valkov@gmail.com> - 0.6.1-1
- Initial RPM Release