OpenWrt Forum Archive

Topic: Serial dev/tts/0

The content of this topic has been archived on 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I would like to use on a WRT54GL the Serial dev/tts/0 for a special application. dev/tts/1 is already in use for another application. Currently by default tts/0 is linked to the console.
What need to be done to achive tts/0 is available for general purpuses at least after booting?

too bad. Seems to be a big deal.
I assume need to compile a new kernel?
Any hints how to set up?

Hi, i've done the same thing two days ago in this way:
I've edited this file /etc/inittab
in this way :
#tts/0::askfirst:/bin/ash –login
#ttyS0::askfirst:/bin/ash –login

After the boot, the serial port is released from the O.S. in this way.
I use OpenWRT 7.09 on a Fonera.
Bye
Mbacicc

@Mbacicc
thanks a lot for the reply. That's exactly I'm looking for :-)
How do you control the parameters of the serial port tts/0?
With setserial? e.g. Baudrate?

felix

Now I've used it only for reflashing another Fonera big_smile....
I'm using minicom, but I think you can create your own C program to talk with the world big_smile
Bye
Mbacicc

Hello,

I have successfully installed a serial port on my wrt54g.
Everything seems to work fine since I can connect as root to the OpenWRT firmware from a laptop connected with the serial port.
Why I'm getting crazy?
because I cannot read any data coming from the laptop onto the serial port while handling the transmission with simple read and write functions..

fd = open("/dev/tts/0", O_RDWR | O_NOCTTY | O_NDELAY);
fcntl(fd, F_SETFL, FNDELAY);

    bufptr = buffer;
    while ((nbytes = read(fd, bufptr, sizeof(buffer))) > 0)
    {
          bufptr += nbytes;
          if (bufptr[-1] == '\n' || bufptr[-1] == '\r')
                    break;
    }

return bufptr;

for the transmission part from the laptop everything seems ok
if I look at the
proc/tty/driver/serial
I can see the rx byte counter which increase..

Where I'm wrong?

Thanks,
Mike

mikemike wrote:
fd = open("/dev/tts/0", O_RDWR | O_NOCTTY | O_NDELAY);
fcntl(fd, F_SETFL, FNDELAY);

    bufptr = buffer;
    while ((nbytes = read(fd, bufptr, sizeof(buffer))) > 0)
    {
          bufptr += nbytes;
          if (bufptr[-1] == '\n' || bufptr[-1] == '\r')
                    break;
    }

return bufptr;

Mike, have so anyhow solved your script above? I'm having the same issue, and would be really happy if you can share your solution.

Thanks,
Peter

The discussion might have continued from here.