On 29/02/2024 11:32, David Wright wrote:
On Wed 28 Feb 2024 at 22:32:57 (+0700), Max Nikulin wrote:On 28/02/2024 10:35, David Wright wrote:In which case, I'd write the remaining cron line as: @reboot sleep 99 && echo 13b1 0bdc > /sys/bus/usb/drivers/brcmfmac/new_idI am in doubts if it is a task for cron. Wouldn't udev rules be better?Those are fair questions. If the appearance of the brcmfmac/ directory is the sole precondition, then I would probably try udev. But I claim no knowledge about the module or any device connected with it.
The /sys/bus/usb/drivers/brcmfmac directory should appear when the module is loaded. Likely there is no point to load the module if the device is not plugged, thus udev should be better than /etc/modprobe.d.
Where cron/sleep is useful is where some device has to settle, or wait in some way, before the string is sent. One example I use is: @reboot sleep 15 && printf '\n' > /dev/tty1 && /usr/sbin/rfkill > /dev/tty1 && /usr/bin/ip a > /dev/tty1
I would consider a systemd single-shot service that runs after network.target. Instead of "sleep" I would try either nm-online or systemd-networkd-wait-online with timeout. I admit, in some cases they have no advantages over sleep.