<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=WordSection1>

<p class=MsoNormal>Hi,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>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.<br>
<br>
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.<br>
<br>
Port Settings &amp; open/ write calls (Code Snippet):<o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>port = new QextSerialPort(&quot;/dev/ttyS0&quot;);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>port-&gt;setBaudRate(BAUD9600);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>port-&gt;setFlowControl(FLOW_HARDWARE);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>port-&gt;setParity(PAR_NONE);&nbsp;&nbsp;&nbsp; <o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>port-&gt;setDataBits(DATA_8);&nbsp;&nbsp; <o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>port-&gt;setStopBits(STOP_1);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>//set timeouts to 500 ms<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>port-&gt;setTimeout(500);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'><o:p>&nbsp;</o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>port-&gt;open(QIODevice::ReadWrite | QIODevice::Unbuffered);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>// internally calls QFile-&gt;Open(..) as shown below and returs
success <o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>if
(Posix_File-&gt;open(QIODevice::ReadWrite|QIODevice::Unbuffered)) {<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>&nbsp; qDebug(&quot;Opened File succesfully&quot;);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>&nbsp; /*set open mode*/<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>&nbsp; QIODevice::open(mode);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'><o:p>&nbsp;</o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>int i =
port-&gt;write((message-&gt;text()).toAscii(),(message-&gt;text()).length());<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>qDebug(&quot;trasmitted : %d&quot;, i);<o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>// internally calls QIODevice::Write(...) returns -1 as error</span></i><span
lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";color:#3E3E3E'><o:p></o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>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?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>Regards,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN style='font-size:9.0pt;font-family:"Arial","sans-serif";
color:#3E3E3E'>Suyash.<o:p></o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>