How would I set these options in LEDE that udev would take care of in traditional desktop linux:
# Create PPS device and set low_latency. Add udev rules.
# Create /etc/udev/rules.d/gps.rules.
KERNEL=="ttyS2", SYMLINK+="gps0"
KERNEL=="ttyS2", RUN+="/bin/setserial -v /dev/%k low_latency"
KERNEL=="ttyS2", RUN+="/usr/sbin/ldattach pps /dev/%k"
Where can I get older x86 binaries for setserial
and ldattach
?
These don't seem to be available via opkg anymore.
jow
2
I think the closest LEDE replacement would be a short shell script in /etc/hotplug.d/tty/
.
1 Like
Strykar
3
Do I have to do anything else to run the file at boot? It isn't being executed.
# ls -l /etc/hotplug.d/tty/00-ttyS2
-rwxr-xr-x 1 root root 337 Dec 15 18:47 /etc/hotplug.d/tty/00-ttyS2
# cat /etc/hotplug.d/tty/00-ttyS2
#!/bin/sh
_pid=/var/run/ntpd.pid
_uart=/dev/ttyS2
# only start on ifup
[ "$ACTION" = "ifup" ] || exit 0
/bin/setserial -v $_uart low_latency
/usr/sbin/ldattach 18 $_uart
/bin/ln -s $_uart /dev/gps0
/bin/ln -s /dev/pps3 /dev/gpspps0
/usr/bin/logger -p daemon.info -t "ntpd[$_pid]" "Enabling line discipine and low latency on '$_uart'"
# dmesg|grep pps
[ 2.780247] pps_core: LinuxPPS API ver. 1 registered
[ 2.785361] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 2.795342] pps_ldisc: PPS line discipline registered
[ 7.190629] pps pps0: new PPS source ptp0
[ 7.260291] pps pps1: new PPS source ptp1
[ 7.330244] pps pps2: new PPS source ptp2
Strykar
4
Thanks to jow on IRC, the solution is not $ACTION=ifup, it is "add". There is no ifup action for tty events.
# only start on add
[ "$ACTION" = "add" ] || exit 0
# dmesg|grep pps
[ 2.767867] pps_core: LinuxPPS API ver. 1 registered
[ 2.773036] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 2.783012] pps_ldisc: PPS line discipline registered
[ 6.343229] pps pps0: new PPS source serial2
[ 6.347591] pps pps0: source "/dev/ttyS2" added
[ 7.367938] pps pps1: new PPS source ptp0
[ 7.437780] pps pps2: new PPS source ptp1
[ 7.508117] pps pps3: new PPS source ptp2
Strykar
5
1 Like