Hi,

I had the same issue, systemd configurations did not affect the order of ptpX devices. I use chrony however. My script is attached. It's not the cleanest or nicest code but it works. Hope you find some inspiration from that. Before chrony is started the script is executed via a ExecStartPre=/etc/chrony/change_ptp.py line in the service file.

br

Am 13.07.2022 um 15:33 schrieb Marco Davids (SIDN) via Linuxptp-users:
Hi,

Most of the time when I reboot this Linux server, ptp0 is connected to eno1:

ptp4l: [18.144] eno1 selected /dev/ptp0 as PTP clock

But sometimes this is ptp1, which is pretty annoying:

ptp4l: [18.745] eno1 selected /dev/ptp1 as PTP clock

Does anyone has a suggestion on how to prevent this and make the mapping between interface and ptp device more robust?





_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

#!/usr/bin/python3
import sys
import fileinput
import subprocess

cmd = "ethtool -T eth0 |grep 'PTP Hardware Clock'|cut -d':' -f2"
ps = 
subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
output = ps.communicate()[0]
ptp = int(output.strip())
print(ptp)

refclock = "refclock PHC /dev/ptp{}:extpps:nocrossts:pin=0 width 0.5 poll 0 
precision 1e-9 pps refid GPS prefer trust\n".format(ptp)
print(refclock)

for line in fileinput.input(["/etc/chrony/chrony.conf"], inplace=True):
    if "PHC" in line:
        print(refclock, end="")
    else:
        print(line, end="")

sys.exit(0)
_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to