Merge pull request #103 from skilau/DetectAndAutoLoadEthernetDrivers

Add support for auto detecting the USB Ethernet adapter, and loading its respective driver
This commit is contained in:
gtxaspec 2022-06-27 21:02:33 -07:00 committed by GitHub
commit f392d1b109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 8 deletions

View File

@ -152,12 +152,16 @@ USB Ethernet Adapter support:
``` ```
ENABLE_USB_ETH="true" ENABLE_USB_ETH="true"
ENABLE_USB_ETH_MODULES="asix,r8152,cdc_ether" ENABLE_USB_ETH_MODULE_AUTODETECT="true"
ENABLE_USB_ETH_MODULE_MANUAL=""
``` ```
available modules: asix, ax88179_178a, cdc_ether, r8152 To have the Ethernet NIC be auto-detected and loaded automatically, set the ENABLE_USB_ETH_MODULE_AUTODETECT value to true.
the next time you boot your camera, make sure your USB Ethernet Adapter is connected to the camera and ethernet. The camera has to be setup initially with Wi-Fi for this to work. After setup, Wi-Fi is no longer needed, as long as you are using the USB Ethernet Adapter. Note that using USB Ethernet disables the onboard Wi-Fi. Specify the driver you need for your specific USB Ethernet adapter. asix is listed by default. To load a specific USB Ethernet NIC driver, set ENABLE_USB_ETH_MODULE_MANUAL to one of the following:
asix, ax88179_178a, cdc_ether, r8152
The next time you boot your camera, make sure your USB Ethernet Adapter is connected to the camera and ethernet. The camera has to be setup initially with Wi-Fi for this to work. After setup, Wi-Fi is no longer needed, as long as you are using the USB Ethernet Adapter. Note that using USB Ethernet disables the onboard Wi-Fi.
--- ---

View File

@ -304,10 +304,44 @@ if [[ "$ENABLE_USB_ETH" == "true" ]]; then
insmod $KMOD_PATH/kernel/drivers/net/usb/usbnet.ko insmod $KMOD_PATH/kernel/drivers/net/usb/usbnet.ko
for i in $(echo "$ENABLE_USB_ETH_MODULES" | tr "," "\n") # Auto-Detect an Ethernet Driver and load it
do if [[ "$ENABLE_USB_ETH_MODULE_AUTODETECT" == "true" ]]; then
insmod $KMOD_PATH/kernel/drivers/net/usb/$i.ko for DEVICE in `lsusb | awk '{print $6}'| tr '[:upper:]' '[:lower:]'`; do
done case $DEVICE in
'077b:2226' | '0846:1040' | '2001:1a00' | '0b95:1720' | '07b8:420a' |\
'08dd:90ff' | '0557:2009' | '0411:003d' | '0411:006e' | '6189:182d' |\
'0df6:0056' | '07aa:0017' | '1189:0893' | '1631:6200' | '04f1:3008' |\
'17ef:7203' | '0b95:772b' | '0b95:7720' | '0b95:1780' | '0789:0160' |\
'13b1:0018' | '1557:7720' | '07d1:3c05' | '2001:3c05' | '2001:1a02' |\
'1737:0039' | '04bb:0930' | '050d:5055' | '05ac:1402' | '0b95:772a' |\
'14ea:ab11' | '0db0:a877' | '0b95:7e2b' | '0b95:172a' | '066b:20f9')
echo "Loading ASIX Ethernet driver..."
modprobe asix
;;
'0b95:1790' | '0b95:178a' | '0df6:0072')
echo "Loading AX88179 Gigabit Ethernet driver..."
modprobe ax88179_178a
;;
'1004:61aa' | '046d:c11f' | '1410:b001' | '1410:9010' | '413c:8195' |\
'413c:8196' | '413c:819b' | '16d5:650a' | '12d1:14ac' | '0bda:8152')
echo "Loading USB CDC Ethernet driver..."
modprobe cdc_ether
;;
'0bda:8152')
echo "Loading Realtek RTL8152 driver..."
modprobe r8152
;;
esac
done
fi
# Manually load any other Ethernet Drivers if asked for
if [[ "$ENABLE_USB_ETH_MODULE_MANUAL" != "" ]]; then
for i in $(echo "$ENABLE_USB_ETH_MODULES" | tr "," "\n")
do
insmod $KMOD_PATH/kernel/drivers/net/usb/$i.ko
done
fi
bonding_setup eth0 wlan0 bonding_setup eth0 wlan0

View File

@ -12,7 +12,8 @@ WEB_CAM_FPS_RATE="25"
CUSTOM_HOSTNAME="WCV3" CUSTOM_HOSTNAME="WCV3"
ENABLE_USB_ETH="false" ENABLE_USB_ETH="false"
ENABLE_USB_ETH_MODULES="asix" ENABLE_USB_ETH_MODULE_AUTODETECT="true"
ENABLE_USB_ETH_MODULE_MANUAL=""
ENABLE_USB_DIRECT="false" ENABLE_USB_DIRECT="false"
USB_DIRECT_MAC_ADDR="02:01:02:03:04:08" USB_DIRECT_MAC_ADDR="02:01:02:03:04:08"