mirror of
https://github.com/shenmintao/aic8800d80.git
synced 2026-09-26 17:44:16 +00:00
clean up stale aic_btusb references on bluetooth branch (#53)
This branch already switched to standard btusb (commit 86aa95f), but
several pieces still pointed back at the removed aic_btusb module:
- drivers/aic8800/aic_btusb/ source tree (no longer in build)
- modprobe/aic8800-bt.conf installed to /etc/modprobe.d/, which
softdep'd btusb to a nonexistent aic_btusb and aliased AIC BT
interfaces to it. This caused btusb to load without firmware
having been uploaded, producing HCI_Reset timeout -110 on hci0.
- install.sh still copied that conf into /etc/modprobe.d/
- diagnose_bt.sh still told users to modprobe aic_btusb
diagnose_bt.sh rewritten to flag the residual /etc/modprobe.d/aic8800-bt.conf
on already-installed systems and to advise the correct flow
(aic_load_fw uploads BT firmware, btusb takes over).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
f40bda47c3
commit
7d7d9547b8
+33
-26
@@ -3,6 +3,10 @@
|
||||
# AIC8800D80 Bluetooth Diagnostic Script
|
||||
# 用于诊断蓝牙问题
|
||||
#
|
||||
# 本分支 (bluetooth) 使用内核标准 btusb 驱动接管蓝牙,
|
||||
# aic_load_fw 负责把蓝牙固件上传到芯片。
|
||||
# 不应该再安装/加载 aic_btusb。
|
||||
#
|
||||
|
||||
echo "=== AIC8800D80 蓝牙诊断 ==="
|
||||
echo ""
|
||||
@@ -38,8 +42,8 @@ done
|
||||
echo ""
|
||||
|
||||
# 3. 检查已加载的模块
|
||||
echo "3. 已加载的 AIC 模块:"
|
||||
lsmod | grep -E "aic|btusb" || echo " 未找到相关模块"
|
||||
echo "3. 已加载的相关模块 (期望: aic_load_fw + btusb):"
|
||||
lsmod | grep -E "aic_load_fw|aicwf|btusb|bluetooth" || echo " 未找到相关模块"
|
||||
echo ""
|
||||
|
||||
# 4. 检查 HCI 设备
|
||||
@@ -49,7 +53,7 @@ echo ""
|
||||
|
||||
# 5. 检查蓝牙固件加载日志
|
||||
echo "5. 蓝牙固件加载日志 (最近 50 行):"
|
||||
dmesg | grep -iE "fw_patch|fw_adid|aicbt|bluetooth|btusb|aic_btusb|hci" | tail -50
|
||||
dmesg | grep -iE "fw_patch|fw_adid|aicbt|bluetooth|btusb|hci" | tail -50
|
||||
echo ""
|
||||
|
||||
# 6. 检查 rfkill 状态
|
||||
@@ -57,13 +61,15 @@ echo "6. RF-Kill 状态:"
|
||||
rfkill list bluetooth 2>/dev/null || echo " 无法获取 rfkill 信息"
|
||||
echo ""
|
||||
|
||||
# 7. 检查 modprobe 配置
|
||||
echo "7. Modprobe 配置:"
|
||||
# 7. 检查残留的旧 modprobe 配置 (issue #53)
|
||||
echo "7. 残留旧配置检查:"
|
||||
if [ -f /etc/modprobe.d/aic8800-bt.conf ]; then
|
||||
echo " /etc/modprobe.d/aic8800-bt.conf 存在:"
|
||||
cat /etc/modprobe.d/aic8800-bt.conf
|
||||
echo " ⚠️ 发现 /etc/modprobe.d/aic8800-bt.conf —— 这是早期版本残留, 应删除"
|
||||
echo " 该文件 softdep / alias 到不再存在的 aic_btusb, 会导致 btusb 接管设备"
|
||||
echo " 但固件未上传, 表现为 hci0 HCI_Reset 超时 (-110)"
|
||||
echo " 修复: sudo rm /etc/modprobe.d/aic8800-bt.conf && sudo update-initramfs -u (若用 initramfs)"
|
||||
else
|
||||
echo " /etc/modprobe.d/aic8800-bt.conf 不存在!"
|
||||
echo " /etc/modprobe.d/aic8800-bt.conf 不存在 (正常)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
@@ -71,28 +77,29 @@ echo ""
|
||||
echo "=== 诊断建议 ==="
|
||||
echo ""
|
||||
|
||||
# 检查是否有 3 个接口
|
||||
intf_count=$(lsusb -t 2>/dev/null | grep -c "Class=Wireless" || echo "0")
|
||||
if [ "$intf_count" -lt 2 ]; then
|
||||
echo "⚠️ 蓝牙接口数量不足 (应该有 2 个 Wireless 接口)"
|
||||
echo " 可能原因: aic_load_fw 没有加载蓝牙固件"
|
||||
echo " 解决方案: 检查 dmesg 中是否有 'fw_patch_table_8800d80' 相关日志"
|
||||
# 检查 aic_load_fw 是否加载 (它负责上传 WiFi + BT 固件)
|
||||
if ! lsmod | grep -q "^aic_load_fw"; then
|
||||
echo "⚠️ aic_load_fw 未加载"
|
||||
echo " 该模块负责把蓝牙固件上传到芯片, 必须先于 btusb 工作"
|
||||
echo " 解决方案: sudo modprobe aic_load_fw"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# 检查 btusb 是否抢占
|
||||
# 检查 HCI_Reset 超时 (典型症状: 固件未上传却让 btusb 接管)
|
||||
if dmesg | grep -iE "hci0:.*command (0x|tx) timed out|hci0.*opcode.*0x0c03" | tail -5 | grep -q .; then
|
||||
echo "⚠️ 检测到 HCI 命令超时 (HCI_Reset/-110)"
|
||||
echo " 常见原因:"
|
||||
echo " a) /etc/modprobe.d/aic8800-bt.conf 残留 (见第 7 项)"
|
||||
echo " b) aic_load_fw 没有先把蓝牙固件 patch 上传到芯片"
|
||||
echo " c) usb_modeswitch 没把 1111:1111 切换到真实 VID:PID"
|
||||
echo " 排查: 看上面第 5 项日志, 应能看到 fw_patch_table_8800d80 / fw_adid 字样"
|
||||
echo " 临时缓解: 拔插一次设备 (软件复位/飞行模式切换通常无法救活)"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# btusb 是否已接管 BT 接口 (这是正常预期)
|
||||
if lsmod | grep -q "^btusb"; then
|
||||
echo "⚠️ btusb 模块已加载"
|
||||
echo " 如果蓝牙不工作,可能是 btusb 抢占了设备"
|
||||
echo " 解决方案: sudo rmmod btusb && sudo modprobe aic_btusb"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# 检查 aic_btusb 是否加载
|
||||
if ! lsmod | grep -q "aic_btusb"; then
|
||||
echo "⚠️ aic_btusb 模块未加载"
|
||||
echo " 解决方案: sudo modprobe aic_btusb"
|
||||
echo ""
|
||||
echo "✅ btusb 已加载 (正常, 本分支由 btusb 接管蓝牙)"
|
||||
fi
|
||||
|
||||
echo "=== 诊断完成 ==="
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
config AIC8800_BTUSB_SUPPORT
|
||||
tristate "AIC8800 Bluetooth USB Support"
|
||||
depends on BT && USB
|
||||
help
|
||||
This is support for AIC8800 Bluetooth USB driver.
|
||||
Select this option if you have an AIC8800 USB WiFi/Bluetooth
|
||||
combo adapter and want to use Bluetooth functionality.
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
MODULE_NAME = aic_btusb
|
||||
|
||||
CONFIG_AIC8800_BTUSB_SUPPORT = m
|
||||
CONFIG_SUPPORT_VENDOR_APCF = n
|
||||
# Need to set fw path in BOARD_KERNEL_CMDLINE
|
||||
CONFIG_USE_FW_REQUEST = n
|
||||
|
||||
ifeq ($(CONFIG_SUPPORT_VENDOR_APCF), y)
|
||||
obj-$(CONFIG_AIC8800_BTUSB_SUPPORT) := $(MODULE_NAME).o aic_btusb_external_featrue.o
|
||||
else
|
||||
obj-$(CONFIG_AIC8800_BTUSB_SUPPORT) := $(MODULE_NAME).o
|
||||
endif
|
||||
|
||||
ccflags-$(CONFIG_SUPPORT_VENDOR_APCF) += -DCONFIG_SUPPORT_VENDOR_APCF
|
||||
#$(MODULE_NAME)-y := aic_btusb_ioctl.o\
|
||||
# aic_btusb.o \
|
||||
|
||||
ccflags-$(CONFIG_USE_FW_REQUEST) += -DCONFIG_USE_FW_REQUEST
|
||||
|
||||
|
||||
# Platform support list
|
||||
CONFIG_PLATFORM_ROCKCHIP ?= n
|
||||
CONFIG_PLATFORM_ALLWINNER ?= n
|
||||
CONFIG_PLATFORM_AMLOGIC ?= n
|
||||
CONFIG_PLATFORM_UBUNTU ?= y
|
||||
|
||||
|
||||
# MTK linux platform use bluedroid
|
||||
CONFIG_PLATFORM_MTK_LINUX ?= n
|
||||
|
||||
|
||||
ifeq ($(CONFIG_PLATFORM_ROCKCHIP), y)
|
||||
ccflags-$(CONFIG_PLATFORM_ROCKCHIP) += -DCONFIG_PLATFORM_ROCKCHIP
|
||||
KDIR := /home/yaya/E/Rockchip/3229/Android9/rk3229_android9.0_box/kernel
|
||||
ARCH ?= arm
|
||||
CROSS_COMPILE ?= /home/yaya/E/Rockchip/3229/Android9/rk3229_android9.0_box/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
|
||||
#KDIR := /home/yaya/E/Rockchip/3229/Android7/RK3229_ANDROID7.1_v1.01_20170914/rk3229_Android7.1_v1.01_xml0914/kernel
|
||||
#ARCH ?= arm
|
||||
#CROSS_COMPILE ?= /home/yaya/E/Rockchip/3229/Android7/RK3229_ANDROID7.1_v1.01_20170914/rk3229_Android7.1_v1.01_xml0914/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PLATFORM_ALLWINNER), y)
|
||||
ccflags-$(CONFIG_PLATFORM_ALLWINNER) += -DCONFIG_PLATFORM_ALLWINNER
|
||||
KDIR := /home/yaya/E/Allwinner/R818/R818/AndroidQ/lichee/kernel/linux-4.9
|
||||
ARCH ?= arm64
|
||||
CROSS_COMPILE ?= /home/yaya/E/Allwinner/R818/R818/AndroidQ/lichee/out/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PLATFORM_AMLOGIC), y)
|
||||
ccflags-$(CONFIG_PLATFORM_AMLOGIC) += -DCONFIG_PLATFORM_AMLOGIC
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PLATFORM_UBUNTU), y)
|
||||
ccflags-$(CONFIG_PLATFORM_UBUNTU) += -DCONFIG_PLATFORM_UBUNTU
|
||||
|
||||
KVER ?= $(shell uname -r)
|
||||
KDIR ?= /lib/modules/$(KVER)/build
|
||||
PWD := $(shell pwd)
|
||||
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/aic8800
|
||||
SUBARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/armv.l/arm/ -e s/aarch64/arm64/)
|
||||
ARCH ?= $(SUBARCH)
|
||||
CROSS_COMPILE :=
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PLATFORM_MTK_LINUX), y)
|
||||
ccflags-$(CONFIG_PLATFORM_MTK_LINUX) += -DCONFIG_PLATFORM_MTK_LINUX
|
||||
endif
|
||||
|
||||
all: modules
|
||||
modules:
|
||||
make -C $(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules
|
||||
|
||||
install:
|
||||
mkdir -p $(MODDESTDIR)
|
||||
install -p -m 644 $(MODULE_NAME).ko $(MODDESTDIR)/
|
||||
/sbin/depmod -a ${KVER}
|
||||
echo $(MODULE_NAME) >> /etc/modules-load.d/aic_bt.conf
|
||||
|
||||
uninstall:
|
||||
rm -rfv $(MODDESTDIR)/$(MODULE_NAME).ko
|
||||
/sbin/depmod -a ${KVER}
|
||||
rm -f /etc/modules-load.d/aic_bt.conf
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.ko *.o.* *.mod.* modules.* Module.* .a* .o* .*.o.* *.mod .tmp* .cache.mk .Module.symvers.cmd .modules.order.cmd
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,905 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Aic Bluetooth USB driver
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/poll.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/suspend.h>
|
||||
|
||||
|
||||
#ifdef CONFIG_PLATFORM_UBUNTU
|
||||
#define CONFIG_BLUEDROID 1 /* bleuz 0, bluedroid 1, lbh 2 */
|
||||
#else
|
||||
#define CONFIG_BLUEDROID 1 /* bleuz 0, bluedroid 1, lbh 2 */
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLUEDROID == 1
|
||||
/*
|
||||
If you need to use the feature of waking up with BLE during STR Suspend sleep, please enable this macro.
|
||||
*/
|
||||
|
||||
//#define CONFIG_BT_WAKEUP_IN_PM
|
||||
#endif
|
||||
/* Some Android system may use standard Linux kernel, while
|
||||
* standard Linux may also implement early suspend feature.
|
||||
* So exclude earysuspend.h from CONFIG_BLUEDROID.
|
||||
*/
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLUEDROID
|
||||
#else
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
#include <net/bluetooth/hci.h>
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************
|
||||
** AicSemi - For aic_btusb driver **
|
||||
***********************************/
|
||||
#define URB_CANCELING_DELAY_MS 10
|
||||
/* when OS suspended, module is still powered,usb is not powered,
|
||||
* this may set to 1, and must comply with special patch code.
|
||||
*/
|
||||
#define CONFIG_RESET_RESUME 1
|
||||
#define PRINT_CMD_EVENT 0
|
||||
#define PRINT_ACL_DATA 0
|
||||
#define PRINT_SCO_DATA 0
|
||||
|
||||
#define AICBT_DBG_FLAG 0
|
||||
|
||||
#if AICBT_DBG_FLAG
|
||||
#define AICBT_DBG(fmt, arg...) printk( "aic_btusb: " fmt "\n" , ## arg)
|
||||
#else
|
||||
#define AICBT_DBG(fmt, arg...)
|
||||
#endif
|
||||
|
||||
#define AICBT_INFO(fmt, arg...) printk("aic_btusb: " fmt "\n" , ## arg)
|
||||
#define AICBT_WARN(fmt, arg...) printk("aic_btusb: " fmt "\n" , ## arg)
|
||||
#define AICBT_ERR(fmt, arg...) printk("aic_btusb: " fmt "\n" , ## arg)
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 33)
|
||||
#define HDEV_BUS hdev->bus
|
||||
#define USB_RPM 1
|
||||
#else
|
||||
#define HDEV_BUS hdev->type
|
||||
#define USB_RPM 0
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
|
||||
#define NUM_REASSEMBLY 3
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 4, 0)
|
||||
#define GET_DRV_DATA(x) hci_get_drvdata(x)
|
||||
#else
|
||||
#define GET_DRV_DATA(x) x->driver_data
|
||||
#endif
|
||||
|
||||
#define SCO_NUM hdev->conn_hash.sco_num
|
||||
|
||||
|
||||
#define BTUSB_RPM (0 * USB_RPM) /* 1 SS enable; 0 SS disable */
|
||||
#define BTUSB_WAKEUP_HOST 0 /* 1 enable; 0 disable */
|
||||
#define BTUSB_MAX_ISOC_FRAMES 48
|
||||
#define BTUSB_INTR_RUNNING 0
|
||||
#define BTUSB_BULK_RUNNING 1
|
||||
#define BTUSB_ISOC_RUNNING 2
|
||||
#define BTUSB_SUSPENDING 3
|
||||
#define BTUSB_DID_ISO_RESUME 4
|
||||
|
||||
#define HCI_VENDOR_USB_DISC_HARDWARE_ERROR 0xFF
|
||||
#define HCI_VENDOR_USB_RESUME_HARDWARE_ERROR 0xFE
|
||||
|
||||
#define HCI_CMD_READ_BD_ADDR 0x1009
|
||||
#define HCI_VENDOR_READ_LMP_VERISION 0x1001
|
||||
#define HCI_VENDOR_RESET 0x0C03
|
||||
|
||||
#define DRV_NORMAL_MODE 0
|
||||
#define DRV_MP_MODE 1
|
||||
int mp_drv_mode = 0; /* 1 Mptool Fw; 0 Normal Fw */
|
||||
|
||||
#if CONFIG_BLUEDROID
|
||||
/* ----- HCI Commands ---- */
|
||||
#define HCI_OP_INQUIRY 0x0401
|
||||
#define HCI_OP_INQUIRY_CANCEL 0x0402
|
||||
#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
|
||||
#define HCI_OP_CREATE_CONN 0x0405
|
||||
#define HCI_OP_DISCONNECT 0x0406
|
||||
#define HCI_OP_ADD_SCO 0x0407
|
||||
#define HCI_OP_CREATE_CONN_CANCEL 0x0408
|
||||
#define HCI_OP_ACCEPT_CONN_REQ 0x0409
|
||||
#define HCI_OP_REJECT_CONN_REQ 0x040a
|
||||
#define HCI_OP_LINK_KEY_REPLY 0x040b
|
||||
#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
|
||||
#define HCI_OP_PIN_CODE_REPLY 0x040d
|
||||
#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
|
||||
#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
|
||||
#define HCI_OP_AUTH_REQUESTED 0x0411
|
||||
#define HCI_OP_SET_CONN_ENCRYPT 0x0413
|
||||
#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
|
||||
#define HCI_OP_REMOTE_NAME_REQ 0x0419
|
||||
#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
|
||||
#define HCI_OP_READ_REMOTE_FEATURES 0x041b
|
||||
#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
|
||||
#define HCI_OP_READ_REMOTE_VERSION 0x041d
|
||||
#define HCI_OP_SETUP_SYNC_CONN 0x0428
|
||||
#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
|
||||
#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
|
||||
#define HCI_OP_SNIFF_MODE 0x0803
|
||||
#define HCI_OP_EXIT_SNIFF_MODE 0x0804
|
||||
#define HCI_OP_ROLE_DISCOVERY 0x0809
|
||||
#define HCI_OP_SWITCH_ROLE 0x080b
|
||||
#define HCI_OP_READ_LINK_POLICY 0x080c
|
||||
#define HCI_OP_WRITE_LINK_POLICY 0x080d
|
||||
#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
|
||||
#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
|
||||
#define HCI_OP_SNIFF_SUBRATE 0x0811
|
||||
#define HCI_OP_Write_Link_Policy_Settings 0x080d
|
||||
#define HCI_OP_SET_EVENT_MASK 0x0c01
|
||||
#define HCI_OP_RESET 0x0c03
|
||||
#define HCI_OP_SET_EVENT_FLT 0x0c05
|
||||
#endif
|
||||
|
||||
#define HCI_OP_Write_Extended_Inquiry_Response 0x0c52
|
||||
#define HCI_OP_Write_Simple_Pairing_Mode 0x0c56
|
||||
#define HCI_OP_Read_Buffer_Size 0x1005
|
||||
#define HCI_OP_Host_Buffer_Size 0x0c33
|
||||
#define HCI_OP_Read_Local_Version_Information 0x1001
|
||||
#define HCI_OP_Read_BD_ADDR 0x1009
|
||||
#define HCI_OP_Read_Local_Supported_Commands 0x1002
|
||||
#define HCI_OP_Write_Scan_Enable 0x0c1a
|
||||
#define HCI_OP_Write_Current_IAC_LAP 0x0c3a
|
||||
#define HCI_OP_Write_Inquiry_Scan_Activity 0x0c1e
|
||||
#define HCI_OP_Write_Class_of_Device 0x0c24
|
||||
#define HCI_OP_LE_Rand 0x2018
|
||||
#define HCI_OP_LE_Set_Random_Address 0x2005
|
||||
#define HCI_OP_LE_Set_Extended_Adv_Enable 0x2039
|
||||
#define HCI_OP_LE_Set_Extended_Scan_Enable 0x2042
|
||||
#define HCI_OP_LE_Set_Extended_Scan_Parameters 0x2041
|
||||
#define HCI_OP_Set_Event_Filter 0x0c05
|
||||
#define HCI_OP_Write_Voice_Setting 0x0c26
|
||||
#define HCI_OP_Change_Local_Name 0x0c13
|
||||
#define HCI_OP_Read_Local_Name 0x0c14
|
||||
#define HCI_OP_Wirte_Page_Timeout 0x0c18
|
||||
#define HCI_OP_LE_Clear_Resolving_List 0x0c29
|
||||
#define HCI_OP_LE_Set_Addres_Resolution_Enable_Command 0x0c2e
|
||||
#define HCI_OP_Write_Inquiry_mode 0x0c45
|
||||
#define HCI_OP_Write_Page_Scan_Type 0x0c47
|
||||
#define HCI_OP_Write_Inquiry_Scan_Type 0x0c43
|
||||
|
||||
|
||||
|
||||
#define HCI_OP_Delete_Stored_Link_Key 0x0c12
|
||||
#define HCI_OP_LE_Read_Local_Resolvable_Address 0x202d
|
||||
#define HCI_OP_LE_Extended_Create_Connection 0x2043
|
||||
#define HCI_OP_Read_Remote_Version_Information 0x041d
|
||||
#define HCI_OP_LE_Start_Encryption 0x2019
|
||||
#define HCI_OP_LE_Add_Device_to_Resolving_List 0x2027
|
||||
#define HCI_OP_LE_Set_Privacy_Mode 0x204e
|
||||
#define HCI_OP_LE_Connection_Update 0x2013
|
||||
|
||||
#define HCI_OP_LE_Read_Local_Support_Featrues 0x2003
|
||||
#define HCI_OP_LE_Get_Vendor_Capabilities_Command 0xfd53
|
||||
#define HCI_OP_LE_Set_Le_Scan_Enable 0x200C
|
||||
#define HCI_OP_LE_Create_Connection 0x200d
|
||||
#define HCI_OP_LE_Create_Connection_Cancel 0x200e
|
||||
|
||||
#if CONFIG_BLUEDROID
|
||||
/* ----- HCI events---- */
|
||||
#define HCI_OP_DISCONNECT 0x0406
|
||||
#define HCI_EV_INQUIRY_COMPLETE 0x01
|
||||
#define HCI_EV_INQUIRY_RESULT 0x02
|
||||
#define HCI_EV_CONN_COMPLETE 0x03
|
||||
#define HCI_EV_CONN_REQUEST 0x04
|
||||
#define HCI_EV_DISCONN_COMPLETE 0x05
|
||||
#define HCI_EV_AUTH_COMPLETE 0x06
|
||||
#define HCI_EV_REMOTE_NAME 0x07
|
||||
#define HCI_EV_ENCRYPT_CHANGE 0x08
|
||||
#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
|
||||
|
||||
#define HCI_EV_REMOTE_FEATURES 0x0b
|
||||
#define HCI_EV_REMOTE_VERSION 0x0c
|
||||
#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
|
||||
#define HCI_EV_CMD_COMPLETE 0x0e
|
||||
#define HCI_EV_CMD_STATUS 0x0f
|
||||
|
||||
#define HCI_EV_ROLE_CHANGE 0x12
|
||||
#define HCI_EV_NUM_COMP_PKTS 0x13
|
||||
#define HCI_EV_MODE_CHANGE 0x14
|
||||
#define HCI_EV_PIN_CODE_REQ 0x16
|
||||
#define HCI_EV_LINK_KEY_REQ 0x17
|
||||
#define HCI_EV_LINK_KEY_NOTIFY 0x18
|
||||
#define HCI_EV_CLOCK_OFFSET 0x1c
|
||||
#define HCI_EV_PKT_TYPE_CHANGE 0x1d
|
||||
#define HCI_EV_PSCAN_REP_MODE 0x20
|
||||
|
||||
#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
|
||||
#define HCI_EV_REMOTE_EXT_FEATURES 0x23
|
||||
#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
|
||||
#define HCI_EV_SYNC_CONN_CHANGED 0x2d
|
||||
#define HCI_EV_SNIFF_SUBRATE 0x2e
|
||||
#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
|
||||
#define HCI_EV_IO_CAPA_REQUEST 0x31
|
||||
#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
|
||||
#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
|
||||
#define HCI_EV_LE_Meta 0x3e
|
||||
|
||||
/* ULP Event sub code */
|
||||
#define HCI_BLE_CONN_COMPLETE_EVT 0x01
|
||||
#define HCI_BLE_ADV_PKT_RPT_EVT 0x02
|
||||
#define HCI_BLE_LL_CONN_PARAM_UPD_EVT 0x03
|
||||
#define HCI_BLE_READ_REMOTE_FEAT_CMPL_EVT 0x04
|
||||
#define HCI_BLE_LTK_REQ_EVT 0x05
|
||||
#define HCI_BLE_RC_PARAM_REQ_EVT 0x06
|
||||
#define HCI_BLE_DATA_LENGTH_CHANGE_EVT 0x07
|
||||
#define HCI_BLE_ENHANCED_CONN_COMPLETE_EVT 0x0a
|
||||
#define HCI_BLE_DIRECT_ADV_EVT 0x0b
|
||||
#define HCI_BLE_PHY_UPDATE_COMPLETE_EVT 0x0c
|
||||
#define HCI_LE_EXTENDED_ADVERTISING_REPORT_EVT 0x0D
|
||||
#define HCI_BLE_PERIODIC_ADV_SYNC_EST_EVT 0x0E
|
||||
#define HCI_BLE_PERIODIC_ADV_REPORT_EVT 0x0F
|
||||
#define HCI_BLE_PERIODIC_ADV_SYNC_LOST_EVT 0x10
|
||||
#define HCI_BLE_SCAN_TIMEOUT_EVT 0x11
|
||||
#define HCI_LE_ADVERTISING_SET_TERMINATED_EVT 0x12
|
||||
#define HCI_BLE_SCAN_REQ_RX_EVT 0x13
|
||||
#define HCI_BLE_CIS_EST_EVT 0x19
|
||||
#define HCI_BLE_CIS_REQ_EVT 0x1a
|
||||
#define HCI_BLE_CREATE_BIG_CPL_EVT 0x1b
|
||||
#define HCI_BLE_TERM_BIG_CPL_EVT 0x1c
|
||||
#define HCI_BLE_BIG_SYNC_EST_EVT 0x1d
|
||||
#define HCI_BLE_BIG_SYNC_LOST_EVT 0x1e
|
||||
#define HCI_BLE_REQ_PEER_SCA_CPL_EVT 0x1f
|
||||
|
||||
#define HCI_VENDOR_SPECIFIC_EVT 0xFF /* Vendor specific events */
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLUEDROID
|
||||
#define QUEUE_SIZE 500
|
||||
|
||||
/***************************************
|
||||
** AicSemi - Integrate from bluetooth.h **
|
||||
*****************************************/
|
||||
/* Reserv for core and drivers use */
|
||||
#define BT_SKB_RESERVE 8
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t addr[6];
|
||||
}bdaddr_t;
|
||||
|
||||
/* Skb helpers */
|
||||
struct bt_skb_cb {
|
||||
__u8 pkt_type;
|
||||
__u8 incoming;
|
||||
__u16 expect;
|
||||
__u16 tx_seq;
|
||||
__u8 retries;
|
||||
__u8 sar;
|
||||
__u8 force_active;
|
||||
};
|
||||
|
||||
#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
|
||||
|
||||
static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
if ((skb = alloc_skb(len + BT_SKB_RESERVE, how))) {
|
||||
skb_reserve(skb, BT_SKB_RESERVE);
|
||||
bt_cb(skb)->incoming = 0;
|
||||
}
|
||||
return skb;
|
||||
}
|
||||
/* AicSemi - Integrate from bluetooth.h end */
|
||||
|
||||
/***********************************
|
||||
** AicSemi - Integrate from hci.h **
|
||||
***********************************/
|
||||
#define HCI_MAX_ACL_SIZE 1024
|
||||
#define HCI_MAX_SCO_SIZE 255
|
||||
#define HCI_MAX_EVENT_SIZE 260
|
||||
#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
|
||||
|
||||
/* HCI bus types */
|
||||
#define HCI_VIRTUAL 0
|
||||
#define HCI_USB 1
|
||||
#define HCI_PCCARD 2
|
||||
#define HCI_UART 3
|
||||
#define HCI_RS232 4
|
||||
#define HCI_PCI 5
|
||||
#define HCI_SDIO 6
|
||||
|
||||
/* HCI controller types */
|
||||
#define HCI_BREDR 0x00
|
||||
#define HCI_AMP 0x01
|
||||
|
||||
/* HCI device flags */
|
||||
enum {
|
||||
HCI_UP,
|
||||
HCI_INIT,
|
||||
HCI_RUNNING,
|
||||
|
||||
HCI_PSCAN,
|
||||
HCI_ISCAN,
|
||||
HCI_AUTH,
|
||||
HCI_ENCRYPT,
|
||||
HCI_INQUIRY,
|
||||
|
||||
HCI_RAW,
|
||||
|
||||
HCI_RESET,
|
||||
};
|
||||
|
||||
/*
|
||||
* BR/EDR and/or LE controller flags: the flags defined here should represent
|
||||
* states from the controller.
|
||||
*/
|
||||
enum {
|
||||
HCI_SETUP,
|
||||
HCI_AUTO_OFF,
|
||||
HCI_MGMT,
|
||||
HCI_PAIRABLE,
|
||||
HCI_SERVICE_CACHE,
|
||||
HCI_LINK_KEYS,
|
||||
HCI_DEBUG_KEYS,
|
||||
HCI_UNREGISTER,
|
||||
|
||||
HCI_LE_SCAN,
|
||||
HCI_SSP_ENABLED,
|
||||
HCI_HS_ENABLED,
|
||||
HCI_LE_ENABLED,
|
||||
HCI_CONNECTABLE,
|
||||
HCI_DISCOVERABLE,
|
||||
HCI_LINK_SECURITY,
|
||||
HCI_PENDING_CLASS,
|
||||
};
|
||||
|
||||
/* HCI data types */
|
||||
#define HCI_COMMAND_PKT 0x01
|
||||
#define HCI_ACLDATA_PKT 0x02
|
||||
#define HCI_SCODATA_PKT 0x03
|
||||
#define HCI_EVENT_PKT 0x04
|
||||
#define HCI_VENDOR_PKT 0xff
|
||||
|
||||
#define HCI_MAX_NAME_LENGTH 248
|
||||
#define HCI_MAX_EIR_LENGTH 240
|
||||
|
||||
#define HCI_OP_READ_LOCAL_VERSION 0x1001
|
||||
struct hci_rp_read_local_version {
|
||||
__u8 status;
|
||||
__u8 hci_ver;
|
||||
__le16 hci_rev;
|
||||
__u8 lmp_ver;
|
||||
__le16 manufacturer;
|
||||
__le16 lmp_subver;
|
||||
} __packed;
|
||||
|
||||
#define HCI_EV_CMD_COMPLETE 0x0e
|
||||
struct hci_ev_cmd_complete {
|
||||
__u8 ncmd;
|
||||
__le16 opcode;
|
||||
} __packed;
|
||||
|
||||
/* ---- HCI Packet structures ---- */
|
||||
#define HCI_COMMAND_HDR_SIZE 3
|
||||
#define HCI_EVENT_HDR_SIZE 2
|
||||
#define HCI_ACL_HDR_SIZE 4
|
||||
#define HCI_SCO_HDR_SIZE 3
|
||||
|
||||
struct hci_command_hdr {
|
||||
__le16 opcode; /* OCF & OGF */
|
||||
__u8 plen;
|
||||
} __packed;
|
||||
|
||||
struct hci_event_hdr {
|
||||
__u8 evt;
|
||||
__u8 plen;
|
||||
} __packed;
|
||||
|
||||
struct hci_acl_hdr {
|
||||
__le16 handle; /* Handle & Flags(PB, BC) */
|
||||
__le16 dlen;
|
||||
} __packed;
|
||||
|
||||
struct hci_sco_hdr {
|
||||
__le16 handle;
|
||||
__u8 dlen;
|
||||
} __packed;
|
||||
|
||||
static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct hci_event_hdr *) skb->data;
|
||||
}
|
||||
|
||||
static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct hci_acl_hdr *) skb->data;
|
||||
}
|
||||
|
||||
static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct hci_sco_hdr *) skb->data;
|
||||
}
|
||||
|
||||
/* ---- HCI Ioctl requests structures ---- */
|
||||
struct hci_dev_stats {
|
||||
__u32 err_rx;
|
||||
__u32 err_tx;
|
||||
__u32 cmd_tx;
|
||||
__u32 evt_rx;
|
||||
__u32 acl_tx;
|
||||
__u32 acl_rx;
|
||||
__u32 sco_tx;
|
||||
__u32 sco_rx;
|
||||
__u32 byte_rx;
|
||||
__u32 byte_tx;
|
||||
};
|
||||
/* AicSemi - Integrate from hci.h end */
|
||||
|
||||
/*****************************************
|
||||
** AicSemi - Integrate from hci_core.h **
|
||||
*****************************************/
|
||||
struct hci_conn_hash {
|
||||
struct list_head list;
|
||||
unsigned int acl_num;
|
||||
unsigned int sco_num;
|
||||
unsigned int le_num;
|
||||
};
|
||||
|
||||
#define HCI_MAX_SHORT_NAME_LENGTH 10
|
||||
|
||||
#define NUM_REASSEMBLY 4
|
||||
struct hci_dev {
|
||||
struct mutex lock;
|
||||
|
||||
char name[8];
|
||||
unsigned long flags;
|
||||
__u16 id;
|
||||
__u8 bus;
|
||||
__u8 dev_type;
|
||||
|
||||
struct sk_buff *reassembly[NUM_REASSEMBLY];
|
||||
|
||||
struct hci_conn_hash conn_hash;
|
||||
|
||||
struct hci_dev_stats stat;
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 4, 0)
|
||||
atomic_t refcnt;
|
||||
struct module *owner;
|
||||
void *driver_data;
|
||||
#endif
|
||||
|
||||
atomic_t promisc;
|
||||
|
||||
struct device *parent;
|
||||
struct device dev;
|
||||
|
||||
unsigned long dev_flags;
|
||||
|
||||
int (*open)(struct hci_dev *hdev);
|
||||
int (*close)(struct hci_dev *hdev);
|
||||
int (*flush)(struct hci_dev *hdev);
|
||||
int (*send)(struct sk_buff *skb);
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 4, 0)
|
||||
void (*destruct)(struct hci_dev *hdev);
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 7, 1)
|
||||
__u16 voice_setting;
|
||||
#endif
|
||||
void (*notify)(struct hci_dev *hdev, unsigned int evt);
|
||||
int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
|
||||
u8 *align_data;
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 4, 0)
|
||||
static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
|
||||
{
|
||||
atomic_inc(&d->refcnt);
|
||||
return d;
|
||||
}
|
||||
|
||||
static inline void __hci_dev_put(struct hci_dev *d)
|
||||
{
|
||||
if (atomic_dec_and_test(&d->refcnt))
|
||||
d->destruct(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void *hci_get_drvdata(struct hci_dev *hdev)
|
||||
{
|
||||
return dev_get_drvdata(&hdev->dev);
|
||||
}
|
||||
|
||||
static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
|
||||
{
|
||||
dev_set_drvdata(&hdev->dev, data);
|
||||
}
|
||||
|
||||
#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev))
|
||||
/* AicSemi - Integrate from hci_core.h end */
|
||||
|
||||
|
||||
#define CONFIG_MAC_OFFSET_GEN_1_2 (0x3C) //MAC's OFFSET in config/efuse for aic generation 1~2 bluetooth chip
|
||||
#define CONFIG_MAC_OFFSET_GEN_3PLUS (0x44) //MAC's OFFSET in config/efuse for aic generation 3+ bluetooth chip
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint16_t vid;
|
||||
uint16_t pid;
|
||||
uint16_t lmp_sub_default;
|
||||
uint16_t lmp_sub;
|
||||
uint16_t eversion;
|
||||
char *mp_patch_name;
|
||||
char *patch_name;
|
||||
char *config_name;
|
||||
uint8_t *fw_cache;
|
||||
int fw_len;
|
||||
uint16_t mac_offset;
|
||||
uint32_t max_patch_size;
|
||||
} patch_info;
|
||||
|
||||
//Define ioctl cmd the same as HCIDEVUP in the kernel
|
||||
#define DOWN_FW_CFG _IOW('E', 176, int)
|
||||
#define SET_ISO_CFG _IOW('E', 177, int)
|
||||
#define RESET_CONTROLLER _IOW('E', 178, int)
|
||||
#define DWFW_CMPLT _IOW('E', 179, int)
|
||||
|
||||
#define GET_USB_INFO _IOR('E', 180, int)
|
||||
|
||||
/* for altsettings*/
|
||||
#include <linux/fs.h>
|
||||
#define BDADDR_FILE "/data/misc/bluetooth/bdaddr"
|
||||
#define FACTORY_BT_BDADDR_STORAGE_LEN 17
|
||||
#if 0
|
||||
static inline int getmacaddr(uint8_t * vnd_local_bd_addr)
|
||||
{
|
||||
struct file *bdaddr_file;
|
||||
mm_segment_t oldfs;
|
||||
char buf[FACTORY_BT_BDADDR_STORAGE_LEN];
|
||||
int32_t i = 0;
|
||||
memset(buf, 0, FACTORY_BT_BDADDR_STORAGE_LEN);
|
||||
bdaddr_file = filp_open(BDADDR_FILE, O_RDONLY, 0);
|
||||
if (IS_ERR(bdaddr_file)){
|
||||
AICBT_INFO("No Mac Config for BT\n");
|
||||
return -1;
|
||||
}
|
||||
oldfs = get_fs();
|
||||
set_fs(KERNEL_DS);
|
||||
bdaddr_file->f_op->llseek(bdaddr_file, 0, 0);
|
||||
bdaddr_file->f_op->read(bdaddr_file, buf, FACTORY_BT_BDADDR_STORAGE_LEN, &bdaddr_file->f_pos);
|
||||
for (i = 0; i < 6; i++) {
|
||||
if(buf[3*i]>'9')
|
||||
{
|
||||
if(buf[3*i]>'Z')
|
||||
buf[3*i] -=('a'-'A'); //change a to A
|
||||
buf[3*i] -= ('A'-'9'-1);
|
||||
}
|
||||
if(buf[3*i+1]>'9')
|
||||
{
|
||||
if(buf[3*i+1]>'Z')
|
||||
buf[3*i+1] -=('a'-'A'); //change a to A
|
||||
buf[3*i+1] -= ('A'-'9'-1);
|
||||
}
|
||||
vnd_local_bd_addr[5-i] = ((uint8_t)buf[3*i]-'0')*16 + ((uint8_t)buf[3*i+1]-'0');
|
||||
}
|
||||
set_fs(oldfs);
|
||||
filp_close(bdaddr_file, NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_BLUEDROID */
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct usb_interface *intf;
|
||||
struct usb_device *udev;
|
||||
int pipe_in, pipe_out;
|
||||
uint8_t *send_pkt;
|
||||
uint8_t *rcv_pkt;
|
||||
struct hci_command_hdr *cmd_hdr;
|
||||
struct hci_event_hdr *evt_hdr;
|
||||
struct hci_ev_cmd_complete *cmd_cmp;
|
||||
uint8_t *req_para, *rsp_para;
|
||||
uint8_t *fw_data;
|
||||
int pkt_len;
|
||||
int fw_len;
|
||||
} firmware_info;
|
||||
|
||||
/*******************************
|
||||
** Reasil patch code
|
||||
********************************/
|
||||
#define CMD_CMP_EVT 0x0e
|
||||
#define RCV_PKT_LEN 64
|
||||
#define SEND_PKT_LEN 300
|
||||
#define MSG_TO 1000
|
||||
#define PATCH_SEG_MAX 252
|
||||
#define DATA_END 0x80
|
||||
#define DOWNLOAD_OPCODE 0xfc02
|
||||
#define HCI_VSC_UPDATE_PT_CMD 0xFC75
|
||||
#define HCI_VSC_SET_ADFILTER_EN_CMD 0xFDAA
|
||||
#define HCI_VSC_SET_ADFILTER_PT_CMD 0xFDAB
|
||||
#define HCI_VSC_RESET_ADFILTER_PROCESS_PT_CMD 0xFDAC
|
||||
#define HCI_VSC_WF_START_APP_CMD 0xFDAD
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define CMD_HDR_LEN sizeof(struct hci_command_hdr)
|
||||
#define EVT_HDR_LEN sizeof(struct hci_event_hdr)
|
||||
#define CMD_CMP_LEN sizeof(struct hci_ev_cmd_complete)
|
||||
#define MAX_PATCH_SIZE_24K (1024*24)
|
||||
#define MAX_PATCH_SIZE_40K (1024*40)
|
||||
|
||||
|
||||
#define FW_RAM_ADID_BASE_ADDR 0x101788
|
||||
#define FW_RAM_PATCH_BASE_ADDR 0x184000
|
||||
#define AICBT_PT_TAG "AICBT_PT_TAG"
|
||||
|
||||
enum aicbt_patch_table_type {
|
||||
AICBT_PT_INF = 0x00,
|
||||
AICBT_PT_TRAP = 0x1,
|
||||
AICBT_PT_B4,
|
||||
AICBT_PT_BTMODE,
|
||||
AICBT_PT_PWRON,
|
||||
AICBT_PT_AF,
|
||||
AICBT_PT_VER,
|
||||
AICBT_PT_MAX,
|
||||
};
|
||||
|
||||
enum AIC_DC_SUBID{
|
||||
DC_U01 = 0,
|
||||
DC_U02,
|
||||
DC_U02H,
|
||||
};
|
||||
|
||||
enum AIC_D80N_SUBID{
|
||||
D80N_U01 = 0,
|
||||
D80N_U02,
|
||||
};
|
||||
|
||||
struct aicbt_firmware {
|
||||
const char *desc;
|
||||
const char *bt_adid;
|
||||
const char *bt_patch;
|
||||
const char *bt_table;
|
||||
const char *bt_ext_patch;
|
||||
const char *wf_cinit;
|
||||
const char *wf_btusb;
|
||||
};
|
||||
|
||||
const struct aicbt_firmware fw_8800dc[] = {
|
||||
[DC_U01] = {
|
||||
.desc = "aic8800dc u01 bt patch",
|
||||
.bt_adid = "fw_adid_8800dc.bin",
|
||||
.bt_patch = "fw_patch_8800dc.bin",
|
||||
.bt_table = "fw_patch_table_8800dc.bin",
|
||||
.bt_ext_patch = "fw_patch_8800dc_ext"
|
||||
},
|
||||
[DC_U02] = {
|
||||
.desc = "aic8800dc u02 bt patch",
|
||||
.bt_adid = "fw_adid_8800dc_u02.bin",
|
||||
.bt_patch = "fw_patch_8800dc_u02.bin",
|
||||
.bt_table = "fw_patch_table_8800dc_u02.bin",
|
||||
.bt_ext_patch = "fw_patch_8800dc_u02_ext"
|
||||
},
|
||||
[DC_U02H] = {
|
||||
.desc = "aic8800dch u02 bt patch",
|
||||
.bt_adid = "fw_adid_8800dc_u02h.bin",
|
||||
.bt_patch = "fw_patch_8800dc_u02h.bin",
|
||||
.bt_table = "fw_patch_table_8800dc_u02h.bin",
|
||||
.bt_ext_patch = "fw_patch_8800dc_u02h_ext"
|
||||
},
|
||||
};
|
||||
|
||||
const struct aicbt_firmware fw_8800d80n[] = {
|
||||
[D80N_U01] = {
|
||||
.desc = "aic8800d80n u01 bt patch",
|
||||
.bt_adid = "fw_adid_8800d80n.bin",
|
||||
.bt_patch = "fw_patch_8800d80n.bin",
|
||||
.bt_table = "fw_patch_table_8800d80n.bin",
|
||||
.bt_ext_patch = "fw_patch_8800d80n_ext"
|
||||
},
|
||||
[D80N_U02] = {
|
||||
.desc = "aic8800d80n u02 bt patch",
|
||||
.bt_adid = "fw_adid_8800d80n_u02.bin",
|
||||
.bt_patch = "fw_patch_8800d80n_u02.bin",
|
||||
.bt_table = "fw_patch_table_8800d80n_u02.bin",
|
||||
.bt_ext_patch = "fw_patch_8800d80n_u02_ext",
|
||||
.wf_cinit = "fmacfw_cinit_8800d80n_u02.bin",
|
||||
.wf_btusb = "fmacfw_btusb_8800d80n_u02.bin",
|
||||
},
|
||||
};
|
||||
|
||||
const struct aicbt_firmware fw_8800d80n_rf[] = {
|
||||
[D80N_U01] = {
|
||||
.desc = "aic8800d80n u01 bt test patch",
|
||||
.bt_adid = "fw_adid_8800d80n.bin",
|
||||
.bt_patch = "fw_patch_8800d80n.bin",
|
||||
.bt_table = "fw_patch_table_8800d80n.bin",
|
||||
.bt_ext_patch = "fw_patch_8800d80n_ext"
|
||||
},
|
||||
[D80N_U02] = {
|
||||
.desc = "aic8800d80n u02 bt patch",
|
||||
.bt_adid = "fw_adid_8800d80n_rf_u02.bin",
|
||||
.bt_patch = "fw_patch_8800d80n_rf_u02.bin",
|
||||
.bt_table = "fw_patch_table_8800d80n_rf_u02.bin",
|
||||
.bt_ext_patch = "fw_patch_8800d80n_rf_u02_ext",
|
||||
.wf_cinit = "fmacfw_cinit_8800d80n_u02.bin",
|
||||
.wf_btusb = "fmacfw_btusb_8800d80n_u02.bin",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
#define HCI_VSC_FW_STATUS_GET_CMD 0xFC78
|
||||
|
||||
struct fw_status {
|
||||
u8 status;
|
||||
} __packed;
|
||||
|
||||
#define HCI_PATCH_DATA_MAX_LEN 240
|
||||
#define HCI_VSC_MEM_WR_SIZE 240
|
||||
#define HCI_VSC_MEM_RD_SIZE 128
|
||||
#define HCI_VSC_UPDATE_PT_SIZE 249
|
||||
#define HCI_PT_MAX_LEN 31
|
||||
|
||||
#define HCI_VSC_MEM_WR_V2_SIZE 128
|
||||
#define HCI_VSC_UPDATE_PT_V2_SIZE 128
|
||||
|
||||
#define HCI_VSC_DBG_RD_MEM_CMD 0xFC01
|
||||
|
||||
#define MAX_AD_FILTER_NUM 4// Max AD Filter num
|
||||
#define MAX_GPIO_TRIGGER_NUM 2// Max user config num of gpio
|
||||
#define MAX_ROLE_COMNO_IDX_NUM 2// Max num of ad role type combo,form( enum gpio_combo_idx)
|
||||
|
||||
#define AD_ROLE_FLAG 0x0f
|
||||
#define ROLE_COMBO_IDX_FLAG 0xf0
|
||||
|
||||
enum ad_role_type {
|
||||
ROLE_ONLY,// ROLE_ONLY will trigger wake up immediately.
|
||||
ROLE_COMBO,//ROLE_COMBO will trigger When all the conditions (ad_role == ROLE_COMBO,and ad_filter is matching)are met.
|
||||
};
|
||||
|
||||
enum gpio_combo_idx {
|
||||
COMBO_0,
|
||||
COMBO_1,
|
||||
};
|
||||
|
||||
enum gpio_trigger_bit {
|
||||
TG_IDX_0 = (1<<0),
|
||||
TG_IDX_1 = (1<<1),
|
||||
};
|
||||
|
||||
struct wakeup_ad_data_filter {
|
||||
uint32_t ad_data_mask;
|
||||
uint8_t gpio_trigger_idx;
|
||||
uint8_t ad_role;//from enum ad_role_type
|
||||
uint8_t ad_len;
|
||||
uint8_t ad_type;
|
||||
uint8_t ad_data[31];
|
||||
bdaddr_t wl_addr;
|
||||
};
|
||||
|
||||
struct ble_wakeup_param_t {
|
||||
uint32_t magic_num;// "BLES" = 0x53454C42
|
||||
uint32_t delay_scan_to;// timeout for start scan in ms
|
||||
uint32_t reboot_to;// timeout for reboot in ms
|
||||
uint32_t gpio_num[MAX_GPIO_TRIGGER_NUM];
|
||||
uint32_t gpio_dft_lvl[MAX_GPIO_TRIGGER_NUM];
|
||||
struct wakeup_ad_data_filter ad_filter[MAX_AD_FILTER_NUM];
|
||||
};
|
||||
|
||||
/// Structure containing the parameters of the @ref DBG_START_APP_REQ message.
|
||||
struct wf_start_app_param
|
||||
{
|
||||
uint32_t bootaddr;
|
||||
uint32_t boottype;
|
||||
};
|
||||
|
||||
struct hci_dbg_rd_mem_cmd {
|
||||
__le32 start_addr;
|
||||
__u8 type;
|
||||
__u8 length;
|
||||
}__attribute__ ((packed));
|
||||
|
||||
struct hci_dbg_rd_mem_cmd_evt {
|
||||
__u8 status;
|
||||
__u8 length;
|
||||
__u8 data[HCI_VSC_MEM_RD_SIZE];
|
||||
}__attribute__ ((packed));
|
||||
|
||||
struct long_buffer_tag {
|
||||
__u8 length;
|
||||
__u8 data[HCI_VSC_MEM_WR_SIZE];
|
||||
};
|
||||
|
||||
struct hci_dbg_wr_mem_cmd {
|
||||
__le32 start_addr;
|
||||
__u8 type;
|
||||
__u8 length;
|
||||
__u8 data[HCI_VSC_MEM_WR_SIZE];
|
||||
};
|
||||
|
||||
struct aicbt_patch_table {
|
||||
char *name;
|
||||
uint32_t type;
|
||||
uint32_t *data;
|
||||
uint32_t len;
|
||||
struct aicbt_patch_table *next;
|
||||
};
|
||||
|
||||
struct aicbt_patch_info_t {
|
||||
uint32_t info_len;
|
||||
//base len start
|
||||
uint32_t adid_addrinf;
|
||||
uint32_t addr_adid;
|
||||
uint32_t patch_addrinf;
|
||||
uint32_t addr_patch;
|
||||
uint32_t reset_addr;
|
||||
uint32_t reset_val;
|
||||
uint32_t adid_flag_addr;
|
||||
uint32_t adid_flag;
|
||||
//base len end
|
||||
//ext patch nb
|
||||
uint32_t ext_patch_nb_addr;
|
||||
uint32_t ext_patch_nb;
|
||||
uint32_t *ext_patch_param;
|
||||
};
|
||||
|
||||
|
||||
struct aicbt_patch_table_cmd {
|
||||
uint8_t patch_num;
|
||||
uint32_t patch_table_addr[31];
|
||||
uint32_t patch_table_data[31];
|
||||
}__attribute__ ((packed));
|
||||
|
||||
|
||||
enum aic_endpoit {
|
||||
CTRL_EP = 0,
|
||||
INTR_EP = 3,
|
||||
BULK_EP = 1,
|
||||
ISOC_EP = 4
|
||||
};
|
||||
|
||||
/* #define HCI_VERSION_CODE KERNEL_VERSION(3, 14, 41) */
|
||||
#define HCI_VERSION_CODE LINUX_VERSION_CODE
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
|
||||
#define NUM_REASSEMBLY 3
|
||||
#else
|
||||
#define NUM_REASSEMBLY 4
|
||||
#endif
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
|
||||
|
||||
#define IOCTL_CHAR_DEVICE_NAME "aic_btusb_ex_dev"
|
||||
|
||||
#define SET_APCF_PARAMETER _IOR('E', 181, int)
|
||||
|
||||
static dev_t ioctl_devid; /* bt char device number */
|
||||
static struct cdev ioctl_char_dev; /* bt character device structure */
|
||||
static struct class *ioctl_char_class; /* device class for usb char driver */
|
||||
|
||||
extern struct file_operations ioctl_chrdev_ops;
|
||||
|
||||
extern void btchr_external_write(char* data, int len);
|
||||
|
||||
static long ioctl_ioctl(struct file *file_p,unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
char data[1024];
|
||||
int ret = 0;
|
||||
|
||||
printk("%s enter\r\n", __func__);
|
||||
memset(data, 0, 1024);
|
||||
switch(cmd)
|
||||
{
|
||||
case SET_APCF_PARAMETER:
|
||||
printk("set apcf parameter\r\n");
|
||||
ret = copy_from_user(data, (int __user *)arg, 1024);
|
||||
btchr_external_write(&data[1], (int)data[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("unknow cmdr\r\n");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static long compat_ioctlchr_ioctl (struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
return ioctl_ioctl(filp, cmd, (unsigned long) compat_ptr(arg));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
struct file_operations ioctl_chrdev_ops = {
|
||||
unlocked_ioctl : ioctl_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
compat_ioctl : compat_ioctlchr_ioctl,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
static int __init init_extenal_ioctl(void){
|
||||
int res = 0;
|
||||
struct device *dev;
|
||||
|
||||
printk("%s enter\r\n", __func__);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
ioctl_char_class = class_create(IOCTL_CHAR_DEVICE_NAME);
|
||||
#else
|
||||
ioctl_char_class = class_create(THIS_MODULE, IOCTL_CHAR_DEVICE_NAME);
|
||||
#endif
|
||||
if (IS_ERR(ioctl_char_class)) {
|
||||
printk("Failed to create ioctl char class");
|
||||
}
|
||||
|
||||
res = alloc_chrdev_region(&ioctl_devid, 0, 1, IOCTL_CHAR_DEVICE_NAME);
|
||||
if (res < 0) {
|
||||
printk("Failed to allocate ioctl char device");
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
dev = device_create(ioctl_char_class, NULL, ioctl_devid, NULL, IOCTL_CHAR_DEVICE_NAME);
|
||||
if (IS_ERR(dev)) {
|
||||
printk("Failed to create ioctl char device");
|
||||
res = PTR_ERR(dev);
|
||||
goto err_create;
|
||||
}
|
||||
|
||||
cdev_init(&ioctl_char_dev, &ioctl_chrdev_ops);
|
||||
res = cdev_add(&ioctl_char_dev, ioctl_devid, 1);
|
||||
if (res < 0) {
|
||||
printk("Failed to add ioctl char device");
|
||||
goto err_add;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
err_add:
|
||||
device_destroy(ioctl_char_class, ioctl_devid);
|
||||
err_create:
|
||||
unregister_chrdev_region(ioctl_devid, 1);
|
||||
err_alloc:
|
||||
class_destroy(ioctl_char_class);
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
static void __exit deinit_extenal_ioctl(void){
|
||||
printk("%s enter\r\n", __func__);
|
||||
device_destroy(ioctl_char_class, ioctl_devid);
|
||||
cdev_del(&ioctl_char_dev);
|
||||
unregister_chrdev_region(ioctl_devid, 1);
|
||||
class_destroy(ioctl_char_class);
|
||||
|
||||
}
|
||||
|
||||
module_init(init_extenal_ioctl);
|
||||
module_exit(deinit_extenal_ioctl);
|
||||
|
||||
|
||||
MODULE_AUTHOR("AicSemi Corporation");
|
||||
MODULE_DESCRIPTION("AicSemi Bluetooth USB driver version");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
void btchr_external_write(char* data, int len);
|
||||
|
||||
-12
@@ -289,18 +289,6 @@ install_firmware() {
|
||||
print_warning "Udev rules file not found: $rules_source"
|
||||
fi
|
||||
|
||||
# Install modprobe configuration for Bluetooth
|
||||
local modprobe_source="${SCRIPT_DIR}/modprobe/aic8800-bt.conf"
|
||||
local modprobe_dest="/etc/modprobe.d/aic8800-bt.conf"
|
||||
|
||||
if [ -f "$modprobe_source" ]; then
|
||||
print_info "Installing modprobe configuration to $modprobe_dest..."
|
||||
cp "$modprobe_source" "$modprobe_dest" >> "$LOG_FILE" 2>&1
|
||||
print_success "Modprobe configuration installed successfully."
|
||||
else
|
||||
print_warning "Modprobe configuration file not found: $modprobe_source"
|
||||
fi
|
||||
|
||||
# Install usb_modeswitch configuration
|
||||
local modeswitch_source="${SCRIPT_DIR}/usb_modeswitch/1111_1111"
|
||||
local modeswitch_dest="/etc/usb_modeswitch.d/1111:1111"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# AIC8800D80 Bluetooth - prevent generic btusb from claiming the device
|
||||
#
|
||||
# The kernel's built-in btusb driver matches any USB device with Bluetooth
|
||||
# interface class (0xe0/0x01/0x01), but it doesn't know how to initialize
|
||||
# the AIC8800 BT controller, resulting in HCI_Reset timeout errors.
|
||||
#
|
||||
# The AIC-specific aic_btusb module must handle these devices instead.
|
||||
|
||||
# Ensure aic_btusb loads before btusb can claim AIC devices
|
||||
softdep btusb pre: aic_btusb
|
||||
|
||||
# Auto-load aic_btusb when the AIC8800 device is present
|
||||
alias usb:v0A69Cp8D83d*dc*dsc*dp*icE0isc01ip01in* aic_btusb
|
||||
alias usb:v0A69Cp8D81d*dc*dsc*dp*icE0isc01ip01in* aic_btusb
|
||||
alias usb:v368Bp8D81d*dc*dsc*dp*icE0isc01ip01in* aic_btusb
|
||||
Reference in New Issue
Block a user