H3平台蓝牙模块移植说明

free-jdx 2020-10-15 19:00:00 4927
1.前言

描述使用allwinner SDK 如何支持一款蓝牙模块

2. 模块介绍

目前H3 android4.4.2平台上已支持的蓝牙模组有6款,其中包括USB蓝牙,支持列表如表


DOSH:视具体硬件而定,只要是标准的USB蓝牙都支持;

3.修改说明
(1)lichee

a. 内核配置

命令行进入到linux-3.4目录,如果之前没有编译过lichee,则先要将要使用的defconfig文件拷贝到.config文件,执行命令cp arch\arm\configs\要使用的defconfig文件 .config,然后再输入命令make ARCH=arm menuconfig进入内核配置界面,选上如下选项:

[*] Networking support --->
<*> Bluetooth subsystem support --->
    <*> RFCOMM protocol support
    [*]    RFCOMM TTY support
    <*> BNEP protocol support
    [*]    Multicast filter support
    [*]    Protocol filter support
    <*> HIDP protocol support
        Bluetooth device drivers --->
            <*> HCI UART driver
            [*] UART (H4) protocol support
            [M] Broadcom Bluetooth Low Power Manager Support
            [M] Realtek Bluesleep driver support
<*> RF switch subsystem support --->

b. sys_config.fex修改
配置较为简单,bt_uart_baud默认配置为1500000,请不要随意改动,否则会到导致蓝牙打不开。

[bt_para]
bt_used               = 1
bt_uart_id            = 1
bt_uart_baud          = 1500000
bt_rst_n              = port:PG12<1><default><default><0>
bt_wake               = port:PG11<1><default><default><0>
bt_host_wake          = port:PG13<0><default><default><0>
bt_host_wake_invert   = 0

说明如下:
bt_used: 0- 不使用蓝牙, 1- 使用蓝牙
bt_uard_id: 蓝牙使用哪一组串口,0-uart0,1-uart1
bt_uart_baud: 串口波特率,单位:bps
bt_rst_n: 蓝牙使能脚
bt_wake: 主控唤醒蓝牙引脚
bt_host_wake: 蓝牙唤醒主控引脚
bt_host_wake_invert: 蓝牙唤醒主控引脚到主控之间是否有加反相器,0-没有,1-有

确定蓝牙使用哪一组串口后,需要将对应的串口配置成uart_used=1。

[uart1]
uart_used       = 1
uart_port       = 1
uart_type       = 4
uart_tx         = port:PG06<2><1><default><default>
uart_rx         = port:PG07<2><1><default><default>
uart_rts        = port:PG08<2><1><default><default>
uart_cts        = port:PG09<2><1><default><default>

c. USB蓝牙
上面的移植说明都是针对非USB蓝牙模组的,如果所使用的蓝牙模组不在表1中,则系统会使用USB蓝牙。此时,如果不插入USB蓝牙适配器,那么在原生Setting里是不会显示蓝牙设置选项的。

(2)android

a. BoardConfig.mk

# 1. Wifi Configuration
#BOARD_WIFI_VENDOR := realtek
BOARD_WIFI_VENDOR := broadcom

# 1.2 broadcom wifi support
ifeq ($(BOARD_WIFI_VENDOR), broadcom)
    BOARD_WPA_SUPPLICANT_DRIVER := NL80211
    WPA_SUPPLICANT_VERSION      := VER_0_8_X
    BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
    BOARD_HOSTAPD_DRIVER        := NL80211
    BOARD_HOSTAPD_PRIVATE_LIB   := lib_driver_cmd_bcmdhd
    BOARD_WLAN_DEVICE           := bcmdhd
    WIFI_DRIVER_FW_PATH_PARAM   := "/sys/module/bcmdhd/parameters/firmware_path"

    SW_BOARD_USR_WIFI := AP6212
    include hardware/broadcom/wlan/bcmdhd/firmware/firmware-bcm.mk
endif

# 2. Bluetooth Configuration
# make sure BOARD_HAVE_BLUETOOTH is true for every bt vendor
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_BCM := true
#BLUETOOTH_HCI_USE_USB := true
#BOARD_HAVE_BLUETOOTH_RTK := true
#BLUETOOTH_HCI_USE_RTK_H5 := true
SW_BOARD_HAVE_BLUETOOTH_NAME := ap6212
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/softwinner/dolphin-fvd-p1/bluetooth/
#BOARD_BLUETOOTH_DOES_NOT_USE_RFKILL := true

b. dolphin_fvd_p1.mk
不使用USB蓝牙,修改如下:

PRODUCT_PACKAGES += \
    Bluetooth

BLUETOOTH_HCI_USE_USB := false
ifeq ($(BLUETOOTH_HCI_USE_USB), true)
PRODUCT_PACKAGES += \
    USBBT
PRODUCT_PACKAGES += \

c. init.rc

on boot
# insmod network
    insmod /system/vendor/modules/bcmdhd.ko
    insmod /system/vendor/modules/bcm_btlpm.ko

# bcm bluetooth
    # uart device
    chmod 660 /dev/ttyS1
    chown bluetooth net_bt_stack /dev/ttyS1
    mkdir /data/misc/bluedroid 770 bluetooth net_bt_stack

    # power up/down interface
    chmod 0660 /sys/class/rfkill/rfkill0/state
    chmod 0660 /sys/class/rfkill/rfkill0/type
    chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state
    chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type
    write /sys/class/rfkill/rfkill0/state 0

    # bluetooth MAC address programming
    chown bluetooth net_bt_stack ro.bt.bdaddr_path
    chown bluetooth net_bt_stack /system/etc/bluetooth
    chown bluetooth net_bt_stack /data/misc/bluetooth
    setprop ro.bt.bdaddr_path "/data/misc/bluetooth/bdaddr"

    # bluetooth LPM
    chmod 0220 /proc/bluetooth/sleep/lpm
    chmod 0220 /proc/bluetooth/sleep/btwrite
    chown bluetooth net_bt_stack /proc/bluetooth/sleep/lpm
chown bluetooth net_bt_stack /proc/bluetooth/sleep/btwrite

# broadcom wifi service
# 1 broadcom wifi station and softap
service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \
    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
    -O/data/misc/wifi/sockets \
    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

# 2 braodcom wifi sta p2p concurrent service
service p2p_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \
    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
    -O/data/misc/wifi/sockets -N \
    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
    -I/system/etc/wifi/p2p_supplicant_overlay.conf \
    -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \
    -g@android:wpa_wlan0
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
free-jdx
红包 14 6 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
free-jdx
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区