OpenWrt Forum Archive

Topic: Use of /dev/tts/0

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

Has anyone been able to succesfully connect a serial device to  /dev/tts/0 ? If so what changes did you make to the system?

I have a serial modem that works fine on /dev/tts/1 but I get no response from /dev/tts/0.

Thanks for any help.

if you are using a default install, you're going to have a hard time connecting things to tts0 becasue thats what the kernel uses to spit out messages to all the time, as well as give you a serial console. you have to disable serial console in the menuconfig of the buildroot. if you dont know what that means, get the experiements source code (buildroot), go into its's dir, and type 'make menuconfig' without the 's. SOmewhere in there is an option for using a serial console, and probably 'output kernel messages to serial port (or serial console)' etc. disable those, and rebuild the kernel. then you should be able to use tts0

I have the experimental build and I have looked for those options in "make menuconfig".  Unfortunately, I can't find the options or they don't exist.  I was thinking along the same lines that tts/0 is already used.  Now its to find out how to disable it.

I found linux.config in openwrt/package/linux.  I removed "console=ttyS0,115200" from the CONFIG_CMDLINE variable and I also commented out "CONFIG_SERIAL_CONSOLE=y".  I recompiled  openwrt and it asked me if I wanted the serial console option and I specified no. After flashing the router and logging in to it, the console variable wasn't present in dmsg confirming that the changes where made.  However, I still can't use /dev/tts/0.  If I connect the router to a PC using a NULL cable, the PC can see the characters typed in microcom (on the router) but the router doesn't see the characters from the PC.  Again on port /dev/tts/1 everything is fine and characters can be seen both ways.  Any ideas why port /dev/tts/0 is behaving like this?

Hello ,
to use /dev/tts/0 you must tell the kernel not to open a console at this device and you must have installed the setserial
package .
Then login in your wrt -box and go to /etc
edit the file named inittab with vi , the interesting line in this file should look like this:
tts/0::askfirst:/bin/ash --login

you have to change this line ( comment it out ) , after your change ist should look like this :
#tts/0::askfirst:/bin/ash --login

save the changed inittab

reboot your wrt
Well now you have disabled the console on /dev/tts/0 and you can use this device for other things
And be sure that you have installed the setserial package
There MUST be a startscript /etc/init/d/S15serial
in the file you should find this :
#!/bin/sh
/usr/sbin/setserial /dev/tts/1 irq 3

This is very important , normally after boot the device /dev/tts/0 have the IRQ 0
if you have the setserial -package installed , the above script was aumatically installed and set the IRQ for
/dev/tts/0 to IRQ 3

Its not complicated to use  this device you must only comment out 1 line as described above in the inittab -file  and you must have installed the setserial package
And ... YES YOU HAVE NO SERIAL CONSOLE AFTER THIS MODIFICATION ...
This is , that only 1 process can use /dev/tts/0 .
AND AGAIN YES , YOU CAN SEE THE BOOT -MESSAGES DURING THE BOOT at 115200 baud ,8N1 .

This works for me here at a WRT54GS wit the lastest Experimental Version .

Thx a lot it worked out beautifully. I was really complicating my life for nothing.

The other serial port defaults to 9600 N81 (or so it seems) I have (so far) been able to talk to antoher pc with this, but cant seem to get a modem to understand (yes I ave my cables right)

usefull if you dont have setserial and microcom installed.

The discussion might have continued from here.