From 85a412e5b8b76c12923adc24fd011e1392f49564 Mon Sep 17 00:00:00 2001 From: Shen Mintao Date: Sat, 28 Feb 2026 14:27:02 +0800 Subject: [PATCH] feat: add aic_btusb bluetooth module support to install.sh --- dkms.conf | 5 ++ drivers/aic8800/Makefile | 5 ++ install.sh | 100 ++++++++++++++++++++++++++++++++------- 3 files changed, 92 insertions(+), 18 deletions(-) diff --git a/dkms.conf b/dkms.conf index b791e02..8018104 100644 --- a/dkms.conf +++ b/dkms.conf @@ -13,4 +13,9 @@ BUILT_MODULE_NAME[1]="aic_load_fw" BUILT_MODULE_LOCATION[1]="drivers/aic8800/aic_load_fw" DEST_MODULE_LOCATION[1]="/updates/dkms" +# Bluetooth USB module (aic_btusb) +BUILT_MODULE_NAME[2]="aic_btusb" +BUILT_MODULE_LOCATION[2]="drivers/aic8800/aic_btusb" +DEST_MODULE_LOCATION[2]="/updates/dkms" + AUTOINSTALL="yes" diff --git a/drivers/aic8800/Makefile b/drivers/aic8800/Makefile index 396e40b..2dca921 100644 --- a/drivers/aic8800/Makefile +++ b/drivers/aic8800/Makefile @@ -1,8 +1,10 @@ CONFIG_AIC_LOADFW_SUPPORT := m CONFIG_AIC8800_WLAN_SUPPORT := m +CONFIG_AIC8800_BTUSB_SUPPORT := m obj-$(CONFIG_AIC_LOADFW_SUPPORT) += aic_load_fw/ obj-$(CONFIG_AIC8800_WLAN_SUPPORT) += aic8800_fdrv/ +obj-$(CONFIG_AIC8800_BTUSB_SUPPORT) += aic_btusb/ ########## config option ########## export CONFIG_USE_FW_REQUEST = n @@ -67,14 +69,17 @@ install: mkdir -p $(MODDESTDIR) install -p -m 644 aic_load_fw/aic_load_fw.ko $(MODDESTDIR)/ install -p -m 644 aic8800_fdrv/aic8800_fdrv.ko $(MODDESTDIR)/ + install -p -m 644 aic_btusb/aic_btusb.ko $(MODDESTDIR)/ /sbin/depmod -a ${KVER} uninstall: rm -rfv $(MODDESTDIR)/aic_load_fw.ko rm -rfv $(MODDESTDIR)/aic8800_fdrv.ko + rm -rfv $(MODDESTDIR)/aic_btusb.ko /sbin/depmod -a ${KVER} clean: cd aic_load_fw/;make clean;cd .. cd aic8800_fdrv/;make clean;cd .. + cd aic_btusb/;make clean;cd .. rm -rf modules.order Module.symvers .modules.order.cmd .Module.symvers.cmd .tmp_versions/ diff --git a/install.sh b/install.sh index 163f022..ab4eda9 100755 --- a/install.sh +++ b/install.sh @@ -340,6 +340,11 @@ BUILT_MODULE_NAME[1]="aic_load_fw" BUILT_MODULE_LOCATION[1]="drivers/aic8800/aic_load_fw" DEST_MODULE_LOCATION[1]="/updates/dkms" +# Módulo Bluetooth USB (aic_btusb) +BUILT_MODULE_NAME[2]="aic_btusb" +BUILT_MODULE_LOCATION[2]="drivers/aic8800/aic_btusb" +DEST_MODULE_LOCATION[2]="/updates/dkms" + AUTOINSTALL="yes" EOF @@ -402,22 +407,27 @@ install_via_dkms() { ############################################################################# load_module() { - print_step "Loading kernel module..." + print_step "Loading kernel modules..." # Update module dependencies print_info "Updating module dependencies..." depmod -a >> "$LOG_FILE" 2>&1 - # Unload module if already loaded + # Unload modules if already loaded + if lsmod | grep -q "aic_btusb"; then + print_info "Bluetooth module already loaded. Reloading..." + modprobe -r aic_btusb >> "$LOG_FILE" 2>&1 || true + fi + if lsmod | grep -q "$MODULE_NAME"; then - print_info "Module already loaded. Reloading..." + print_info "WiFi module already loaded. Reloading..." modprobe -r "$MODULE_NAME" >> "$LOG_FILE" 2>&1 || true fi - # Load the module + # Load the WiFi module print_info "Loading $MODULE_NAME..." if modprobe "$MODULE_NAME" >> "$LOG_FILE" 2>&1; then - print_success "Module loaded successfully." + print_success "WiFi module loaded successfully." # Verify module is loaded print_info "Waiting for module to initialize..." @@ -431,15 +441,41 @@ load_module() { done if [ "$module_loaded" = true ]; then - print_success "Module is active in kernel." + print_success "WiFi module is active in kernel." else - print_warning "Module may not be fully initialized yet." + print_warning "WiFi module may not be fully initialized yet." fi else - print_warning "Module installed but could not be loaded immediately." + print_warning "WiFi module installed but could not be loaded immediately." print_info "This may be due to Secure Boot or missing hardware." print_info "Try rebooting or check: sudo dmesg | grep aic8800" fi + + # Load the Bluetooth module + print_info "Loading aic_btusb..." + if modprobe aic_btusb >> "$LOG_FILE" 2>&1; then + print_success "Bluetooth module loaded successfully." + + # Verify module is loaded + local bt_module_loaded=false + for i in {1..10}; do + if lsmod | grep -q "aic_btusb"; then + bt_module_loaded=true + break + fi + sleep 0.5 + done + + if [ "$bt_module_loaded" = true ]; then + print_success "Bluetooth module is active in kernel." + else + print_warning "Bluetooth module may not be fully initialized yet." + fi + else + print_warning "Bluetooth module installed but could not be loaded immediately." + print_info "This may be due to Secure Boot or missing hardware." + print_info "Try rebooting or check: sudo dmesg | grep aic_btusb" + fi } ############################################################################# @@ -459,15 +495,25 @@ verify_installation() { print_warning "DKMS status unclear: $dkms_status" fi - # Check if module is loaded + # Check if WiFi module is loaded if lsmod | grep -q "$MODULE_NAME"; then - print_success "Kernel module is loaded." - echo "" - lsmod | grep aic + print_success "WiFi kernel module is loaded." else - print_info "Module not currently loaded (this is OK if no hardware is connected)." + print_info "WiFi module not currently loaded (this is OK if no hardware is connected)." fi + # Check if Bluetooth module is loaded + if lsmod | grep -q "aic_btusb"; then + print_success "Bluetooth kernel module is loaded." + else + print_info "Bluetooth module not currently loaded (this is OK if no hardware is connected)." + fi + + # Show all loaded AIC modules + echo "" + print_info "Loaded AIC modules:" + lsmod | grep aic || echo " (none)" + # Check firmware if [ -d "/lib/firmware/aic8800D80" ]; then print_success "Firmware installed in /lib/firmware/aic8800D80" @@ -478,6 +524,16 @@ verify_installation() { if command -v iwconfig &> /dev/null; then iwconfig 2>/dev/null | grep -E "wlan|IEEE" || echo "No wireless interfaces detected (hardware may not be connected)" fi + + # Check for Bluetooth interfaces + print_info "Checking for Bluetooth interfaces..." + if command -v hciconfig &> /dev/null; then + hciconfig 2>/dev/null || echo "No Bluetooth interfaces detected (hardware may not be connected)" + elif command -v bluetoothctl &> /dev/null; then + bluetoothctl list 2>/dev/null || echo "No Bluetooth interfaces detected (hardware may not be connected)" + else + echo "Bluetooth tools not installed (install bluez package for Bluetooth support)" + fi } ############################################################################# @@ -492,13 +548,14 @@ show_final_instructions() { echo "" echo -e "${CYAN}Important Information:${NC}" echo "" - echo "✓ Driver installed via DKMS" + echo "✓ WiFi driver installed via DKMS" + echo "✓ Bluetooth driver (aic_btusb) installed via DKMS" echo "✓ Automatic rebuild enabled for kernel updates" echo "✓ Firmware installed in /lib/firmware/" echo "" echo -e "${CYAN}Next Steps:${NC}" echo "" - echo "1. Connect your AIC8800D80 USB WiFi adapter" + echo "1. Connect your AIC8800D80 USB WiFi/Bluetooth adapter" echo "" echo "2. Check if the adapter is detected:" echo " ${BLUE}lsusb | grep -i aic${NC}" @@ -507,27 +564,34 @@ show_final_instructions() { echo "" echo "3. View kernel messages about the driver:" echo " ${BLUE}sudo dmesg | grep aic8800${NC}" + echo " ${BLUE}sudo dmesg | grep aic_btusb${NC}" echo "" echo "4. Connect to a WiFi network:" echo " ${BLUE}nmcli device wifi list${NC}" echo " ${BLUE}nmcli device wifi connect \"SSID\" password \"PASSWORD\"${NC}" echo "" + echo "5. Check Bluetooth status:" + echo " ${BLUE}bluetoothctl show${NC}" + echo " ${BLUE}bluetoothctl scan on${NC}" + echo "" echo -e "${CYAN}Troubleshooting:${NC}" echo "" echo "• Check DKMS status:" echo " ${BLUE}dkms status${NC}" echo "" echo "• Check loaded modules:" - echo " ${BLUE}lsmod | grep aic8800${NC}" + echo " ${BLUE}lsmod | grep aic${NC}" echo "" - echo "• Manually load the module:" + echo "• Manually load the WiFi module:" echo " ${BLUE}sudo modprobe aic8800_fdrv${NC}" echo "" + echo "• Manually load the Bluetooth module:" + echo " ${BLUE}sudo modprobe aic_btusb${NC}" + echo "" echo "• View detailed logs:" echo " ${BLUE}cat $LOG_FILE${NC}" echo "" echo -e "${YELLOW}Known Limitations:${NC}" - echo "• Bluetooth functionality is not supported" echo "• Secure Boot may prevent module loading (disable in BIOS if needed)" echo "" echo -e "${CYAN}Uninstallation:${NC}"