[pyserial] Patched to allow arbitrary speeds bz#982368
Paul Komkoff
stingray at fedoraproject.org
Sat Sep 7 22:36:28 UTC 2013
commit dfd157ced42b9025d721c8ae66a9649cce37a42a
Author: Paul P. Komkoff <i at stingr.net>
Date: Sun Sep 8 02:36:02 2013 +0400
Patched to allow arbitrary speeds bz#982368
pyserial-speed.patch | 42 ++++++++++++++++++++++++++++++++++++++++++
pyserial.spec | 7 ++++++-
2 files changed, 48 insertions(+), 1 deletions(-)
---
diff --git a/pyserial-speed.patch b/pyserial-speed.patch
new file mode 100644
index 0000000..bb8f834
--- /dev/null
+++ b/pyserial-speed.patch
@@ -0,0 +1,42 @@
+Index: pyserial/serial/serialposix.py
+===================================================================
+--- pyserial/serial/serialposix.py (revision 455)
++++ pyserial/serial/serialposix.py (working copy)
+@@ -36,26 +36,25 @@
+ def device(port):
+ return '/dev/ttyS%d' % port
+
+- ASYNC_SPD_MASK = 0x1030
+- ASYNC_SPD_CUST = 0x0030
++ TCGETS2 = 0x802C542A
++ TCSETS2 = 0x402C542B
++ BOTHER = 0o010000
+
+ def set_special_baudrate(port, baudrate):
++ # right size is 44 on x86_64, allow for some growth
+ import array
+- buf = array.array('i', [0] * 32)
++ buf = array.array('i', [0] * 64)
+
+ # get serial_struct
+- FCNTL.ioctl(port.fd, TERMIOS.TIOCGSERIAL, buf)
++ FCNTL.ioctl(port.fd, TCGETS2, buf)
++ # set custom speed
++ buf[2] &= ~TERMIOS.CBAUD
++ buf[2] |= BOTHER
++ buf[9] = buf[10] = baudrate
+
+- # set custom divisor
+- buf[6] = buf[7] / baudrate
+-
+- # update flags
+- buf[4] &= ~ASYNC_SPD_MASK
+- buf[4] |= ASYNC_SPD_CUST
+-
+ # set serial_struct
+ try:
+- res = FCNTL.ioctl(port.fd, TERMIOS.TIOCSSERIAL, buf)
++ res = FCNTL.ioctl(port.fd, TCSETS2, buf)
+ except IOError:
+ raise ValueError('Failed to set custom baud rate: %r' % baudrate)
+
diff --git a/pyserial.spec b/pyserial.spec
index 18c15e5..296e003 100644
--- a/pyserial.spec
+++ b/pyserial.spec
@@ -3,8 +3,9 @@
Summary: Python serial port access library
Name: pyserial
Version: 2.6
-Release: 5%{?dist}
+Release: 6%{?dist}
Source0: http://easynews.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.gz
+Patch0: pyserial-speed.patch
License: Python
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -21,6 +22,7 @@ the appropriate backend.
%prep
export UNZIP="-aa"
%setup -q
+%patch0 -p1
%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
@@ -39,6 +41,9 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/miniterm.py
%changelog
+* Sat Sep 07 2013 Paul P. Komkoff <i at stingr.net> - 2.6-6
+- patched to allow arbitrary speeds bz#982368
+
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
More information about the scm-commits
mailing list