Patched to allow arbitrary speeds bz#982368
This commit is contained in:
parent
c495ad3908
commit
dfd157ced4
42
pyserial-speed.patch
Normal file
42
pyserial-speed.patch
Normal file
@ -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)
|
||||
|
||||
@ -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@stingr.net> - 2.6-6
|
||||
- patched to allow arbitrary speeds bz#982368
|
||||
|
||||
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user