What's new

NTP Daemon for ASUSWRT/Merlin

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

It seems to me that if NTP can change the USB-to-serial port speed, there ought to be another utility which can do the same thing.
My GPS receiver is on /dev/ttyUSB0 because my firmware's kernel configuration was changed to enable the FTDI usb-to-serial driver. AND, my u-blox GPS is locked at 9600 baud, and ntp.conf configured to match this locked linespeed. No external program was needed to stty the linespeed.

I don't know if /dev/ttyACM0 handles line speeds the same as /dev/ttyUSB0.
 
the ability for a full toolchain if one needs to compile code

Just for kicks - RPi on OpenWRT can be self hosting, e.g. build the entire OS that it runs on - that's the advantage of the Pi over Arduino...

Nothing against arduino - it's a great platform... and I support it - and we see other items getting into the same IDE - e.g. ESP8266 and similar, it's a win...

When one sees Pi Zero W at $10USD, it's an attractive platform...

A Pi2/Pi3 can do the same - and support hotel services outside of NTP and GPS...
 
See what version and which program it is.

ntpd --version

AND

which ntpd
login as: GoNz0


ASUSWRT-Merlin RT-AC68U 380.67-0 Sun Jul 16 16:56:04 UTC 2017
GoNz0@Router:/tmp/home/root# ntpd --version
ntpd 4.2.8p10@1.3728-o Tue May 30 22:11:21 UTC 2017 (1)
GoNz0@Router:/tmp/home/root# which ntpd
/opt/sbin/ntpd
GoNz0@Router:/tmp/home/root#

Since updating ntdp it seems to be working, I assume with your ntp.conf content it will only work if it is reading the GPS time?
 
For ntp...

Try the following... ntpq -p

Code:
sfx@raspy3:~ $ ntpq -p
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-4.144.155.104.b 216.239.35.4     2 u  183 1024  377   83.653  -12.253   1.001
+www.amsatfox.or 130.207.244.240  2 u  610 1024  377   97.978   -0.879   2.914
-smtp.visionnet. 216.229.0.179    2 u  757 1024  377   43.296    6.982   3.350
*x.ns.gin.ntt.ne 249.224.99.213   2 u  799 1024  377   21.666   -0.464   2.674
+alphyn.canonica 132.246.11.231   2 u  627 1024  377   82.694    2.425   0.688
 
Sadly my chipset is SiRF Star IV. Like I said, I cheaped out. Penny-wise, pound foolish. :(
Not at all, SiRFstar is a fine choice for GPS. I just happened to pick u-blox because I found one on eBay for $8.

SiRFstar supports NMEA and they have a proprietary binary protocol, similar to how u-blox supports NMEA and has its UBX binary protocol.

SiRFstar has software to configure the GPS chip. However, I don't know if your particular device has flash memory to save changes to your "locked down" settings.

https://www.falcom.de/uploads/media/Manual_SiRFDemo3.87.pdf

https://www.falcom.de/uploads/media/setupSiRFDemo3.87.zip
 
Last edited:
... with your ntp.conf content it will only work if it is reading the GPS time?
That's right. My ntp.conf is for GPS-only, no Internet time servers. You may add the synchronisation with Internet time servers to ntp.conf, just in case those GPS satellites go missing... you know what to do.
 
Not at all, SiRFstar is a fine choice for GPS. I just happened to pick u-blox because I found one on eBay for $8.

SiRFstar supports NMEA and they have a proprietary binary protocol, similar to how u-blox supports NMEA and has its UBX binary protocol.

SiRFstar has software to configure the GPS chip. However, I don't know if your particular device has flash memory to save changes to your "locked down" settings.

https://www.falcom.de/uploads/media/Manual_SiRFDemo3.87.pdf

https://www.falcom.de/uploads/media/setupSiRFDemo3.87.zip
It does not. :( According to the website it has a capacitor for holding configuration that lasts about 4 hours. So if I turn the router off if I go on vacation I'll have to remember to plug it back into my windows machine and reset it. Ah, well.
 
Meh. I used SiRFDemo, changed the GPS to 9600, connected it back to the router, even rebooted the router and ... nothing. 'cat /dev/ttyUSB0' just sits there. Double checked that the GPS didn't loose settings by plugging it back into the windows machine, and it is still set at 9600 baud.

Verified it's using NMEA sentences, not the proprietary protocol. Hrmmm. Wonder if it needs to be sent a start command?
 
I have no ttyACM0. ttyUSB0 exists. It just doesn't seem to be actually receiving data from the gps.
Code:
# dmesg | grep GSM
USB Serial support registered for GSM modem (1-port)
option 3-2:1.0: GSM modem (1-port) converter detected
usb 3-2: GSM modem (1-port) converter now attached to ttyUSB0
option: v0.7.2:USB Driver for GSM modems
 
It does not. :( According to the website it has a capacitor for holding configuration that lasts about 4 hours.
It appears that my $8 u-blox USB GPS has only 4-hour capacitor to back the RAM, too.
 
Code:
# dmesg | grep GSM
USB Serial support registered for GSM modem (1-port)
option 3-2:1.0: GSM modem (1-port) converter detected
usb 3-2: GSM modem (1-port) converter now attached to ttyUSB0
option: v0.7.2:USB Driver for GSM modems
I had to disable the Asus USB modem stuff, for my FTDI usb-to-serial converter.

/jffs/scripts/init-start
Code:
#!/bin/sh
deny_access() {
  local FILEPATH="$1"
  local FILENAME="$(/usr/bin/basename $FILEPATH)"
  local FILEEXT="${FILENAME##*.}"
  if [ "$FILEEXT" == "ko" ]; then
    local MODULENAME="${FILENAME%.*}"
    local FILEPATH="/lib/modules/$(/bin/uname -r)/$(/sbin/modprobe -l $MODULENAME)"
    if [ -f "$FILEPATH" ] && [ ! -h "$FILEPATH" ]; then
      /sbin/lsmod | /bin/grep -qF $MODULENAME && /sbin/modprobe -r $MODULENAME && /bin/sleep 1
      /bin/mount -o bind /dev/null "$FILEPATH"
    fi
  else
    if [ -f "$FILEPATH" ] && [ ! -h "$FILEPATH" ]; then
      [ -n "$(/bin/pidof $FILENAME)" ] && /usr/bin/killall $FILENAME && /bin/sleep 1
      /bin/mount -o bind /dev/null "$FILEPATH"
    fi
  fi
}

# disable automatic loading of USB modem drivers and programs
deny_access option.ko
deny_access usb_wwan.ko
deny_access drxvi314.ko
deny_access /usr/sbin/find_modem_node.sh
deny_access /usr/sbin/find_modem_type.sh
deny_access /usr/sbin/getrealip.sh
deny_access /usr/sbin/gobi_update.sh
deny_access /usr/sbin/modem_at.sh
deny_access /usr/sbin/modem_autoapn.sh
deny_access /usr/sbin/modem_enable.sh
deny_access /usr/sbin/modem_status.sh
deny_access /usr/sbin/modem_stop.sh
deny_access /usr/sbin/chat

# disable the Asus NTP CLIENT
[ -n "$(/bin/pidof ntp)" ] && /usr/bin/killall ntp && /bin/sleep 1
/bin/rm -f /var/run/ntp.pid
/bin/mkdir -p /var/run/ntp.pid
deny_access /usr/sbin/ntpclient
 
Last edited:
I had to disable the Asus USB modem stuff, for my FTDI usb-to-serial converter.

/jffs/scripts/init-start
Code:
#!/bin/sh
deny_access() {
  local FILEPATH="$1"
  if [ -f "$FILEPATH" ] && [ ! -h "$FILEPATH" ]; then
    /bin/mount -t devtmpfs | /bin/grep -qF "$FILEPATH"
    if [ $? -ne 0 ]; then
      FILENAME="${A##*/}"
      [ -n "$(/bin/pidof $FILENAME)" ] && /usr/bin/killall $FILENAME
      /bin/mount -o bind /dev/null "$FILEPATH"
    fi
  fi
}

# disable automatic loading of USB modem drivers and programs
/sbin/modprobe -r option
deny_access /lib/modules/2.6.36.4brcmarm/kernel/drivers/usb/option.ko
/sbin/modprobe -r usb_wwan
deny_access /lib/modules/2.6.36.4brcmarm/kernel/drivers/usb/usb_wwan.ko
/sbin/modprobe -r drxvi314
deny_access /lib/modules/2.6.36.4brcmarm/kernel/drivers/usb/Beceem_driver/drxvi314.ko
deny_access /usr/sbin/find_modem_node.sh
deny_access /usr/sbin/find_modem_type.sh
deny_access /usr/sbin/getrealip.sh
deny_access /usr/sbin/gobi_update.sh
deny_access /usr/sbin/modem_at.sh
deny_access /usr/sbin/modem_autoapn.sh
deny_access /usr/sbin/modem_enable.sh
deny_access /usr/sbin/modem_status.sh
deny_access /usr/sbin/modem_stop.sh
deny_access /usr/sbin/chat

# disable the Asus NTP CLIENT
deny_access /usr/sbin/ntpclient
Yeah, that was a big NOPE. It wasn't attached under /dev at all. I really do appreciate your help, you've given some places to look ... it shouldn't be this difficult.
 
That's right. My ntp.conf is for GPS-only, no Internet time servers. You may add the synchronisation with Internet time servers to ntp.conf, just in case those GPS satellites go missing... you know what to do.

Thanks again for the help :)


I will probably add the IP's back later in nTP.conf.

Code:
GoNz0@Router:/tmp/home/root# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*85.199.214.102  .GPS.            1 u   57   64  377   20.948   -0.664   1.272
-nx0.cospix.net  216.218.254.202  2 u 1519 1024  156  188.748  -14.455   1.294
+banzai.ruselabs 131.176.107.13   2 u  422 1024  377   22.775   -0.678   0.640
+85.199.214.99 ( .GPS.            1 u   35   64  377   23.015   -1.533   5.440

Looks good as the 1st lines pointing to GPS, any idea why I have other entries when NTP.conf is GPS only still?
The IP's above are not the same as the default ntp server in the administration page (0.uk.pool.ntp.org)
 
any idea why I have other entries when NTP.conf is GPS only still?
Here's me:
Code:
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oGPS_NMEA(0)     .GPS.            0 l    6   16  377    0.000   -0.238   0.057
 
Yeah, that was a big NOPE. It wasn't attached under /dev at all. I really do appreciate your help, you've given some places to look ... it shouldn't be this difficult.
Just plug the device into a regular computer w/ Ubuntu. Then, type dmesg. Your device could have a FTDI, CH341 or PL2303 USB-to-serial converter. This is not supported in AsusWRT. However, some have gotten it to work with libusb or libftdi, from Entware-ng.
 
Here's me:
Code:
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oGPS_NMEA(0)     .GPS.            0 l    6   16  377    0.000   -0.238   0.057
I rebooted again and now I have this
Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 host-87-242-168 .INIT.          16 u    -   64    0    0.000    0.000   0.000
+mail1.ugh.no    173.104.121.200  3 u   26   64    1   19.418    8.509  94.927
*5751b502.skybro 85.199.214.98    2 u   29   64    1   36.093    9.582  10.536
+lyla.preshweb.c 109.74.195.175   3 u   29   64    1   25.490    5.491  13.029
GoNz0@Router:/tmp/home/root#
in jffs/etc ntp.conf is configured as suggested.

and i'm stumped again, how the hell is it picking up servers it isn't configured for :(
 
... and i'm stumped again, how the hell is it picking up servers it isn't configured for :(
This may show which ntp.conf.

Code:
ps ww|grep ntpd
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top