rtl8821cu mdev rule for automatic usb modeswitch

This commit is contained in:
2026-04-04 01:01:44 -03:00
parent bacddccd76
commit 14481a2939
4 changed files with 13 additions and 16 deletions

View File

@@ -1,4 +1,9 @@
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
# ssh keys
/etc/ssh/ssh_host_ecdsa_key f 600 0 0 - - - - -
/etc/ssh/ssh_host_ed25519_key f 600 0 0 - - - - -
/etc/ssh/ssh_host_rsa_key f 600 0 0 - - - - -
/etc/ssh/ssh_host_rsa_key f 600 0 0 - - - - -
#rtl8821cu usb modeswitch script
/lib/mdev/rtl8821cu_usb_modeswitch.sh f 755 0 0 - - - - -

View File

@@ -18,17 +18,6 @@
# - Installing packages (use rootfs overlay or a package .mk instead)
# - Modifying files outside $1
set -e
TARGET_DIR="$1"
# Example: ensure /etc/hostname exists with a default value
if [ ! -f "${TARGET_DIR}/etc/hostname" ]; then
echo "rpi-common" > "${TARGET_DIR}/etc/hostname"
fi
# Example: remove unnecessary documentation to save space
rm -rf "${TARGET_DIR}/usr/share/man"
rm -rf "${TARGET_DIR}/usr/share/doc"
echo ">>> Common post-build script completed"
# Add usb_modeswitch mdev rule
grep -q "usb_modeswitch" "$TARGET_DIR/etc/mdev.conf" || \
echo '$PRODUCT=bda/1a2b.* root:root 0660 */lib/mdev/rtl8821cu_usb_modeswitch.sh' >> "$TARGET_DIR/etc/mdev.conf"

View File

@@ -0,0 +1,3 @@
#!/bin/sh
[ "$ACTION" = "add" ] || exit 0
usb_modeswitch -v 0bda -p 1a2b -c /usr/share/usb_modeswitch/0bda:1a2b &