usb_modeswitch module and folder access rights

  • Hi,

    My LibreELEC box has a built in 2.4Ghz wifi and a external usb 5Ghz wifi (COMFAST CF-WU785AC USB WiFi adapter).

    I followed this guide on github and performed usb mode switch (It worked and wlan1 showed up).

    However I cannot set it to run automatically because both /usr/lib/udev/rules.d and /usr/share are read only.

    How do I proceed?

    Also, is there a way to give priority to wlan1 (or set it as the default interface)? I want to use wlan1 when it is available.

    (or I can disable wlan0, but this is less preferred)

  • Code
    cp /usr/lib/udev/rules.d/40-modeswitch.rules /storage/.config/udev.rules.d/40-modeswitch.rules

    ^ Copy the existing rules file to the udev.rules.d overlay directory and edit (append/add) another rules section with the device IDs for the chip. If you installed usb_modeswitch from one of our tools add-ons it's normally usable without the other files or just have udev eject the /dev/sr0 device like the existing other devices in the rule flle - which works with most WLAN devices.

    ConnMan allows you to set persistent preferences for interface type, e.g. prefer Ethernet over WLAN but not which interface; largely because in Linux the interface identifier is dynamic and determined by probe order. It is also possible to reorder the priority of interfaces (move them once probed). So if the devices consistently probe to the same identifiers you can use systemd.d to run a shell script late in the boot process (after network is up, but before Kodi starts) to detect if /dev/wlan1 is present, and if yes, run a connmanctl command to order wlan1 above wlan0 in the interface list. It's fiddly to create, but do-able and normally reliable once done. You'll find some prior art for the reordering commands in wireguard VPN threads.