Re: Blocking read() from a USB->Serial adapter.



Charles Sullivan <cwsulliv@xxxxxxxxxxxx> wrote:
A blocking read() of more than one character from an actual RS232 serial
port returns when the number of characters specified has been read.

Not necessarily true.

However I've found that a blocking read() of more than one character from
a USB->Serial adapter reads only the first character before returning and
I have to loop to read all the characters.

Which makes it the same as a regular port. There may well be timing
differences though, I don't know.

I've tried this with several different USB->Serial adapters with several
different Linux kernel versions, 2.4 and 2.6, all with the same result.

Is this a Linux bug, or is there something extra I need to do in setting
up the port in my code?

Post the code you use to configure your port. It isn't really
possible to know what should be happening without looking at
what your configuration is.


--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • Re: Serial COM port communication problems
    ... serial port. ... The receiving buffer is read by setting the mask to rx flag being the ... sub-packages arrive in succession and some sub-packages are lost. ... But this should not cause a loss of data, assuming you are reading the actual number of characters retured by WaitCommEvent. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: [PATCH: 2/2] [SERIAL] avoid stalling suspend if serial port wont drain
    ... prefer - the system being prevented from suspending and losing complete ... The only way you could do that on 8250 is to clear the RX FIFO, ... wait for the port to transmit all its characters into the RX ...
    (Linux-Kernel)
  • Sending string (of characters) to active window
    ... I wrote a simple program that reads the characters from external device ... For example, scanner sends 1234567 to serial port, ... Or is there some other way to send a string to the active window (I ... int InitComPort(const char *port); ...
    (comp.os.linux.development.apps)
  • Re: Custom app & Winlogon.exe fighting
    ... for the port and run data through it correctly but when it comes time ... the OnComm event when characters are received. ... Since you are reading the characters yourself, ... would be a problem if your App was meant to always 'listen'. ...
    (microsoft.public.vb.general.discussion)
  • Re: Finding a pattern in a stream?
    ... You would need to check each read to see if it contains the characters you ... RegEx allows you to find a pattern, ... > pass the data out the TCP port. ... >> my app to disconnect the telnet client. ...
    (microsoft.public.dotnet.languages.vb)