Mu2_Deploy/verify_wlan_usb.sh

26 lines
823 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# Desired USB Vendor ID and Product ID for the Wi-Fi card
USB_VENDOR="0bda"
USB_PRODUCT="a81a"
NEW_INTERFACE_NAME="spir0"
UDEV_RULES_FILE="/etc/udev/rules.d/70-persistent-net.rules"
# Create a udev rule to rename the Wi-Fi adapter based on USB Vendor and Product ID
echo "Creating udev rule for SpiriLink adapter..."
# Create the udev rules directory if it doesn't exist
sudo mkdir -p /etc/udev/rules.d
# Write the udev rule
sudo bash -c "cat <<EOF > $UDEV_RULES_FILE
SUBSYSTEM==\"net\", ACTION==\"add\", ATTRS{idVendor}==\"$USB_VENDOR\", ATTRS{idProduct}==\"$USB_PRODUCT\", NAME=\"$NEW_INTERFACE_NAME\"
EOF"
# Reload udev rules
echo "Reloading udev rules..."
sudo udevadm control --reload
sudo udevadm trigger
echo "udev rule created successfully to rename the SpiriLink adapter to $NEW_INTERFACE_NAME."