Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.embedded > #637

Re: When 0x0d become 0x0a

From Les Cargill <lcargill99@comcast.com>
Newsgroups comp.os.linux.embedded
Subject Re: When 0x0d become 0x0a
Date 2014-02-14 00:27 -0600
Organization A noiseless patient Spider
Message-ID <ldkcqp$8lo$1@dont-email.me> (permalink)
References <ldjodp$m47$1@dont-email.me> <FCeLu.435026$_n7.384776@fx20.iad>

Show all headers | View raw


Lew Pitcher wrote:
> On Thursday 13 February 2014 19:39, in comp.os.linux.embedded, "Les Cargill"
> <lcargill99@comcast.com> wrote:
>
>> I'm porting some code from one Linux to another. It uses serial ports.
>>
>> As opened, the serial port converts 0x0d characters to 0x0a characters.
>>
>> I have done some googling to find which *opts() functions control
>> setting the file referred to by the handle for the serial port
>> to be a pure, binary file. I see the one that turns off this conversion,
>> but I want all characters to be received completely untrammelled.
>>
>> I also need to use fopen()... fclose(), so ORed together last-argument
>> things in open() are out.
>
> I'm afraid that if you need such tight control of the serial-port data, you
> are probably going to have to work with low-level file I/O, at least a bit.
>
> Specifically, you are going to need the fd of your FILE * file

Not a problem - familiar with fileno(); I should have said as much;
there's some boilerplate stuff already in the code to set baud rate and
all using a return from fileno();

I've just never done the full, comprehensive study of all the serial 
port options in Linux.

I forget what it was that I ran into that forced the use of fopen()
rather than open().

> (use POSIX
> fileno(3) to retrieve), and either the termios(3) tcgetattr()/tcsetattr()
> calls, or the ioctl(2) tty calls. You want to change the line conditioning
> of your serial port from COOKED or CBREAK mode to RAW mode.
>
>
>> What's a good website that shows *all* the serial port options for Linux?
>
> Sorry, I can't help you there. I don't know of any website that shows all
> the serial port options for Linux.
>
> However, the tty_ioctl(4), ioctl(2), and termios(3) manpages should help
> you.
>

Excellent - those are a good start. Thanks!

> HTH
>

--
Les Cargill

Back to comp.os.linux.embedded | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

When 0x0d become 0x0a Les Cargill <lcargill99@comcast.com> - 2014-02-13 18:39 -0600
  Re: When 0x0d become 0x0a Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-02-13 20:49 -0500
    Re: When 0x0d become 0x0a Les Cargill <lcargill99@comcast.com> - 2014-02-14 00:27 -0600
  Re: When 0x0d become 0x0a Grant Edwards <invalid@invalid.invalid> - 2014-02-14 04:06 +0000
    Re: When 0x0d become 0x0a Les Cargill <lcargill99@comcast.com> - 2014-02-14 21:19 -0600
      Re: When 0x0d become 0x0a Grant Edwards <invalid@invalid.invalid> - 2014-02-15 04:31 +0000
        Re: When 0x0d become 0x0a Przemek Klosowski <przemek@tux.dot.org> - 2014-04-11 00:57 +0000
          Re: When 0x0d become 0x0a Les Cargill <lcargill99@comcast.com> - 2014-04-12 16:40 -0500
        Re: When 0x0d become 0x0a Les Cargill <lcargill99@comcast.com> - 2014-04-12 16:36 -0500
          Re: When 0x0d become 0x0a Grant Edwards <invalid@invalid.invalid> - 2014-04-14 16:46 +0000
            Re: When 0x0d become 0x0a Les Cargill <lcargill99@comcast.com> - 2014-04-14 12:48 -0500
              Re: When 0x0d become 0x0a Grant Edwards <invalid@invalid.invalid> - 2014-04-14 18:56 +0000
                Re: When 0x0d become 0x0a Les Cargill <lcargill99@comcast.com> - 2014-04-14 20:16 -0500
                Re: When 0x0d become 0x0a Grant Edwards <invalid@invalid.invalid> - 2014-04-15 15:15 +0000
  Re: When 0x0d become 0x0a David <no@spam.please> - 2014-02-14 13:13 +0000

csiph-web