Android4.2.2开启USB和Bluetooth Tether功能
产品研发告一段落,对比着自己做的东西和SAMSUNG的S3,觉得缺了点什么,发现缺了Tether相关的一些功能,只有WIFI,而少了USB和BT的,故而查找了相关资料,发现在frameworks/base/core/res/res/values/config.xml相关的配置还没有添加上,本文将讲述如何添加上,让Tether功能也支持USB和BT。
方法/步骤
产品研发告一段落,对比着自己做的东西和SAMSUNG的S3,觉得缺了点什么,发现缺了Tether相关的一些功能,只有WIFI,而少了USB和BT的,故而查找了相关资料,发现在frameworks/base/core/res/res/values/config.xml相关的配置还没有添加上。
直接查看Android源码里的device/samsung/tuna/overlay/frameworks/base/core/res/res/values/config.xml文件,做了相应对比后,修改该文件,添加了如下内容:
在<string-array translatable="false" name="networkAttributes">中添加:
<item>"bluetooth,7,7,1,60000,true"</item>
在<string-array translatable="false" name="radioAttributes">中添加:
<item>"7,1"</item>
在<string-array translatable="false" name="config_tether_usb_regexs">中添加:
<item>rndis\\d</item>
在<string-array translatable="false" name="config_tether_bluetooth_regexs">中添加:
<item>"bt-pan"</item>
其中第1和2两项为添加相应的属性,而第3为USB Tether对应的设备接口,第4为BT Tether对应的设备接口。
上面配置好Android的framework后,编译烧录,发现在Settings/More.../Tethering & portabe hotspot/下多了如下两项:
USB tethering
Bluetooth tethering
除了上层的配置后,Kernel还需要注意如下配置:
1.USB
CONFIG_USB_USBNET=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_ARMLINUX=y
2.Bluetooth
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_TUN=y
还有在相应的init.xxx.rc里添加如下服务:
service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG
disabled
oneshot
service iprenew_bt-pan /system/bin/dhcpcd -n
disabled
oneshot