Hi
[TL/DR] Running a command from KUAL using pipes not as expected
I have a PI 3B+ running openwrt and four Amazon Kindle Paperwhite 1 Wi-Fi, I have v2.7.23-g9f3694a of KUAL installed, with USB networking. I can successfully transfer data between machines, by ssh into each machine and running scripts with the scripts and applications using netcat (aka nc).
I am trying to convert to an KUAL extension so finish the project and release. However I must be doing something wrong with piping.
Minimal working example from SSH - not KUAL
On a separate machine (running OpenWRT)
Code:
root@OpenWrt:~# mkfifo /tmp/example.pipe
root@OpenWrt:~# cat /tmp/example.pipe | netcat -l -vvv -p 5001 &
root@OpenWrt:~# Listening on any address 5001
Note: "Listening on any address 5001" is the verbose output of netcat
ssh onto Kindle
Code:
[root@kindle root]# nc 192.168.1.126 5001 | tee -i
On the OpenWrt machine, then issue an echo
Code:
root@OpenWrt:~# mkfifo /tmp/example.pipe
root@OpenWrt:~# cat /tmp/example.pipe | netcat -l -vvv -p 5001 &
root@OpenWrt:~# Listening on any address 5001
Connection from 192.168.1.105:47765
root@OpenWrt:~# echo "hi" >/tmp/example.pipe
root@OpenWrt:~#
On Kindle I get:-
Code:
[root@kindle root]# nc 192.168.1.126 5001 | tee -i
hi
Nb: Note pipe is still open and I can continue to send data from openwrt machine
Minimal working example Using KUAL
Now again using KUAL, using extension as:-
Code:
[root@kindle root]# cat /mnt/us/extensions/OkMonitor/menu.json
{
"items": [
{
"name": "NC Examples",
"priority": -998,
"items": [
{
"name": "nc example 1",
"action": "nc 192.168.1.126 5001 | tee -i ",
"internal": "Example"
}
]
}
]
}
[root@kindle root]#
Same commands
Code:
root@OpenWrt:~# mkfifo /tmp/example.pipe
root@OpenWrt:~# cat /tmp/example.pipe | netcat -l -vvv -p 5001 &
root@OpenWrt:~# Listening on any address 5001
Then Kindle: KUAL -> NC Examples -> nc example 1
Code:
root@OpenWrt:~# mkfifo /tmp/example.pipe
root@OpenWrt:~# cat /tmp/example.pipe | netcat -l -vvv -p 5001 &
root@OpenWrt:~# Listening on any address 5001
Connection from 192.168.1.105:59820
Total received bytes: 0
Total sent bytes: 0
In the second example nc sucessfully but then disconnects. I require nc to remain open. The only difference is that in the first example I running the command when conencted via ssh, the second via KUAL menu.
I need nc to pipe to a different compiled application, but using tee as the application in this examples.
Things I have tried:-
- openWRT difference option -c, -k
- openWRT difference version of netcat, nc, ncat
- From KUAL run a script the ssh localhost then trying to pipe
- From login -F root
- on Kindle tee -i in the pipe
- Pulling hair out and eating chocolate.
Any pointers would be great. Or any ideas how I can debug further.

Thanks,
Brendan