Hi,

I am writing a simple Qt on Maemo application for serial communication between 
device and PC for which I am using QextSerialPort 1.2 library to write on the 
/dev/ttyS0 port so that it could be read by the COM1 port on my windows machine 
connected to the device via USB cable.

I am able to create the .so libraries and using the QESPTA example provided in 
QextSerialPort to write on the first serial port. Initially I was trying to 
write on the COM1 port and the device was creating a file named COM1 and 
writing everything there. Then I found the naming convention used for the first 
port on Linux/Maemo is /dev/ttyS0 and changed the port ame accordingly. but 
this is returning error when the API for writing on port is used although the 
API to open the port is returning Success.

Port Settings & open/ write calls (Code Snippet):
port = new QextSerialPort("/dev/ttyS0");
port->setBaudRate(BAUD9600);
port->setFlowControl(FLOW_HARDWARE);
port->setParity(PAR_NONE);
port->setDataBits(DATA_8);
port->setStopBits(STOP_1);
//set timeouts to 500 ms
port->setTimeout(500);

port->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
// internally calls QFile->Open(..) as shown below and returs success
if (Posix_File->open(QIODevice::ReadWrite|QIODevice::Unbuffered)) {
  qDebug("Opened File succesfully");
  /*set open mode*/
  QIODevice::open(mode);

int i = port->write((message->text()).toAscii(),(message->text()).length());
qDebug("trasmitted : %d", i);
// internally calls QIODevice::Write(...) returns -1 as error

Has anyone used QextSerialPort before to write on the serial port on Maemo 
device and does it works? Also, please suggest the possible reason for 
QIODevice returning error even when the port opens successfully?

Regards,
Suyash.

_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to