From 58993e7e3617733bd58d0e7eecd37bb53c7b2714 Mon Sep 17 00:00:00 2001 From: Peter Fales Date: Tue, 7 Jan 2003 01:15:16 +0000 Subject: [PATCH] Irix fixes from mailing list --- backend/dc210.c | 42 +++++++++++++++++++++++++++++++++++++----- backend/dc210.conf | 8 +++++--- backend/dc240.c | 33 ++++++++++++++++++++++++++++++--- backend/dc240.conf | 8 +++++--- backend/dc25.conf | 8 +++++--- backend/gphoto2.conf | 2 +- 6 files changed, 83 insertions(+), 18 deletions(-) diff --git a/backend/dc210.c b/backend/dc210.c index cf9e8ef3a..32dd70c11 100644 --- a/backend/dc210.c +++ b/backend/dc210.c @@ -358,10 +358,28 @@ init_dc210 (DC210 * camera) #ifdef HAVE_CFMAKERAW cfmakeraw (&tty_new); #else - tty_new.c_lflag &= ~(ICANON | ECHO | ISIG); + /* Modified to set the port REALLY as required. Code inspired by + the gPhoto2 serial port setup */ + + /* input control settings */ + tty_new.c_iflag &= ~(IGNBRK | IGNCR | INLCR | ICRNL | IUCLC | + IXANY | IXON | IXOFF | INPCK | ISTRIP); + tty_new.c_iflag |= (BRKINT | IGNPAR); + /* output control settings */ + tty_new.c_oflag &= ~OPOST; + /* hardware control settings */ + tty_new.c_cflag = (tty_new.c_cflag & ~CSIZE) | CS8; + tty_new.c_cflag &= ~(PARENB | PARODD | CSTOPB); +# if defined(__sgi) + tty_new.c_cflag &= ~CNEW_RTSCTS; +# else + tty_new.c_cflag &= ~CRTSCTS; +# endif + tty_new.c_cflag |= CLOCAL | CREAD; #endif - tty_new.c_oflag &= ~CSTOPB; - tty_new.c_lflag = 0; + /* line discipline settings */ + tty_new.c_lflag &= ~(ICANON | ISIG | ECHO | ECHONL | ECHOE | + ECHOK | IEXTEN); tty_new.c_cc[VMIN] = 0; tty_new.c_cc[VTIME] = 5; cfsetospeed (&tty_new, B9600); @@ -375,7 +393,15 @@ init_dc210 (DC210 * camera) /* send a break to get it back to a known state */ #ifdef HAVE_TCSENDBREAK +# if defined(__sgi) + /* Maybe you should consider the following for all the platforms, not just + IRIX. Again, inspired by the gPhoto2 DC210 camera library setup */ + + ioctl (camera->fd, TCSBRK, 0); + ioctl (camera->fd, TCSBRK, 1); +# else tcsendbreak (camera->fd, 4); +# endif #else # if defined(TCSBRKP) ioctl (camera->fd, TCSBRKP, 4); @@ -383,8 +409,14 @@ init_dc210 (DC210 * camera) ioctl (camera->fd, TCSBRK, 4); # endif #endif - /* and wait for it to recover from the break */ - usleep (breakpause); + + /* and wait for it to recover from the break */ + +#ifdef HAVE_USLEEP + usleep (breakpause); +#else ++ sleep (1); +#endif if (send_pck (camera->fd, init_pck) == -1) { diff --git a/backend/dc210.conf b/backend/dc210.conf index 0d3b48a54..9281043d4 100644 --- a/backend/dc210.conf +++ b/backend/dc210.conf @@ -11,10 +11,12 @@ port=/dev/ttyS0 #port=/dev/tty01 # Max baud rate for download. Camera always starts at 9600 baud, then # switches to the higher rate -## This works for Linux and some versions of IRIX (6.3 or higher) -baud=115200 +## This works for Linux. Also works for IRIX (6.3 or higher), providing that +## the host is an O2, OCTANE, Origin2000/200, Onyx2, Origin3000/300, Onyx3 or +## a newer SGI hardware [see serial(7)]. +#baud=115200 ## This works for most UNIX's -#baud=38400 +baud=38400 # Prints some extra information during the init phase. This can be # handy, but note that printing anything to stderr breaks the saned # network scanning. diff --git a/backend/dc240.c b/backend/dc240.c index dabcea6a9..a52d4827a 100644 --- a/backend/dc240.c +++ b/backend/dc240.c @@ -403,10 +403,28 @@ init_dc240 (DC240 * camera) #ifdef HAVE_CFMAKERAW cfmakeraw (&tty_new); #else - tty_new.c_lflag &= ~(ICANON | ECHO | ISIG); + /* Modified to set the port REALLY as required (9600, 8b, 1sb, NO parity). + Code inspired by the gPhoto2 serial port setup */ + + /* input control settings */ + tty_new.c_iflag &= ~(IGNBRK | IGNCR | INLCR | ICRNL | IUCLC | + IXANY | IXON | IXOFF | INPCK | ISTRIP); + tty_new.c_iflag |= (BRKINT | IGNPAR); + /* output control settings */ + tty_new.c_oflag &= ~OPOST; + /* hardware control settings */ + tty_new.c_cflag = (tty_new.c_cflag & ~CSIZE) | CS8; + tty_new.c_cflag &= ~(PARENB | PARODD | CSTOPB); +# if defined(__sgi) + tty_new.c_cflag &= ~CNEW_RTSCTS; +# else + tty_new.c_cflag &= ~CRTSCTS; +# endif + tty_new.c_cflag |= CLOCAL | CREAD; #endif - tty_new.c_oflag &= ~CSTOPB; - tty_new.c_lflag = 0; + /* line discipline settings */ + tty_new.c_lflag &= ~(ICANON | ISIG | ECHO | ECHONL | ECHOE | + ECHOK | IEXTEN); tty_new.c_cc[VMIN] = 0; tty_new.c_cc[VTIME] = 5; cfsetospeed (&tty_new, B9600); @@ -421,7 +439,15 @@ init_dc240 (DC240 * camera) /* send a break to get it back to a known state */ #ifdef HAVE_TCSENDBREAK +# if defined(__sgi) + /* Maybe you should consider the following for all the platforms, not just + IRIX. Again, inspired by the gPhoto2 DC240 camera library setup */ + + ioctl (camera->fd, TCSBRK, 0); + ioctl (camera->fd, TCSBRK, 1); +# else tcsendbreak (camera->fd, 4); +# endif #else # if defined(TCSBRKP) ioctl (camera->fd, TCSBRKP, 4); @@ -429,6 +455,7 @@ init_dc240 (DC240 * camera) ioctl (camera->fd, TCSBRK, 4); # endif #endif + /* and wait for it to recover from the break */ #ifdef HAVE_USLEEP diff --git a/backend/dc240.conf b/backend/dc240.conf index 0d3b48a54..9281043d4 100644 --- a/backend/dc240.conf +++ b/backend/dc240.conf @@ -11,10 +11,12 @@ port=/dev/ttyS0 #port=/dev/tty01 # Max baud rate for download. Camera always starts at 9600 baud, then # switches to the higher rate -## This works for Linux and some versions of IRIX (6.3 or higher) -baud=115200 +## This works for Linux. Also works for IRIX (6.3 or higher), providing that +## the host is an O2, OCTANE, Origin2000/200, Onyx2, Origin3000/300, Onyx3 or +## a newer SGI hardware [see serial(7)]. +#baud=115200 ## This works for most UNIX's -#baud=38400 +baud=38400 # Prints some extra information during the init phase. This can be # handy, but note that printing anything to stderr breaks the saned # network scanning. diff --git a/backend/dc25.conf b/backend/dc25.conf index 7cb199029..33cfd895a 100644 --- a/backend/dc25.conf +++ b/backend/dc25.conf @@ -11,10 +11,12 @@ port=/dev/ttyS0 #port=/dev/tty01 # Max baud rate for download. Camera always starts at 9600 baud, then # switches to the higher rate -## This works for Linux and some versions of IRIX (6.3 or higher) -baud=115200 +## This works for Linux. Also works for IRIX (6.3 or higher), providing that +## the host is an O2, OCTANE, Origin2000/200, Onyx2, Origin3000/300, Onyx3 or +## a newer SGI hardware [see serial(7)]. +#baud=115200 ## This works for most UNIX's -#baud=38400 +baud=38400 # Prints some extra information during the init phase. This can be # handy, but note that printing anything to stderr breaks the saned # network scanning. diff --git a/backend/gphoto2.conf b/backend/gphoto2.conf index 2befe7085..f5a660af8 100644 --- a/backend/gphoto2.conf +++ b/backend/gphoto2.conf @@ -1,7 +1,7 @@ # Interface port where the camera is connected # This should be one of the values returned by "gphoto2 --list-ports", # such # as serial:/dev/ttyS6 or usb: -port=usb: +port=serial:/dev/ttyd1 # Port speed. This should be one of the values returned by # "gphoto2 --abilities"