Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 161416 Details for
Bug 163637
dev-libs/libserial-0.5.2 (new ebuild)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
libserial-9999-gcc43.patch
libserial-9999-gcc43.patch (text/plain), 23.76 KB, created by
Steffen 'j0inty' Stollfuß
on 2008-07-26 13:48:42 UTC
(
hide
)
Description:
libserial-9999-gcc43.patch
Filename:
MIME Type:
Creator:
Steffen 'j0inty' Stollfuß
Created:
2008-07-26 13:48:42 UTC
Size:
23.76 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P libserial >Index: examples/read_port.cpp >=================================================================== >--- examples/read_port.cpp (Revision 91) >+++ examples/read_port.cpp (Arbeitskopie) >@@ -1,5 +1,6 @@ > #include <iostream> > #include <unistd.h> >+#include <cstdlib> > #include <SerialStream.h> > > int >@@ -12,10 +13,10 @@ > using namespace LibSerial ; > SerialStream serial_port ; > serial_port.Open( "/dev/ttyUSB0" ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "[" << __FILE__ << ":" << __LINE__ << "] " >- << "Error: Could not open serial port." >+ << "Error: Could not open serial port." > << std::endl ; > exit(1) ; > } >@@ -23,7 +24,7 @@ > // Set the baud rate of the serial port. > // > serial_port.SetBaudRate( SerialStreamBuf::BAUD_115200 ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not set the baud rate." << std::endl ; > exit(1) ; >@@ -32,7 +33,7 @@ > // Set the number of data bits. > // > serial_port.SetCharSize( SerialStreamBuf::CHAR_SIZE_8 ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not set the character size." << std::endl ; > exit(1) ; >@@ -41,7 +42,7 @@ > // Disable parity. > // > serial_port.SetParity( SerialStreamBuf::PARITY_NONE ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not disable the parity." << std::endl ; > exit(1) ; >@@ -50,7 +51,7 @@ > // Set the number of stop bits. > // > serial_port.SetNumOfStopBits( 1 ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not set the number of stop bits." > << std::endl ; >@@ -60,7 +61,7 @@ > // Turn off hardware flow control. > // > serial_port.SetFlowControl( SerialStreamBuf::FLOW_CONTROL_NONE ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not use hardware flow control." > << std::endl ; >@@ -74,20 +75,20 @@ > // > // Wait for some data to be available at the serial port. > // >- while( serial_port.rdbuf()->in_avail() == 0 ) >+ while( serial_port.rdbuf()->in_avail() == 0 ) > { > usleep(100) ; > } > // > // Keep reading data from serial port and print it to the screen. > // >- while( serial_port.rdbuf()->in_avail() > 0 ) >+ while( serial_port.rdbuf()->in_avail() > 0 ) > { > char next_byte; > serial_port.get(next_byte); > std::cerr << std::hex << static_cast<int>(next_byte) << " "; > usleep(100) ; >- } >+ } > std::cerr << std::endl ; > return EXIT_SUCCESS ; > } >Index: examples/write_port.cpp >=================================================================== >--- examples/write_port.cpp (Revision 91) >+++ examples/write_port.cpp (Arbeitskopie) >@@ -1,9 +1,10 @@ > #include <iostream> > #include <fstream> >+#include <cstdlib> > #include <SerialStream.h> > > // >-// This example reads the contents of a file and writes the entire >+// This example reads the contents of a file and writes the entire > // file to the serial port one character at a time. > // > int >@@ -11,7 +12,7 @@ > char** argv ) > { > // >- if ( argc < 2 ) >+ if ( argc < 2 ) > { > std::cerr << "Usage: " << argv[0] << " <filename>" << std::endl ; > return 1 ; >@@ -20,13 +21,13 @@ > // Open the serial port. > // > const char* const SERIAL_PORT_DEVICE = "/dev/ttyUSB0" ; >- using namespace LibSerial ; >+ using namespace LibSerial ; > SerialStream serial_port ; > serial_port.Open( SERIAL_PORT_DEVICE ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { >- std::cerr << "Error: Could not open serial port " >- << SERIAL_PORT_DEVICE >+ std::cerr << "Error: Could not open serial port " >+ << SERIAL_PORT_DEVICE > << std::endl ; > exit(1) ; > } >@@ -34,7 +35,7 @@ > // Set the baud rate of the serial port. > // > serial_port.SetBaudRate( SerialStreamBuf::BAUD_115200 ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not set the baud rate." << std::endl ; > exit(1) ; >@@ -43,7 +44,7 @@ > // Set the number of data bits. > // > serial_port.SetCharSize( SerialStreamBuf::CHAR_SIZE_8 ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not set the character size." << std::endl ; > exit(1) ; >@@ -52,7 +53,7 @@ > // Disable parity. > // > serial_port.SetParity( SerialStreamBuf::PARITY_NONE ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not disable the parity." << std::endl ; > exit(1) ; >@@ -61,7 +62,7 @@ > // Set the number of stop bits. > // > serial_port.SetNumOfStopBits( 1 ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not set the number of stop bits." > << std::endl ; >@@ -71,7 +72,7 @@ > // Turn on hardware flow control. > // > serial_port.SetFlowControl( SerialStreamBuf::FLOW_CONTROL_NONE ) ; >- if ( ! serial_port.good() ) >+ if ( ! serial_port.good() ) > { > std::cerr << "Error: Could not use hardware flow control." > << std::endl ; >@@ -83,27 +84,27 @@ > // > // serial_port.unsetf( std::ios_base::skipws ) ; > // >- // Open the input file for reading. >+ // Open the input file for reading. > // > std::ifstream input_file( argv[1] ) ; >- if ( ! input_file.good() ) >+ if ( ! input_file.good() ) > { > std::cerr << "Error: Could not open file " > << argv[1] << " for reading." << std::endl ; > return 1 ; > } > // >- // Read characters from the input file and dump them to the serial >- // port. >+ // Read characters from the input file and dump them to the serial >+ // port. > // > std::cerr << "Dumping file to serial port." << std::endl ; >- while( input_file ) >+ while( input_file ) > { > char next_byte ; > input_file.read( &next_byte, 1 ) ; > serial_port.write( &next_byte, 1 ) ; > // >- // Print a '.' for every character read from the input file. >+ // Print a '.' for every character read from the input file. > // > std::cerr << "." ; > } >Index: src/PosixSignalDispatcher.cpp >=================================================================== >--- src/PosixSignalDispatcher.cpp (Revision 91) >+++ src/PosixSignalDispatcher.cpp (Arbeitskopie) >@@ -14,6 +14,7 @@ > #include <map> > #include <errno.h> > #include <signal.h> >+#include <cstring> > > namespace > { >@@ -285,8 +286,8 @@ > } > // > // :TODO: Why is the following code commented out using "#if 0" ? >- // Check and remove this code if it is not necessary. Otherwise, if >- // it has been commented out due to a bug then debug and correct it. >+ // Check and remove this code if it is not necessary. Otherwise, if >+ // it has been commented out due to a bug then debug and correct it. > // > #if 0 > /* >Index: src/SerialPort.cpp >=================================================================== >--- src/SerialPort.cpp (Revision 91) >+++ src/SerialPort.cpp (Arbeitskopie) >@@ -23,6 +23,7 @@ > #include "PosixSignalHandler.h" > #include <queue> > #include <map> >+#include <cstdlib> > #include <cerrno> > #include <cassert> > #include <termios.h> >@@ -200,9 +201,9 @@ > SetDtr( const bool dtrState ) > throw( SerialPort::NotOpen, > std::runtime_error ) ; >- >+ > bool >- GetDtr() const >+ GetDtr() const > throw( SerialPort::NotOpen, > std::runtime_error ) ; > >@@ -210,20 +211,20 @@ > SetRts( const bool rtsState ) > throw( SerialPort::NotOpen, > std::runtime_error ) ; >- >+ > bool >- GetRts() const >+ GetRts() const > throw( SerialPort::NotOpen, > std::runtime_error ) ; > > bool >- GetCts() const >+ GetCts() const > throw( SerialPort::NotOpen, > std::runtime_error ) ; > >- >+ > bool >- GetDsr() const >+ GetDsr() const > throw( SerialPort::NotOpen, > std::runtime_error ) ; > /* >@@ -258,19 +259,19 @@ > > /** > * Circular buffer used to store the received data. This is done >- * asynchronously and helps prevent overflow of the corresponding >+ * asynchronously and helps prevent overflow of the corresponding > * tty's input buffer. >- * >- * :TODO: The size of this buffer is allowed to increase indefinitely. If >- * data keeps arriving at the serial port and is never read then this >- * buffer will continue occupying more and more memory. We need to put a >- * cap on the size of this buffer. It might even be worth providing a >- * method to set the size of this buffer. >+ * >+ * :TODO: The size of this buffer is allowed to increase indefinitely. If >+ * data keeps arriving at the serial port and is never read then this >+ * buffer will continue occupying more and more memory. We need to put a >+ * cap on the size of this buffer. It might even be worth providing a >+ * method to set the size of this buffer. > */ > std::queue<unsigned char> mInputBuffer ; > > /** >- * Set the specified modem control line to the specified value. >+ * Set the specified modem control line to the specified value. > * > * @param modemLine One of the following four values: TIOCM_DTR, > * TIOCM_RTS, TIOCM_CTS, or TIOCM_DSR. >@@ -286,7 +287,7 @@ > > /** > * Get the current state of the specified modem control line. >- * >+ * > * @param modemLine One of the following four values: TIOCM_DTR, > * TIOCM_RTS, TIOCM_CTS, or TIOCM_DSR. > * >@@ -296,7 +297,7 @@ > bool > GetModemControlLine( const int modemLine ) const > throw( SerialPort::NotOpen, >- std::runtime_error ) ; >+ std::runtime_error ) ; > } ; > > SerialPort::SerialPort( const std::string& serialPortName ) : >@@ -524,16 +525,16 @@ > void > SerialPort::SetDtr( const bool dtrState ) > throw( SerialPort::NotOpen, >- std::runtime_error ) >+ std::runtime_error ) > { > mSerialPortImpl->SetDtr( dtrState ) ; > return ; > } > > bool >-SerialPort::GetDtr() const >+SerialPort::GetDtr() const > throw( SerialPort::NotOpen, >- std::runtime_error ) >+ std::runtime_error ) > { > return mSerialPortImpl->GetDtr() ; > } >@@ -541,33 +542,33 @@ > void > SerialPort::SetRts( const bool rtsState ) > throw( SerialPort::NotOpen, >- std::runtime_error ) >+ std::runtime_error ) > { > mSerialPortImpl->SetRts( rtsState ) ; > return ; > } > > bool >-SerialPort::GetRts() const >+SerialPort::GetRts() const > throw( SerialPort::NotOpen, >- std::runtime_error ) >+ std::runtime_error ) > { > return mSerialPortImpl->GetRts() ; > } > > > bool >-SerialPort::GetCts() const >+SerialPort::GetCts() const > throw( SerialPort::NotOpen, >- std::runtime_error ) >+ std::runtime_error ) > { > return mSerialPortImpl->GetCts() ; > } > > bool >-SerialPort::GetDsr() const >+SerialPort::GetDsr() const > throw( SerialPort::NotOpen, >- std::runtime_error ) >+ std::runtime_error ) > { > return mSerialPortImpl->GetDsr() ; > } >@@ -1443,7 +1444,7 @@ > throw( SerialPort::NotOpen, > std::runtime_error ) > { >- this->SetModemControlLine( TIOCM_DTR, >+ this->SetModemControlLine( TIOCM_DTR, > dtrState ) ; > return ; > } >@@ -1455,7 +1456,7 @@ > std::runtime_error ) > { > return this->GetModemControlLine( TIOCM_DTR ) ; >-} >+} > > inline > void >@@ -1463,7 +1464,7 @@ > throw( SerialPort::NotOpen, > std::runtime_error ) > { >- this->SetModemControlLine( TIOCM_RTS, >+ this->SetModemControlLine( TIOCM_RTS, > rtsState ) ; > return ; > } >@@ -1475,7 +1476,7 @@ > std::runtime_error ) > { > return this->GetModemControlLine( TIOCM_RTS ) ; >-} >+} > > > inline >@@ -1485,7 +1486,7 @@ > std::runtime_error ) > { > return this->GetModemControlLine( TIOCM_CTS ) ; >-} >+} > > > inline >@@ -1495,7 +1496,7 @@ > std::runtime_error ) > { > return this->GetModemControlLine( TIOCM_DSR ) ; >-} >+} > > inline > void >@@ -1559,7 +1560,7 @@ > } > // > // :TODO: Check to make sure that modemLine is a valid value. >- // >+ // > // Set or unset the specified bit according to the value of > // lineState. > // >@@ -1567,19 +1568,19 @@ > if ( true == lineState ) > { > int set_line_mask = modemLine ; >- ioctl_result = ioctl( mFileDescriptor, >+ ioctl_result = ioctl( mFileDescriptor, > TIOCMBIS, > &set_line_mask ) ; > } > else > { > int reset_line_mask = modemLine ; >- ioctl_result = ioctl( mFileDescriptor, >+ ioctl_result = ioctl( mFileDescriptor, > TIOCMBIC, > &reset_line_mask ) ; > } > // >- // Check for errors. >+ // Check for errors. > // > if ( -1 == ioctl_result ) > { >Index: src/SerialPort.h >=================================================================== >--- src/SerialPort.h (Revision 91) >+++ src/SerialPort.h (Arbeitskopie) >@@ -21,7 +21,7 @@ > #define _SerialPort_h_ > > >-#include <string> >+#include <cstring> > #include <vector> > #include <stdexcept> > #include <termios.h> >@@ -40,12 +40,12 @@ > * > * :FIXME: Provide examples of the above potential problem. > * >- * @todo The current implementation does not check if another process has >+ * @todo The current implementation does not check if another process has > * locked the serial port device and does not lock the serial port device after >- * opening it. This has been observed to cause problems while using this >- * library while other programs such as minicom are also accessing the same device. >+ * opening it. This has been observed to cause problems while using this >+ * library while other programs such as minicom are also accessing the same device. > * It will be useful to lock the serial port device when it is being used by >- * this class. >+ * this class. > */ > class SerialPort > { >@@ -77,7 +77,7 @@ > // B460800 is defined on Linux but not on Mac OS X. What about other > // operating systems ? > // >-#ifdef __linux__ >+#ifdef __linux__ > BAUD_460800 = B460800, > #endif > BAUD_DEFAULT = BAUD_57600 >@@ -416,7 +416,7 @@ > * Get the status of the DTR line. > */ > bool >- GetDtr() const >+ GetDtr() const > throw( NotOpen, > std::runtime_error ) ; > >@@ -432,7 +432,7 @@ > * Get the status of the RTS line. > */ > bool >- GetRts() const >+ GetRts() const > throw( NotOpen, > std::runtime_error ) ; > >@@ -440,9 +440,9 @@ > //SetCts( const bool ctsState = true ) > // throw( NotOpen, > // std::runtime_error ) ; >- >+ > bool >- GetCts() const >+ GetCts() const > throw( NotOpen, > std::runtime_error ) ; > >@@ -450,30 +450,30 @@ > //SetDsr( const bool dsrState = true ) > // throw( NotOpen, > // std::runtime_error ) ; >- >+ > bool >- GetDsr() const >+ GetDsr() const > throw( NotOpen, > std::runtime_error ) ; > private: > /** >- * Prevent copying of objects of this class by declaring the copy >- * constructor private. This method is never defined. >+ * Prevent copying of objects of this class by declaring the copy >+ * constructor private. This method is never defined. > */ > SerialPort( const SerialPort& otherSerialPort ) ; >- >+ > /** > * Prevent copying of objects of this class by declaring the assignment >- * operator private. This method is never defined. >+ * operator private. This method is never defined. > */ > SerialPort& operator=(const SerialPort& otherSerialPort ) ; >- >+ > /* > * Forward declaration of the implementation class folowing the > * PImpl idiom. > */ > class SerialPortImpl ; >- >+ > /** > * Pointer to implementation class instance. > */ >Index: src/SerialStream.h >=================================================================== >--- src/SerialStream.h (Revision 91) >+++ src/SerialStream.h (Arbeitskopie) >@@ -8,7 +8,7 @@ > #ifndef _SerialStream_h_ > #define _SerialStream_h_ > >-#include <string> >+#include <cstring> > #include <fstream> > #include <SerialStreamBuf.h> > >@@ -42,10 +42,10 @@ > obtained from <a href="http://www.UNIX-systems.org/"> > http://www.UNIX-systems.org/</a>. We will refer to this > document as SUS-2. >- >+ > @author $Author: crayzeewulf $ <A HREF="pagey@gnudom.org">Manish P. Pagey</A> > @version $Id: SerialStream.h,v 1.5 2004/05/06 18:32:02 crayzeewulf >- >+ > */ > class SerialStream : public std::iostream { > public: >@@ -78,11 +78,11 @@ > stream is in a good state before using it for any further > I/O operations. > >- @param fileName The filename of the serial port. >- @param openMode The openmode for the serial port file. >+ @param fileName The filename of the serial port. >+ @param openMode The openmode for the serial port file. > > */ >- explicit SerialStream( const std::string fileName, >+ explicit SerialStream( const std::string fileName, > std::ios_base::openmode openMode = > std::ios::in|std::ios::out) ; > >@@ -92,12 +92,12 @@ > > */ > explicit SerialStream() ; >- >+ > /** The destructor. It closes the stream associated with > mFileDescriptor. The rest is done by the fstream destructor. >- >+ > */ >- virtual ~SerialStream() ; >+ virtual ~SerialStream() ; > //@} > > /** @name Other Public Methods >@@ -107,8 +107,8 @@ > s and the specified mode, mode. > > */ >- void Open( const std::string fileName, >- std::ios_base::openmode openMode = >+ void Open( const std::string fileName, >+ std::ios_base::openmode openMode = > std::ios_base::in | std::ios_base::out) ; > > /** Close the serial port. No communications can occur with the >@@ -122,7 +122,7 @@ > */ > const bool IsOpen() const ; > >- /** Set the baud rate for serial communications. >+ /** Set the baud rate for serial communications. > > */ > void SetBaudRate(SerialStreamBuf::BaudRateEnum baudRate ) ; >@@ -130,8 +130,8 @@ > /** Get the current baud rate being used for serial > communication. This routine queries the serial port for its > current settings and returns the baud rate that is being >- used by the serial port. >- >+ used by the serial port. >+ > @return The current baud rate for the serial port. > Note: this is not a constant function because it > checks to see that it is dealing with a SerialStream >@@ -140,59 +140,59 @@ > */ > const SerialStreamBuf::BaudRateEnum BaudRate() ; > >- /** Set the character size associated with the serial port. >- >- @param size The character size will be set to this value. >+ /** Set the character size associated with the serial port. >+ >+ @param size The character size will be set to this value. > */ > void SetCharSize(const SerialStreamBuf::CharSizeEnum charSize ) ; > >- /** Get the character size being used for serial communication. >- >- @return The current character size. >+ /** Get the character size being used for serial communication. >+ >+ @return The current character size. > */ > const SerialStreamBuf::CharSizeEnum CharSize() ; > > /** Set the number of stop bits used during serial > communication. The only valid values are 1 and 2. > >- @param stop_bits The number of stop bits. (1 or 2). >- >+ @param stop_bits The number of stop bits. (1 or 2). >+ > */ > void SetNumOfStopBits(short stop_bits) ; > > /** Get the number of stop bits being used during serial > communication. >- >+ > @return The number of stop bits. */ >- const short NumOfStopBits() ; >+ const short NumOfStopBits() ; > > /** Set the parity for serial communication. >- >- @param parity The parity value. >- >+ >+ @param parity The parity value. >+ > */ > void SetParity(const SerialStreamBuf::ParityEnum parity) ; > >- /** Get the current parity setting for the serial port. >- >- @return The parity setting for the serial port. >- >+ /** Get the current parity setting for the serial port. >+ >+ @return The parity setting for the serial port. >+ > */ > const SerialStreamBuf::ParityEnum Parity() ; > >- /** Use the specified flow control. >+ /** Use the specified flow control. > > */ >- void >+ void > SetFlowControl(const SerialStreamBuf::FlowControlEnum flow_c) ; > >- /** Return the current flow control setting. >+ /** Return the current flow control setting. > > */ > const SerialStreamBuf::FlowControlEnum FlowControl() ; > > /** Set character buffer size. >- >+ > */ > const short SetVMin( short vtime ) ; > >@@ -200,19 +200,19 @@ > /** Get current size of character buffer. > Look <A HREF="http://www.unixwiz.net/techtips/termios-vmin-vtime.html">here</A> > for more documentation about VTIME and VMIN. >- >+ > */ > const short VMin() ; > > /** Set character buffer timing in 10th of a second. >- >+ > */ > const short SetVTime( short vtime ) ; > > /** Get current timing of character buffer in 10th of a second. > Look <A HREF="http://www.unixwiz.net/techtips/termios-vmin-vtime.html">here</A> > for more documentation about VTIME and VMIN. >- >+ > */ > const short VTime() ; > >@@ -274,7 +274,7 @@ > > /* Enable the serial port receiver. This will allow us to read > data from the serial port. >- >+ > @param enable If true then the received will be > enabled. Otherwise it will be disabled. > >@@ -284,7 +284,7 @@ > } ; // class SerialStream > > inline >- SerialStream::SerialStream() : >+ SerialStream::SerialStream() : > std::iostream(0), mIOBuffer(0) { > // > // Close the stream >@@ -294,7 +294,7 @@ > > inline > SerialStream::~SerialStream() { >- // >+ // > // If a SerialStreamBuf is associated with this SerialStream > // then we need to destroy it here. > // >@@ -304,7 +304,7 @@ > } > > inline >- void >+ void > SerialStream::Close() { > // > // If a SerialStreamBuf is associated with the SerialStream then
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 163637
:
108053
|
124005
|
161414
|
161416
|
161495
|
172390
|
180405
|
216530