Re: Reading from serial devices...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Matthew Percival <matthew@xxxxxxxxx>
> Date: Mar 9, 2006 8:39 PM
> Subject: Reading from serial devices...
> To: Kernel Newbies Mailing List <kernelnewbies@xxxxxxxxxxxx>
>
>
> G'Day,
>
>         I am writing a script (in Lua) to transmit to/read from a serial device
> (in this case, a GSM modem).  Whilst I have no difficulty with most
> normal aspects (eg transmit AT, read back OK), I seem unable to use the
> SMS properly.  As a brief description of what should happen, I transmit
> `AT+CMGS=(phone number)' and receive back a `> ' prompt to let me know
> it is ready for the message.  If I send that line and the message in
> interactive mode (waiting to see the `> ' appear in minicom before
> sending the message), then it works fine (so the basic concept seems to
> be right), but I cannot seem to script this.
>
>         If I try to read back from the device one character at a time (after
> sending the AT+CMGS line), I get two blanks then it blocks.  If I look
> on a terminal program, I can see that after I sent the command, there
> was a carriage return and a line feed, then on the next line was the >
> and (space) for the prompt.  This suggests to me that I am reading the
> CR and the LF, but it blocks when it tries to read the next line, which
> has no control characters terminating it (after all, it is a prompts).
>
>         My question, to anyone who knows the way the serial driver works, is:
> can I read back from the device a single character, or does the driver
> only buffer a complete line, defined as being 0 or more characters
> ending in a control character (or something like that)?  My observation
> seems to be that I can read anything that ends in a control character,
> but nothing that does not.
>
>         Thanks for your time,
>
>         Matthew


Hi Matthew,

What I know is that the serial drive works in "promiscous mode", I
mean, everything that comes to the serial driver is delivered to the
application.

Maybe what you are experiencing is a problem with the modem. Could you
tell me the softwares and hardwars you are working with? About the
modem, tell me too if you have its documentation.

I remembered another thing,,, a known problem is the treating of the
LINE FEED and CARRIAGE RETURN caracters. Modems should receive after
each command the 0x0d 0x0a caracters. Another problem can be the
serial speed and the modem speed (if it is not configured to the
autobaud mode).

Regards,
Luiz Normando <lnormando@xxxxxxxxxxx>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux