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_id
> 
> I am in doubts if it is a task for cron. Wouldn't udev rules be better?
> 
> https://stackoverflow.com/questions/442833/how-to-force-driver-to-device-match-in-linux/52943745#52943745
> https://unix.stackexchange.com/questions/67936/attaching-usb-serial-device-with-custom-pid-to-ttyusb0-on-embedded/165845#165845
> 
> Moreover, to load and configure modules there are /etc/modprobe.d/ and
> /etc/modules.
> 
> If it is a weird device that may appear either as 13b1:0039 (supported
> by brcmfmac accordingly to modinfo) and 13b1:0bdc, may it happen that
> it is possible to use e.g. usb-modeswitch to adjust which way the
> device tries to present itself?

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.

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

which tells me whether the hardware toggle switch on my ancient laptop
is actually unblocked (the switch's indicator lamp is unreliable) and
whether it's connected to the router, and how.

Cheers,
David.

Reply via email to