Questions tagged [libserial]

LibSerial is a C++ library for serial port programming on POSIX OSs.

LibSerial is a C++ library that aids in serial port programing on POSIX OSs by exposing serial ports as iostream objects. It has support for USB-to-Serial converters as well.

The source code is available on SourceForge at https://sourceforge.net/projects/libserial/.

37 questions
6
votes
2 answers

Read and Write on serial port in Ubuntu with C/C++ and LibSerial

I'm using LibSerial on Ubuntu to read and write data on serial port. At the moment, I'm able to write and receive strings over the serial port, but my code does not work very well: in particular, I'd like to control the reading function in order to…
Marcus Barnet
  • 2,083
  • 6
  • 28
  • 36
2
votes
3 answers

C++ writing byte to serial stream

I realized this sort of question is scattered all over the Internet, but nothing seems to be pointing me right. I'm trying to send a command to a Propeller control board through a serial stream. The connection seems to be working, but the it keeps…
haikalpribadi
  • 424
  • 1
  • 7
  • 19
2
votes
2 answers

Libserial Open() freezes in my C++ program

Basically I have a really simple C++ program where I'm trying to open a serial port (which is actually a USB->RS232 converter, should be supported by libserial) but the code freezes on Open(). No errors no exceptions, nothing, it just does nothing.…
Dago
  • 1,349
  • 1
  • 11
  • 19
2
votes
1 answer

Can't compile LibSerial on OS X

I am working an project that use Arduino and serial port communication. But I've switch my laptop from Win to Macbook Pro and I have to find an alternative for serial communication. Because I use c++ and after some research I decided to use…
2
votes
3 answers

Strange Serial MisComunication

Ok, so I have 3 devices. an AVR Butterfly microcontroller, set up with USART A Bifferboard, running Debian, using a custom made program for serial. A Desktop machine running Br@y's. So I'm trying to make the Bifferboard send serial to the AVR, But…
Frames Catherine White
  • 27,368
  • 21
  • 87
  • 137
2
votes
0 answers

Install / adding libserial to eclipse C++ ubuntu

I haven't used C++ in a while but I was able to setup eclipse and setup the basics. I need to write a program using libserial to communicate with a MC and I'm clueless on how to add the libserial library. I was able to download it from the official…
2
votes
1 answer

Error setting buad rate on ubuntu by pl2303 conector and serialstream.h/libserial

I'm developing a serial communication application on Ubuntu. I'm using a pl2303 converter and libserial. Myy issue is that I'm unable to set the baud rate. After executing the source code below I'm getting error state=2. My source code is: bool…
Nimo shr
  • 23
  • 4
1
vote
0 answers

Why I cannot emulate a serial device (arduino or somethin else) using socat?

I want to fake a device via a script and have the dart program to interface with it. Therefore, in my linux machine, I've run the following command to emulate a serial port: socat PTY,link=./arduino-sim,raw,echo=0…
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164
1
vote
1 answer

Instance of SerialStream.Open("/dev/ttyUSB0") throws an exception "Bad file descriptor" [libserial, lubunto, c++]

This question have been answered, see at the end and comments. Why is it that libserial SerialStream throws "Bad file descriptor" when opening a stream? This question have been been raised several times on different forums including here. None of…
Thomas
  • 11
  • 2
1
vote
1 answer

Always get read timeout

I'm currently trying to make the PIC32UBL Qt/Linux/Mac port working by serial port. So far I always get timeouts while reading the serial port. Here is the full PIC32UBL-qt open source project. I'm using /dev/ttyUSB0 as serial port, this adapter was…
Alexandre Lavoie
  • 8,711
  • 3
  • 31
  • 72
1
vote
0 answers

Can't read from serial device

I'm trying to write a library to read data from a serial device, a Mipex-02 gas sensor. Unfortunately, my code doesn't seem to open the serial connection properly, and I can't figure out why. The full source code is available on github,…
user4649617
1
vote
0 answers

libserial readsome returns strange value (not error)

my OS: Ubuntu 14.04 IDE: Ecplipse Mars Libs: GCC, libserial i am using libserial to communicate via serial-bus. #include #include #include #include #include…
arash javanmard
  • 1,362
  • 2
  • 17
  • 37
1
vote
2 answers

libserial error: cannot set baud rate as 115200

I'm trying to communicate with an USB-uart module using Libserial. Following is my code for initial part: serial_port.Open("/dev/ttyUSB0"); if ( ! serial_port.good() ) { std::cerr << "[" << __FILE__ << ":" << __LINE__ << "] " << "Error:…
lanyusea
  • 143
  • 2
  • 14
1
vote
0 answers

Libserial read serial port

I am using libserial library to interact with a modem using C++. The C++ code sends an AT command: my_serial_stream << "AT+CSQ" << '\r' ; The modem responds with a response, either ERROR or OK, The c++ code to read the response: while(…
farai
  • 11
  • 1
0
votes
0 answers

How can I fix empty values returned when using flutter_libserialport package to read serial input on Windows?

I'm developing a flutter destop app which has to read serial input from an esp32 board. I'm using the flutter_libserialport package. Reads are empty. When I use a port reader to stream, I get only [0]s and when I use the port.read(buffer), I just…
1
2 3