[rxtx] 01/06: patch for 740098

Tony Mancill tmancill at moszumanska.debian.org
Wed Feb 26 05:46:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

tmancill pushed a commit to branch master
in repository rxtx.

commit 350a7b0f0f7ab3c25a3766ad7b95b973fab3e9b2
Author: tony mancill <tmancill at debian.org>
Date:   Tue Feb 25 20:55:58 2014 -0800

    patch for 740098
---
 debian/patches/series          |  1 +
 debian/patches/usb_38400.patch | 67 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

diff --git a/debian/patches/series b/debian/patches/series
index bca8f83..190dac2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@ multiple_property_dirs.patch
 uninstall_target.patch
 fhs_lock_buffer_overflow_fix.patch
 MonitorThread-daemon.patch
+usb_38400.patch
diff --git a/debian/patches/usb_38400.patch b/debian/patches/usb_38400.patch
new file mode 100644
index 0000000..49f4803
--- /dev/null
+++ b/debian/patches/usb_38400.patch
@@ -0,0 +1,67 @@
+From: Jan Niehusmann <jan at gondor.com>
+Subject: Patch to fix setting USB-serial adapters to 38400 bps
+Bug-Debian: http://bugs.debian.org/740098
+Forwarded: no
+Description: The following patch should fix the reported issue.
+ .
+ On serial ports not supporting the TIOCGSERIAL/TIOCSSERIAL mechanism,
+ this still means that the custom baud rates do not work, but at least
+ 38400 works, again.
+ .
+ Perhaps an even better fix would be switching to the newer termios2 API,
+ as described here:
+ https://mail.python.org/pipermail/python-list/2012-October/633871.html
+ .
+ That API allows setting custom baud rates on the USB serial adapters I
+ have tested, where TIOCGSERIAL/TIOCSSERIAL was not supported.
+ .
+ But unfortunately, termios2 is not available through glibc, so one would
+ need to call linux-specific ioctls directly, which wouldn't be portable
+ at all, and I don't know how it interacts with the BSD / Hurd ports.
+ .
+ Therefore this is the minimal fix, for now.
+
+--- a/src/SerialImp.c
++++ b/src/SerialImp.c
+@@ -872,10 +872,14 @@
+ 	   out and select baud rates 38400 then 28800 then 38400, you will get
+ 	   a final baud rate of 28800 because you did not update the divisor.
+ 
++	   However, if the serial port doesn't support TIOCGSERIAL or custom speeds,
++	   don't fail: In this case, just use B38400 and assume that there is no way
++	   to set a custom speed on this port.
++
+ 	   See the next ifdef below for the divisor.
+ 	*/
+ #if defined(TIOCGSERIAL)
+-	if ( cspeed == B38400 )
++	if ( cspeed == B38400 && ioctl( fd, TIOCGSERIAL, &sstruct ) == 0 )
+ 		cspeed = 38400;
+ #endif /* TIOCGSERIAL */
+ 	if(     cfsetispeed( &ttyset, cspeed ) < 0 ||
+@@ -905,10 +909,9 @@
+ 			return(1);
+ 		}
+ 		sstruct.custom_divisor = ( sstruct.baud_base/cspeed );
+-		cspeed = B38400;
+ #endif /* TIOCGSERIAL */
+-		if(     cfsetispeed( &ttyset, cspeed ) < 0 ||
+-			cfsetospeed( &ttyset, cspeed ) < 0 )
++		if(     cfsetispeed( &ttyset, B38400 ) < 0 ||
++			cfsetospeed( &ttyset, B38400 ) < 0 )
+ 		{
+ 			/* OK, we tried everything */
+ 			report( "nativeSetSerialPortParams: Cannot Set Speed\n" );
+@@ -916,8 +919,11 @@
+ 		}
+ #if defined(TIOCSSERIAL)
+ 		/*  It is assumed Win32 does this for us */
++		/*  Ignore errors if the target speed is 38400: In this case,
++		 *  just assume TIOCSSERIAL is not supported and custom speeds are
++		 *  not available. */
+ 		if (	sstruct.baud_base < 1 ||
+-		ioctl( fd, TIOCSSERIAL, &sstruct ) < 0 )
++		ioctl( fd, TIOCSSERIAL, &sstruct ) < 0 && cspeed != 38400 )
+ 		{
+ 			return( 1 );
+ 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/rxtx.git



More information about the pkg-java-commits mailing list