Revision: 7658
http://playerstage.svn.sourceforge.net/playerstage/?rev=7658&view=rev
Author: thjc
Date: 2009-05-14 13:10:44 +0000 (Thu, 14 May 2009)
Log Message:
-----------
enable sick lms200 building and set flags for plsmode for all serial port speeds
Modified Paths:
--------------
code/player/trunk/server/drivers/laser/CMakeLists.txt
code/player/trunk/server/drivers/laser/sicklms200.cc
Modified: code/player/trunk/server/drivers/laser/CMakeLists.txt
===================================================================
--- code/player/trunk/server/drivers/laser/CMakeLists.txt 2009-05-14
07:34:37 UTC (rev 7657)
+++ code/player/trunk/server/drivers/laser/CMakeLists.txt 2009-05-14
13:10:44 UTC (rev 7658)
@@ -5,6 +5,7 @@
PLAYERDRIVER_REJECT_OS (pbslaser build_pbslaser PLAYER_OS_WIN)
PLAYERDRIVER_ADD_DRIVER (pbslaser build_pbslaser SOURCES pbs_driver.cc)
+PLAYERDRIVER_OPTION (sicklms200 build_sicklms200 ON)
CHECK_INCLUDE_FILES (linux/serial.h HAVE_LINUX_SERIAL_H)
SET (laser_config_h_in ${CMAKE_CURRENT_SOURCE_DIR}/laser_config.h.in)
SET (laser_config_h ${CMAKE_CURRENT_BINARY_DIR}/laser_config.h)
Modified: code/player/trunk/server/drivers/laser/sicklms200.cc
===================================================================
--- code/player/trunk/server/drivers/laser/sicklms200.cc 2009-05-14
07:34:37 UTC (rev 7657)
+++ code/player/trunk/server/drivers/laser/sicklms200.cc 2009-05-14
13:10:44 UTC (rev 7658)
@@ -928,14 +928,14 @@
cfmakeraw( &term );
if (PLSMode)
{
- term.c_iflag |= INPCK;
+ term.c_iflag |= INPCK;
term.c_iflag &= ~IXOFF;
term.c_cflag |= PARENB;
}
cfsetispeed( &term, B9600 );
cfsetospeed( &term, B9600 );
-
+
if( tcsetattr( this->laser_fd, TCSAFLUSH, &term ) < 0 )
RETURN_ERROR(1, "Unable to set serial port attributes");
@@ -976,8 +976,19 @@
{
struct termios term;
- //current_rate = speed;
+ // First set the common terminal settings
+ if( tcgetattr( this->laser_fd, &term ) < 0 )
+ RETURN_ERROR(1, "unable to get device attributes");
+ cfmakeraw( &term );
+ if (PLSMode)
+ {
+ term.c_iflag |= INPCK;
+ term.c_iflag &= ~IXOFF;
+ term.c_cflag |= PARENB;
+ }
+
+
#ifdef HAVE_HI_SPEED_SERIAL
struct serial_struct serial;
if(this->serial_high_speed_mode == 0)
@@ -1012,17 +1023,7 @@
{
case 9600:
//PLAYER_MSG0(2, "terminal speed to 9600");
- if( tcgetattr( this->laser_fd, &term ) < 0 )
- RETURN_ERROR(1, "unable to get device attributes");
- cfmakeraw( &term );
- if (PLSMode)
- {
- term.c_iflag |= INPCK;
- term.c_iflag &= ~IXOFF;
- term.c_cflag |= PARENB;
- }
-
cfsetispeed( &term, B9600 );
cfsetospeed( &term, B9600 );
@@ -1032,10 +1033,7 @@
case 38400:
//PLAYER_MSG0(2, "terminal speed to 38400");
- if( tcgetattr( this->laser_fd, &term ) < 0 )
- RETURN_ERROR(1, "unable to get device attributes");
- cfmakeraw( &term );
cfsetispeed( &term, B38400 );
cfsetospeed( &term, B38400 );
@@ -1068,10 +1066,6 @@
// even if we are doing 500kbps, we have to set the speed to
38400...
// the FTDI will know we want 500000 instead.
- if( tcgetattr( this->laser_fd, &term ) < 0 )
- RETURN_ERROR(1, "unable to get device attributes");
-
- cfmakeraw( &term );
cfsetispeed( &term, B38400 );
cfsetospeed( &term, B38400 );
@@ -1087,23 +1081,15 @@
if(this->laser_fd < 0)
RETURN_ERROR(1, "error opening");
- if( tcgetattr( this->laser_fd, &term ) < 0 )
- RETURN_ERROR(1, "unable to get device attributes");
-
term.c_cflag = this->serial_high_speed_baudremap | CS8 | CLOCAL
| CREAD;
- cfmakeraw( &term );
- cfsetispeed( &term, this->serial_high_speed_baudremap );
- cfsetospeed( &term, this->serial_high_speed_baudremap );
+ cfsetispeed( &term, this->serial_high_speed_baudremap );
+ cfsetospeed( &term, this->serial_high_speed_baudremap );
tcflush(this->laser_fd, TCIFLUSH);
tcsetattr(this->laser_fd, TCSANOW, &term);
tcflush(this->laser_fd, TCIFLUSH);
}
else if (this->serial_high_speed_mode == 2)
{
- if (tcgetattr(this->laser_fd, &term) < 0)
- RETURN_ERROR(1, "unable to get device attributes");
-
- cfmakeraw(&term);
if (tcsetattr(this->laser_fd, TCSAFLUSH, &term) < 0)
RETURN_ERROR(1, "unable to set device attributes");
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit