summaryrefslogtreecommitdiff
path: root/libgphoto2_port/serial
diff options
context:
space:
mode:
authorLutz Mueller <lutz@users.sourceforge.net>2003-12-11 16:42:31 +0000
committerLutz Mueller <lutz@users.sourceforge.net>2003-12-11 16:42:31 +0000
commit86bc86b61a50c95f5ef2254f5034c123688f162c (patch)
treeae8a1a9a1617d50e14cdc6f8da228f93adcd2cea /libgphoto2_port/serial
parent52a581f1154cec1232ef2beb2457e0ce4c02a044 (diff)
downloadlibgphoto2-86bc86b61a50c95f5ef2254f5034c123688f162c.tar.gz
2003-12-11 Lutz Mueller <lutz@users.sourceforge.net>
Patch by Andreas Burmester <a.burmester@hamburg.de>: * serial/unix.c: Do not verify the speed change if we set the speed to 0. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@6947 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port/serial')
-rw-r--r--libgphoto2_port/serial/unix.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libgphoto2_port/serial/unix.c b/libgphoto2_port/serial/unix.c
index 2042a8608..ae1a3565c 100644
--- a/libgphoto2_port/serial/unix.c
+++ b/libgphoto2_port/serial/unix.c
@@ -888,15 +888,20 @@ gp_port_serial_check_speed (GPPort *dev)
* Verify if the speed change has been successful.
* This is needed because some Solaris systems just ignore unsupported
* speeds (like 115200) instead of complaining.
+ *
+ * Only perform the check if we really changed to some speed.
*/
- if (tcgetattr (dev->pl->fd, &tio)) {
- GP_DEBUG ("Error on 'tcgetattr'.");
- return (GP_ERROR_IO_SERIAL_SPEED);
- }
- if ((cfgetispeed (&tio) != speed) || (cfgetospeed (&tio) != speed)) {
- GP_DEBUG ("Cannot set baudrate to %d...",
- dev->settings.serial.speed);
- return (GP_ERROR_NOT_SUPPORTED);
+ if (speed != B0) {
+ if (tcgetattr (dev->pl->fd, &tio)) {
+ GP_DEBUG ("Error on 'tcgetattr'.");
+ return (GP_ERROR_IO_SERIAL_SPEED);
+ }
+ if ((cfgetispeed (&tio) != speed) ||
+ (cfgetospeed (&tio) != speed)) {
+ GP_DEBUG ("Cannot set baudrate to %d...",
+ dev->settings.serial.speed);
+ return (GP_ERROR_NOT_SUPPORTED);
+ }
}
#else /* !HAVE_TERMIOS_H */