jiangdou 发表于 2014-12-19 14:27:59

CB1 android增加USB蓝牙支持

本帖最后由 jiangdou 于 2014-12-29 09:53 编辑

USB蓝牙:http://item.taobao.com/item.htm? ... 9&qq-pf-to=pcqq.c2c


配置内核支持Bluetooth,

1.1 make menuconfig

--- Bluetooth subsystem support                                                                           
       [*]   L2CAP protocol support                                                                           
       [*]   SCO links support                                                                                 
       <*>   RFCOMM protocol support                                                                           
       [*]   RFCOMM TTY support                                                                              
       <*>   BNEP protocol support                                                                           
       [*]   Multicast filter support                                                                        
       [*]   Protocol filter support                                                                     
       <*>   HIDP protocol support                                                                              
          Bluetooth device drivers--->      
               <*> HCI USB driver                                                      
                                                                           

2.android层:

2.1加bluetooth权限:在/device/softwinner/crane-common/ProductCommon.mk

frameworks/base/data/etc/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml

在android.hardware.bluetooth.xml:

<permissions>
    <feature name="android.hardware.bluetooth" />
</permissions>

2.2加usb host权限

frameworks/base/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml

在android.hardware.usb.host.xml 里写:

<permissions>
    <feature name="android.hardware.usb.host" />
</permissions>

2.3 在/device/softwinner/crane-common/tablet_core_hardware.xml:
<feature name="android.hardware.bluetooth" />
    <feature name="android.hardware.usb.host" />
3.init.sun4i.rc

# change rfkill permissions for bluetooth power management
chmod 0666 /sys/class/rfkill/rfkill0/state
chmod 0666 /sys/class/rfkill/rfkill0/type
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
write /sys/class/rfkill/rfkill0/state 0
setprop rw.bluetooth.status "0"

4.device\softwinner\apollo-mele\BoardConfig.mk

BOARD_HAVE_BLUETOOTH := true

5. bluetooh name modify :external\bluetooth\bluez\src\main.c

static void init_defaults(void)
{
/* Default HCId settings */
memset(&main_opts, 0, sizeof(main_opts));
main_opts.mode= MODE_CONNECTABLE;
main_opts.name= g_strdup("BlueZ");//modify to BlueZ -> cubieb1



亲测可以用
usb蓝牙设备节点在,,/sys/class/rfkill/rf

root@android:/ # cat /sys/class/rfkill/rfkill1/                              
claim      hard       name       power/   state      type      
device/    index      persistent soft       subsystem/ uevent   
/rfkill/rfkill1/device/address                                                <
00:15:83:0C:BF:EB
root@android:/ # hciconfig                                                   
hci0:    Type: BR/EDRBus: USB
    BD Address: 00:15:83:0C:BF:EBACL MTU: 339:8SCO MTU: 128:2
    UP RUNNING PSCAN
    RX bytes:2286 acl:0 sco:0 events:77 errors:0
    TX bytes:787 acl:0 sco:0 commands:64 errors:1

root@android:/ #


页: [1]
查看完整版本: CB1 android增加USB蓝牙支持