OpenWrt Forum Archive

Topic: How to control wrt54gl serial from vb

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

I sucessful installed openwrt with ser2net to my Linksys WRT54GL.

I would like to use winsock from VB to control the serial of WRT54GL, but I don't know how to get start.

This is how my PC connect to the WRT54GL:
---------------                 ------------             ------------------------
| PC-RS232  |-----------|  MAX232  |---------|  SERIAL-WRT54GL  |
---------------                -------------             ------------------------

some of the configurations from WRT54GL:

vi /etc/init.d/setserial
START=15
boot() {
/usr/sbin/setserial /dev/tts/1 irq 3
/bin/stty -F /dev/tts/1 speed 9600 raw
/usr/sbin/ser2net -u &
}

vi /etc/ser2net.conf
# <TCP port>:<state>:<timeout>:<device>:<options>
1500:raw:3600:/dev/tts/1:9600 NONE 1STOPBIT 8DATABITS -XONXOFF LOCAL -RTSCTS

1. Run RealTerm (com1, baud rate:9600) & SSH (PuTTY)
2. When send data from SSH (echo xxx > /dev/tts/1), RealTerm is able to receive data
3. When send data from RealTerm, SSH (cat < /dev/tts/1) is able to receive data

I try to use socket programming from VB & Delphi 7, but failed to connect.

I found the solution myself. But it is not a fully solution.

Everytime the wrt54GL is restart, ser2net is not run at startup, instead I have to run ser2net manually from SSH.
Anybody know how to start the ser2net automatically?

For those who want to use the above Excel file (work with Oswinsck.dll), here is the solution:
Add remote port before socket connect. For my case, it is like this: Winsock1.RemotePort = 1500

Again I found the solution.
I put the ser2net to /etc/init.d/custom-user-startup

I'm very happy with OpenWrt

The discussion might have continued from here.