Kplex and Openwrt

323 views
Skip to first unread message

Pascal74

unread,
Mar 18, 2015, 9:37:05 AM3/18/15
to kp...@googlegroups.com
Hi Guys,

I installed Kplex (v. 1.1.1 many thanks to Caesar for his help). on Openwrt. 

My kplex.conf is very basic

#Multiplexer
[serial]
filename=ttyUSB0
baud=57600
direction=both

[tcp]
mode=server
direction=both
port=10110

Openwrt is installed on Arduino Yun.. 
My mux has not a Wifi port. So I used Arduino Yun to collect all NMEA data form the USB port (ttyUSB0) to send them using Wifi on Yun. I have not error using kplex but when I'm connect to the Wifi Arduino Yun I can't see my data.(to test that and try to see the data through the Wifi network I use Polarcom with tcp connection on my IP 192.168.240.1 on standard port (10110) but nothing displayed  :( )

Thanks for your help and tel me where I'm wrong.

Keith Young

unread,
Mar 19, 2015, 8:02:14 AM3/19/15
to kp...@googlegroups.com
The "filename" argument should be the full pathname of the device (I'm not familiar with OpenWRT but for "normal" linux it would be /dev/ttyUSB0.

Having said that, there should be an error (logged via syslog if you're running kplex as a daemon) if kplex can't open the device.

If you can connect to kplex via tcp  (i.e. "telnet 192.168.240.1 10110" connects but shows not data) the next step is just to confirm you can see data on your serial line: kill kplex then try "(stty 57600; cat ) < /dev/ttyUSB".

If you see data OK then we need to look harder at kplex.  If no data then perhaps there's a problem with the serial device.

Pascal74

unread,
Mar 19, 2015, 6:25:55 PM3/19/15
to kp...@googlegroups.com
Thanks a lot for your help I really appreciate it.


The "filename" argument should be the full pathname of the device (I'm not familiar with OpenWRT but for "normal" linux it would be /dev/ttyUSB0.
 
My kplex.conf is the standard kplex.conf and /dev/ttyUSB0 is the device that I use

Having said that, there should be an error (logged via syslog if you're running kplex as a daemon) if kplex can't open the device.
I've just installed syslog on openwrt. I have to look how to use it
 
If you can connect to kplex via tcp  (i.e. "telnet 192.168.240.1 10110" connects but shows not data)
When I try to connect using telnet 192.168.240.1 10110 I see that > Network error : Connection refused. I don't know what I have to do to solve that.
 
the next step is just to confirm you can see data on your serial line: kill kplex then try "(stty 57600; cat ) < /dev/ttyUSB".
 Due to the network error I think it's normal I can' see any data (if there are)


Keith Young

unread,
Mar 20, 2015, 7:10:13 AM3/20/15
to kp...@googlegroups.com

My kplex.conf is the standard kplex.conf and /dev/ttyUSB0 is the device that I use


If you're using /dev/ttyUSB0 then that should be the argument to "filename=" under the [serial] section.  Is that what you have or was what was in the original post here just a transcription error?
 
Having said that, there should be an error (logged via syslog if you're running kplex as a daemon) if kplex can't open the device.
I've just installed syslog on openwrt. I have to look how to use it

You might not need to install the "syslog" package.  Like many unix people I use the phrase "syslog" as a blanket term for the system logger.  Traditionally this was "syslog" but increasingly unix-like systems use more powerful system loggers like syslogng and rsyslog.  I would very much doubt that OpenWRT doesn't have a default system logger but my apologies: I am not familiar with OpenWRT to know what it uses.  kplex by default logs to LOG_DAEMON.  I'd grep for "kplex" in the files in /var/log.  Maybe one called "daemon" or "syslog" or "messages"?  Any OpenWRT aficionados reading?

 
If you can connect to kplex via tcp  (i.e. "telnet 192.168.240.1 10110" connects but shows not data)
When I try to connect using telnet 192.168.240.1 10110 I see that > Network error : Connection refused. I don't know what I have to do to solve that.


Well this suggests that  192.168.240.1  is reachable but there is nothing running on 10110.  Here's what I suggest.
1. How are you starting kplex?  The default install *installs* files but does't set them to start automatically at boot.
2. Is kplex running? (i.e. ps -e |grep kplex assuming OpenWRT is more linuxy than BSD-y)
3. If it is kill it.  Then start it on the command line (as a user with the appropriate permissions to access your serial device).  Just invoke "kplex".  When started on the command line, you'll see any errors in your terminal (rather than being sent to syslog)

Let's see how we go with that and take it form there...

Pascal74

unread,
Mar 20, 2015, 8:09:52 AM3/20/15
to kp...@googlegroups.com


Le vendredi 20 mars 2015 12:10:13 UTC+1, Keith Young a écrit :

My kplex.conf is the standard kplex.conf and /dev/ttyUSB0 is the device that I use


If you're using /dev/ttyUSB0 then that should be the argument to "filename=" under the [serial] section.  Is that what you have or was what was in the original post here just a transcription error?

This is my kplex.conf :

[serial]
filename=/dev/ttyUSB0
direction=both
baud=57600
[tcp]
mode=server
port=10110
direction=both

 
 
Having said that, there should be an error (logged via syslog if you're running kplex as a daemon) if kplex can't open the device.
I've just installed syslog on openwrt. I have to look how to use it

You might not need to install the "syslog" package.  Like many unix people I use the phrase "syslog" as a blanket term for the system logger.  Traditionally this was "syslog" but increasingly unix-like systems use more powerful system loggers like syslogng and rsyslog.  I would very much doubt that OpenWRT doesn't have a default system logger but my apologies: I am not familiar with OpenWRT to know what it uses.  kplex by default logs to LOG_DAEMON.  I'd grep for "kplex" in the files in /var/log.  Maybe one called "daemon" or "syslog" or "messages"?  Any OpenWRT aficionados reading?

 
If you can connect to kplex via tcp  (i.e. "telnet 192.168.240.1 10110" connects but shows not data)
When I try to connect using telnet 192.168.240.1 10110 I see that > Network error : Connection refused. I don't know what I have to do to solve that.


Well this suggests that  192.168.240.1  is reachable but there is nothing running on 10110.  Here's what I suggest.
1. How are you starting kplex?  The default install *installs* files but does't set them to start automatically at boot.
2. Is kplex running? (i.e. ps -e |grep kplex assuming OpenWRT is more linuxy than BSD-y)
3. If it is kill it.  Then start it on the command line (as a user with the appropriate permissions to access your serial device).  Just invoke "kplex".  When started on the command line, you'll see any errors in your terminal (rather than being sent to syslog)

As you can see below. Kplex is running under root user :
root@Nostress:/etc# ps |grep kplex
16779 root      1484 S    grep kplex
 
And to show you the result of your commande :  (stty 57600; cat ) < /dev/ttyUSB0 I can see my datas streamed  :
$WIMDA,,I,1018,B,27.71,C,,C,30.00,,,C,,T,,M,,N,,M*0C

$WIMDA,,I,1018,B,27.71,C,,C,30.00,,,C,,T,,M,,N,,M*0C

$WIMDA,,I,1018,B,27.71,C,,C,30.00,,,C,,T,,M,,N,,M*0C

$WIMDA,,I,1018,B,27.71,C,,C,30.00,,,C,,T,,M,,N,,M*0C

$WIMDA,,I,1018,B,27.71,C,,C,30.00,,,C,,T,,M,,N,,M*0C

$WIMDA,,I,1018,B,27.72,C,,C,30.00,,,C,,T,,M,,N,,M*0F

$WIMDA,,I,1018,B,27.71,C,,C,30.00,,,C,,T,,M,,N,,M*0C

$WIMDA,,I,1018,B,27.71,C,,C,30.00,,,C,,T,,M,,N,,M*0C



Keith Young

unread,
Mar 20, 2015, 8:59:51 AM3/20/15
to kp...@googlegroups.com
ok next steps. I'm assuming OpenWRT is pretty much linux (apologies if not).
check the network interfaces with "ifconfig -a"
check to see if kplex is actually listening on a tcp port: "netstat -f inet -an  | grep 10110"
If you *do* see something with LISTEN at the end of the line, try telnet to localhost 10110

Otherwise...kill kplex then restart it on the command line but add in output to the terminal:

kplex -d1 file:

This will use your kplex.conf  (the "-d1" will also confirm *which* kplex.conf is being used) but also add in io to/from the terminal ("file:")

If something is going wrong we should get an error from that

Pascal74

unread,
Mar 20, 2015, 9:28:59 AM3/20/15
to kp...@googlegroups.com

ok next steps. I'm assuming OpenWRT is pretty much linux (apologies if not).
It's seems to be :-)
 
check the network interfaces with "ifconfig -a"
check to see if kplex is actually listening on a tcp port: "netstat -f inet -an  | grep 10110"
If you *do* see something with LISTEN at the end of the line, try telnet to localhost 10110
-f doesn't exist for command netstat so I modify to -a (all socket) and I have this result :
root@Nostress:/tmp# netstat -a inet -an  | grep 10110
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory

Whe I try only netstat to see all. 
root@Nostress:/tmp# netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 Nostress.lan:ssh        Bureau.lan:57682        ESTABLISHED
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ]         DGRAM                      2009 /tmp/triggerhappy.socket
unix  6      [ ]         DGRAM                       762 /dev/log
unix  2      [ ]         DGRAM                      1531 /var/run/hostapd-phy0/wlan0
unix  3      [ ]         STREAM     CONNECTED     130555 /dev/log
unix  3      [ ]         STREAM     CONNECTED     130554
unix  3      [ ]         STREAM     CONNECTED       1989 /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED       1988
unix  3      [ ]         STREAM     CONNECTED       1981 /dev/log
unix  3      [ ]         STREAM     CONNECTED       1980
unix  3      [ ]         STREAM     CONNECTED       1953 /dev/log
unix  3      [ ]         STREAM     CONNECTED       1952
unix  3      [ ]         STREAM     CONNECTED       1886
unix  3      [ ]         STREAM     CONNECTED       1885
unix  2      [ ]         DGRAM                      1809
unix  2      [ ]         DGRAM                      1762
unix  2      [ ]         DGRAM                      1328
unix  2      [ ]         DGRAM                      1039
unix  2      [ ]         DGRAM                      1030
unix  3      [ ]         STREAM     CONNECTED       1028 /var/run/ubus.sock
unix  3      [ ]         STREAM     CONNECTED       1027
 
There is no LISTEN TCP socket.
 
Otherwise...kill kplex then restart it on the command line but add in output to the terminal:
kplex -d1 file:

This will use your kplex.conf  (the "-d1" will also confirm *which* kplex.conf is being used) but also add in io to/from the terminal ("file:")

This last command line give this result : 
root@Nostress:/tmp# kplex -d1 file:
kplex DEBUG: Using config file /etc/kplex.conf
$WIMDA,,I,1017,B,27.42,C,,C,30.00,,,C,,T,,M,,N,,M*03
$WIMDA,,I,1018,B,27.45,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1017,B,27.44,C,,C,30.00,,,C,,T,,M,,N,,M*05
$WIMDA,,I,1017,B,27.45,C,,C,30.00,,,C,,T,,M,,N,,M*04
$WIMDA,,I,1018,B,27.44,C,,C,30.00,,,C,,T,,M,,N,,M*0A
$WIMDA,,I,1017,B,27.44,C,,C,30.00,,,C,,T,,M,,N,,M*05
$WIMDA,,I,1017,B,27.44,C,,C,30.00,,,C,,T,,M,,N,,M*05
$WIMDA,,I,1018,B,27.44,C,,C,30.00,,,C,,T,,M,,N,,M*0A
$WIMDA,,I,1018,B,27.44,C,,C,30.00,,,C,,T,,M,,N,,M*0A
$WIMDA,,I,1017,B,27.44,C,,C,30.00,,,C,,T,,M,,N,,M*05
$WIMDA,,I,1018,B,27.44,C,,C,30.00,,,C,,T,,M,,N,,M*0A
The kplex.conf is the right file conf.  

Keith Young

unread,
Mar 20, 2015, 12:14:24 PM3/20/15
to kp...@googlegroups.com
Sorry. "-f inet" is another bsd/os x. Should have been:
netstat --inet -an
Can you connect to this system with kplex running and in another window type:
netstat --inet -an
...without the grep I suggested previously?

What we've proved is that kplex is running and getting data from the serial line. The question is what is happening to the tcp server.  kplex should give an error if an interface cannot start or dies, but we see none here. My only thought is that somehow kplex is running on the wrong port (endian issue I haven't encountered on arm or intel?). Your (second) netstat with no arguments wouldn't list servers hence why I ask again.

If you could attach a copy of the actual file that might help: What you've posted looks fine but it might be helpful to test here with the exact same file in case of some issue with non-printing characters (again: should be none: errors should be reported if the file is not parsed correctly)

Pascal74

unread,
Mar 20, 2015, 12:32:27 PM3/20/15
to kp...@googlegroups.com


Le vendredi 20 mars 2015 17:14:24 UTC+1, Keith Young a écrit :
Sorry. "-f inet" is another bsd/os x. Should have been:
netstat --inet -an
Can you connect to this system with kplex running and in another window type:
netstat --inet -an
...without the grep I suggested previously?
 
This is the result 
root@Nostress:/tmp# netstat --inet -an
netstat: unrecognized option `--inet'
BusyBox v1.19.4 (2014-11-13 19:03:47 CET) multi-call binary.

Usage: netstat [-ral] [-tuwx] [-enWp]

Display networking information

        -r      Routing table
        -a      All sockets
        -l      Listening sockets
                Else: connected sockets
        -t      TCP sockets
        -u      UDP sockets
        -w      Raw sockets
        -x      Unix sockets
                Else: all socket types
        -e      Other/more information
        -n      Don't resolve names
        -W      Wide display
        -p      Show PID/program name for sockets

So I do that : 
root@Nostress:/# netstat -al -t -enWp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address                                       Foreign Address                                     State       PID/Program name
tcp        0      0 0.0.0.0:80                                          0.0.0.0:*                                           LISTEN      1408/uhttpd
tcp        0      0 127.0.0.1:53                                        0.0.0.0:*                                           LISTEN      1447/dnsmasq
tcp        0      0 192.168.240.1:53                                    0.0.0.0:*                                           LISTEN      1447/dnsmasq
tcp        0      0 0.0.0.0:22                                          0.0.0.0:*                                           LISTEN      1397/dropbear
tcp        0      0 0.0.0.0:443                                         0.0.0.0:*                                           LISTEN      1408/uhttpd
tcp        0      0 192.168.240.1:22                                    192.168.240.132:57682                               ESTABLISHED 17858/dropbear
netstat: /proc/net/tcp6: No such file or directory

It's seem there is no listining port on 10110


If you could attach a copy of the actual file that might help: What you've posted looks fine but it might be helpful to test here with the exact same file in case of some issue with non-printing characters (again: should be none: errors should be reported if the file is not parsed correctly)
Sorry, which file do you want ? nmea file which contain sentence nmea ($WIMDA) ? How can I collect data in file (sorry for my misunderstand) 

Keith Young

unread,
Mar 20, 2015, 12:49:50 PM3/20/15
to kp...@googlegroups.com

Ah. OK that's busybox rather than the standard linux netstat.  But yes we have the info: as you say: nothing there.

The file I was after was /etc/kplex.conf as an attachment rather than cut and paste. I'm going to test with the exact file.  But this is a long shot: what you pasted looks fine.


Pascal74

unread,
Mar 20, 2015, 1:14:28 PM3/20/15
to kp...@googlegroups.com
The file I was after was /etc/kplex.conf as an attachment rather than cut and paste. I'm going to test with the exact file.  But this is a long shot: what you pasted looks fine.

Please find in attachment my kplex.conf (it's the standar file).
I have juste uncomment the # at the beginning of lines from [serial] to the last line for the section [tcp].

 
kplex.conf

Keith Young

unread,
Mar 20, 2015, 2:40:31 PM3/20/15
to kp...@googlegroups.com
As suspected: nothing wrong with that file.

This may be something platform-specific as I can't recreate this on an intel linux system or raspberry pi.

Do you have the possibility of recompiling if I give you a changed source file with some debugging statements in?

Meantime have a look at any log files that you may have in /var/log (maybe "messages" or "syslog"? again: apologies for a lack of familiarity with OpenWRT).  See if there is any clue there.

Pascal74

unread,
Mar 20, 2015, 3:38:38 PM3/20/15
to kp...@googlegroups.com
This may be something platform-specific as I can't recreate this on an intel linux system or raspberry pi.
Hope Caesar will can help me when he will be availlable. It's not a raspberry pi but an Arduino Yun.
 
Do you have the possibility of recompiling if I give you a changed source file with some debugging statements in?
I never compiled under Linux I can try to do. I will install a VM player with an iso file of Openwrt 
 
Meantime have a look at any log files that you may have in /var/log (maybe "messages" or "syslog"? again: apologies for a lack of familiarity with OpenWRT).  See if there is any clue there.
The messages log countain that (don't know if it can help) 
Sep  8 17:45:28 Nostress syslog-ng[1400]: syslog-ng starting up; version='3.0.5'
Sep  8 17:45:32 Nostress dnsmasq: DNS rebinding protection is active, will discard upstream RFC1918 responses!
Sep  8 17:45:32 Nostress dnsmasq: Allowing 127.0.0.0/8 responses
Sep  8 17:45:36 Nostress dnsmasq[1446]: started, version 2.66 cachesize 150
Sep  8 17:45:36 Nostress dnsmasq[1446]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth
Sep  8 17:45:36 Nostress dnsmasq-dhcp[1446]: DHCP, IP range 192.168.240.100 -- 192.168.240.249, lease time 12h
Sep  8 17:45:36 Nostress dnsmasq[1446]: using local addresses only for domain lan
Sep  8 17:45:36 Nostress dnsmasq[1446]: no servers found in /tmp/resolv.conf.auto, will retry
Sep  8 17:45:36 Nostress dnsmasq[1446]: read /etc/hosts - 1 addresses
Sep  8 17:45:36 Nostress dnsmasq-dhcp[1446]: read /etc/ethers - 0 addresses
Sep  8 17:45:36 Nostress avahi-daemon[1452]: Found user 'nobody' (UID 65534) and group 'nogroup' (GID 65534).
Sep  8 17:45:36 Nostress avahi-daemon[1452]: Successfully dropped root privileges.
Sep  8 17:45:36 Nostress avahi-daemon[1452]: avahi-daemon 0.6.31 starting up.
Sep  8 17:45:36 Nostress avahi-daemon[1452]: WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
Sep  8 17:45:36 Nostress avahi-daemon[1452]: Loading service file /etc/avahi/services/arduino.service.
Sep  8 17:45:36 Nostress avahi-daemon[1452]: Loading service file /etc/avahi/services/ssh.service.
Sep  8 17:45:36 Nostress avahi-daemon[1452]: Joining mDNS multicast group on interface wlan0.IPv4 with address 192.168.240.1.
Sep  8 17:45:36 Nostress avahi-daemon[1452]: New relevant interface wlan0.IPv4 for mDNS.
Sep  8 17:45:36 Nostress avahi-daemon[1452]: Network interface enumeration completed.
Sep  8 17:45:36 Nostress avahi-daemon[1452]: Registering new address record for 192.168.240.1 on wlan0.IPv4.
Sep  8 17:45:36 Nostress avahi-daemon[1452]: Registering HINFO record with values 'MIPS'/'LINUX'.
Sep  8 17:45:37 Nostress kernel: [   69.680000] usbcore: deregistering interface driver ftdi_sio
Sep  8 17:45:37 Nostress kernel: [   69.680000] USB Serial deregistering driver FTDI USB Serial Device
Sep  8 17:45:37 Nostress avahi-daemon[1452]: Server startup complete. Host name is Nostress.local. Local service cookie is 4210745208.
Sep  8 17:45:38 Nostress avahi-daemon[1452]: Service "Secure Shell on Nostress" (/etc/avahi/services/ssh.service) successfully established.
Sep  8 17:45:38 Nostress avahi-daemon[1452]: Service "Nostress" (/etc/avahi/services/arduino.service) successfully established.
Sep  8 17:48:22 Nostress init: starting pid 572, tty '/dev/ttyATH0': '/bin/ash --login'
 

Keith Young

unread,
Mar 20, 2015, 3:52:36 PM3/20/15
to kp...@googlegroups.com

This may be something platform-specific as I can't recreate this on an intel linux system or raspberry pi.
Hope Caesar will can help me when he will be availlable. It's not a raspberry pi but an Arduino Yun.

 Yes I noted the Yun part, but the pi and intel are all I currently have here to test on.

There was nothing untoward in your messages file, but it was only 3 minutes' worth.  But we didn't see any error messages when you started it in the foreground, so I wasn't expecting errors in the log file.

One more thing to try: try the whole thing on the command line, ignoring the config file.  Should that make a difference? No but maybe we'll find a clue
kill the running kplex
invoke kplex as root as follows. "-f-" means ignore the config file. "direction=both" and "port=10110" are defaults so you don;t really need to specify them:
kplex -f- serial:filename=/dev/ttyUSB0,baud=57600 tcp:mode=server
In another window try:
telnet localhost 10110

Pascal74

unread,
Mar 20, 2015, 4:22:35 PM3/20/15
to kp...@googlegroups.com

There was nothing untoward in your messages file, but it was only 3 minutes' worth.  But we didn't see any error messages when you started it in the foreground, so I wasn't expecting errors in the log file.

One more thing to try: try the whole thing on the command line, ignoring the config file.  Should that make a difference? No but maybe we'll find a clue
kill the running kplex
invoke kplex as root as follows. "-f-" means ignore the config file. "direction=both" and "port=10110" are defaults so you don;t really need to specify them:
kplex -f- serial:filename=/dev/ttyUSB0,baud=57600 tcp:mode=server
In another window try:
telnet localhost 10110

I'v just tried to connect using telnet localhost 10110 and I can see the stream datas
$WIMDA,,I,1018,B,22.26,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1018,B,22.24,C,,C,30.00,,,C,,T,,M,,N,,M*09
$WIMDA,,I,1018,B,22.26,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1018,B,22.26,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1018,B,22.26,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1018,B,22.26,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1018,B,22.27,C,,C,30.00,,,C,,T,,M,,N,,M*0A
$WIMDA,,I,1018,B,22.26,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1018,B,22.27,C,,C,30.00,,,C,,T,,M,,N,,M*0A
$WIMDA,,I,1018,B,22.26,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1018,B,22.27,C,,C,30.00,,,C,,T,,M,,N,,M*0A
$WIMDA,,I,1018,B,22.26,C,,C,30.00,,,C,,T,,M,,N,,M*0B
$WIMDA,,I,1018,B,22.27,C,,C,30.00,,,C,,T,,M,,N,,M*0A
$WIMDA,,I,1018,B,22.27,C,,C,30.00,,,C,,T,,M,,N,,M*0A
$WIMDA,,I,1018,B,22.25,C,,C,30.00,,,C,,T,,M,,N,,M*08
$WIMDA,,I,1018,B,22.27,C,,C,30.00,,,C,,T,,M,,N,,M*0A
 

Pascal74

unread,
Mar 20, 2015, 4:39:10 PM3/20/15
to kp...@googlegroups.com
invoke kplex as root as follows. "-f-" means ignore the config file. "direction=both" and "port=10110" are defaults so you don;t really need to specify them:
kplex -f- serial:filename=/dev/ttyUSB0,baud=57600 tcp:mode=server

When I launch kplex with your commande line it works !

How to do to do the same without having to automatize this (start kplex automaticaly when the Arduino switch on ?)


 

Keith Young

unread,
Mar 20, 2015, 4:49:43 PM3/20/15
to kp...@googlegroups.com

When I launch kplex with your commande line it works !

Yes but it *should* work using the config file! I have no idea why that is not working and need to figure it out. If this works from the command line then the answer is probably something simple...

How to do to do the same without having to automatize this (start kplex automaticaly when the Arduino switch on ?)
I can investigate this myself but it will be quicker if you tell me....What system  does OpenWRT use for starting on boot?  Do debian-style init scripts work?  If so and if you're using the default init script bundled with the kplex source you can just delete the section starting [tcp] in the config file and append the following to the invocation line in the init script:
tcp:mode=server
But this shouldn't be necessary.  I will try and find somewhere with some good bandwidth over the weekend to download openwrt and build a vm and mage then I can help more.

Pascal74

unread,
Mar 20, 2015, 5:27:40 PM3/20/15
to kp...@googlegroups.com
My Arduino Yun is using this version : http://forum.arduino.cc/index.php?topic=279008.0 hope it will help you

This is the detail at the boot :
## Booting image at 9fea0000 ...
   Image Name:   MIPS OpenWrt Linux-3.3.8
   Created:      2014-11-14   8:00:46 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1185448 Bytes =  1.1 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9fea0040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 3.3.8 (jenkins@jenkins) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Fri Nov 14 08:57:34 CET 2014
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00004000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00004000
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  board=Yun console=ttyATH0,250000 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 60936k/65536k available (2565k kernel code, 4600k reserved, 650k data, 180k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 512
[    0.080000] NET: Registered protocol family 16
[    0.090000] gpiochip_add: registered GPIOs 0 to 29 on device: ath79
[    0.090000] MIPS: machine is Arduino Yun
[    0.530000] Setting DogStick2 GPIO
[    0.550000] bio: create slab <bio-0> at 0
[    0.550000] SCSI subsystem initialized
[    0.560000] usbcore: registered new interface driver usbfs
[    0.560000] usbcore: registered new interface driver hub
[    0.560000] usbcore: registered new device driver usb
[    0.570000] Switching to clocksource MIPS
[    0.570000] NET: Registered protocol family 2
[    0.570000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.580000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.580000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.580000] TCP: Hash tables configured (established 2048 bind 2048)
[    0.580000] TCP reno registered
[    0.580000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.590000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.590000] NET: Registered protocol family 1
[    0.610000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.610000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.620000] msgmni has been set to 119
[    0.620000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[    0.620000] io scheduler noop registered
[    0.630000] io scheduler deadline registered (default)
[    0.630000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.640000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) i{ a AR933X UART
[    0.640000] console [ttyATH0] enabled, bootconsole disabled
[    0.640000] console [ttyATH0] enabled, bootconsole disabled
[    0.650000] m25p80 spi0.0: found w25q128, expected m25p80
[    0.650000] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.650000] 7 cmdlinepart partitions found on MTD device spi0.0
[    0.660000] Creating 7 MTD partitions on "spi0.0":
[    0.660000] 0x000000000000-0x000000040000 : "u-boot"
[    0.660000] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.670000] 0x000000050000-0x000000ea0000 : "rootfs"
[    0.670000] mtd: partition "rootfs" set to be root filesystem
[    0.670000] mtd: partition "rootfs_data" created automatically, ofs=7B0000, len=6F0000
[    0.680000] 0x0000007b0000-0x000000ea0000 : "rootfs_data"
[    0.680000] 0x000000ea0000-0x000000fe0000 : "kernel"
[    0.680000] 0x000000fe0000-0x000000ff0000 : "nvram"
[    0.690000] 0x000000ff0000-0x000001000000 : "art"
[    0.690000] 0x000000050000-0x000000fe0000 : "firmware"
[    0.710000] ag71xx_mdio: probed
[    0.720000] eth0: Atheros AG71xx at 0xba000000, irq 5
[    1.270000] eth0: Found an AR7240/AR9330 built-in switch
[    2.300000] eth1: Atheros AG71xx at 0xb9000000, irq 4
[    2.850000] ag71xx ag71xx.0: eth1: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Generic PHY]
[    2.850000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.850000] ehci-platform ehci-platform: Generic Platform EHCI Controller
[    2.860000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[    2.890000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    2.910000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    2.910000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    2.910000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.910000] usb usb1: Product: Generic Platform EHCI Controller
[    2.920000] usb usb1: Manufacturer: Linux 3.3.8 ehci_hcd
[    2.920000] usb usb1: SerialNumber: ehci-platform
[    2.920000] hub 1-0:1.0: USB hub found
[    2.920000] hub 1-0:1.0: 1 port detected
[    2.930000] Initializing USB Mass Storage driver...
[    2.930000] usbcore: registered new interface driver usb-storage
[    2.930000] USB Mass Storage support registered.
[    2.930000] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[    2.940000] sdhci: Secure Digital Host Controller Interface driver
[    2.940000] sdhci: Copyright(c) Pierre Ossman
[    2.940000] usbcore: registered new interface driver ushc
[    2.940000] TCP cubic registered
[    2.950000] NET: Registered protocol family 17
[    2.950000] Bridge firewalling registered
[    2.950000] 8021q: 802.1Q VLAN Support v1.8
[    2.960000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    2.960000] Freeing unused kernel memory: 180k freed
[    3.260000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    3.460000] usb 1-1: New USB device found, idVendor=058f, idProduct=6254
[    3.460000] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    3.470000] usb 1-1: Product: USB2.0Hub
[    3.550000] hub 1-1:1.0: USB hub found
[    3.550000] hub 1-1:1.0: 4 ports detected
[    3.990000] usb 1-1.1: new full-speed USB device number 3 using ehci-platform
[    4.160000] usb 1-1.1: New USB device found, idVendor=0403, idProduct=fd49
[    4.170000] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.170000] usb 1-1.1: Product: ShipModul MiniPlex-2USB
[    4.170000] usb 1-1.1: Manufacturer: CustomWare
[    4.170000] usb 1-1.1: SerialNumber: 21001659
[    4.340000] usb 1-1.4: new high-speed USB device number 4 using ehci-platform
[    4.470000] usb 1-1.4: New USB device found, idVendor=058f, idProduct=6366
[    4.470000] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.470000] usb 1-1.4: Product: Mass Storage Device
[    4.480000] usb 1-1.4: Manufacturer: Generic
[    4.480000] usb 1-1.4: SerialNumber: 058F0O1111B1
[    4.520000] scsi0 : usb-storage 1-1.4:1.0
[    5.040000] Error: Driver 'gpio-keys-polled' is already registered, aborting...
[    5.520000] scsi 0:0:0:0: Direct-Access     Multi    Flash Reader     1.00 PQ: 0 ANSI: 0
- preinit -
Press the [f] key and hit [enter] to enter failsafe mode
- regular preinit -
[    9.630000] JFFS2 notice: (526) jffs2_build_xattr_subsystem: complete building xattr subsystem, 4 of xdatum (1 unchecked, 3 orphan) and 61 of xref (0 dead, 50 orphan) found.
[   10.820000] sd 0:0:0:0: [sda] Attached SCSI removable disk
switching to jffs2
- init -

Please press Enter to activate this console.


 

Pascal74

unread,
Mar 20, 2015, 5:55:13 PM3/20/15
to kp...@googlegroups.com
I continue my test and see that :

At this time I have to connect to my Arduino Yun using ssh and start a script manual (this script is executable and contain your command line : kplex -f- serial:filename=/dev/ttyUSB0,baud=57600 tcp:mode=server)

During all the ssh connection, kplex send data through tcp (after start script manually). But if i close my ssh connection, I loose the datas stream on tcp ! To continue to receive them, I have to keep active the ssh connection.

Keith Young

unread,
Mar 20, 2015, 6:17:17 PM3/20/15
to kp...@googlegroups.com

During all the ssh connection, kplex send data through tcp (after start script manually). But if i close my ssh connection, I loose the datas stream on tcp ! To continue to receive them, I have to keep active the ssh connection.

You can get round that by adding "-o mode=background" to that command line.  This will detach from the controlling terminal and run kplex as a daemon.  We still need to figure out why the config file tcp connection does work

Pascal74

unread,
Mar 20, 2015, 7:35:43 PM3/20/15
to kp...@googlegroups.com
So nice, I'm so happy with this option "-o mode=background"

I just have to find how to start my script automaticaly when I boot or reboot my Arduino Yun and all will be good.

Pascal74

unread,
Mar 20, 2015, 7:56:11 PM3/20/15
to kp...@googlegroups.com
We were near the goal. So I continue my test and I finiched to find my a solution to the last problem.

With Openwrt there is a file /etc/rc.local which contain a section to put a my command line to start my script. I've just to reboot my Arduino Yun and automaticaly (without needed ssh connection) I received data on my other laptop through TCP.

I want to say I have mutch appreciate your precious help.

Just last thing about OpenWrt, I had download packages ( coreutils to use stty on OpenWrt) here : http://downloads.arduino.cc/openwrtyun/1/packages/
As you will see it's for a processor ar71xx (the same as Caesar is using).

I don't know if I will try to do it but, I really want to try to compil myself your fresh kplex version from source. If you try to do it. I will appreciate, a last time, your help

Many, many thanks Keith :-)

Pascal74

unread,
Mar 20, 2015, 8:13:55 PM3/20/15
to kp...@googlegroups.com
The only version available I have, is coming from Ceasar. He sent me kplex_1.1.1-1_ar71xx.ipk (in attachment).
I can see you have a new one. I hope I will upgrade it.
kplex_1.1.1-1_ar71xx.ipk

Keith Young

unread,
Mar 21, 2015, 3:19:19 PM3/21/15
to kp...@googlegroups.com
Glad this is working but it still doesn't explain what the problem is with using the tcp stanza in the configuration file.  The newer 1.2 or the 1.3beta should't really change the war kplex deals with its configuration file.

I don't really have the facilities to run the atheros build of OpenWRT but I will try to run up the intel version in a virtual machine: might be a few days though

Pascal74

unread,
Mar 23, 2015, 4:17:20 AM3/23/15
to kp...@googlegroups.com
Hi Keith,

Just a quick question about Kplex :
When I unplug the source of data (/dev/ttyUSB0) and I replug it, my Arduino Yun detect it again but Kplex seems to don't see it. Due to this issue, datas are not available on TCP. 
I don't understand why because Kplex is runing like a daemon. 

Have you got any idea ?

Best regards
Pascal

Keith Young

unread,
Mar 23, 2015, 7:32:14 AM3/23/15
to kp...@googlegroups.com

I don't understand why because Kplex is runing like a daemon. 

Have you got any idea ?

Yes: When you unplug the USB device it disappears as far as Linux is concerned.  kplex will receive an error trying to read from it and will stop trying and close that serial interface.  The solution (currently) is to re-start kplex after you have re-insterted the device.  The question is how that can be automated.  With Linux distributions which support udev  you can write a udev rule to re-start kplex when a usb serial device is inserted.  A quick search suggests that OpenWRT uses hotplug2 which I believe is similar (you can write a script to be called when a device is inserted).

Having kplex poll hot-pluggable serial devices which are not present or have been removed has been requested before.  I don't especially like the idea (I don't like polling) but if several people want it it's probably worth looking at.

Pascal74

unread,
Mar 23, 2015, 8:19:37 AM3/23/15
to kp...@googlegroups.com
I don't know udev. I've just looking it. Thanks for that information. I will try to use it with OpenWrt. I think it's a good option.

Keith Young

unread,
Mar 23, 2015, 10:00:36 AM3/23/15
to kp...@googlegroups.com

I don't know udev. I've just looking it. Thanks for that information. I will try to use it with OpenWrt. I think it's a good option.

I think OpenWRT uses hotplug2 instead of udev: it's a similar idea but ( I think ) more lightweight. Do check what your system uses before investing too much effort! 

Pascal74

unread,
Mar 23, 2015, 10:24:08 AM3/23/15
to kp...@googlegroups.com
At midday I installed the udev package for OpenWrt (udev_173-1_ar71xx.ipk). I'm writing a rules to recocnize automaticaly the multiplexer and to assigne it a symbol link and start kplex

I have not tested the rules (i will test it next weekend on board)

This rule is :
KERNEL=="ttyUSB[0-9]", DRIVER=="ftdi_sio", ATTR{vendor}==”0x0403”, ATTR{product}=”0xfd49” SYMLINK+="multiplexer", RUN+="/etc/nostresswifi"

I use some option like [0-9] to learn udev and his rules. For my case there is only 1 usb port so 'ttyUSB0' is sufficient
Reply all
Reply to author
Forward
0 new messages