• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscaphegui翻訳comegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

system/bt


コミットメタ情報

リビジョンa6699ca43fbe85ab731ae30ccddc3eabfc325dc9 (tree)
日時2019-11-14 13:21:27
作者Chih-Wei Huang <cwhuang@linu...>
コミッターChih-Wei Huang

ログメッセージ

Support generic USB Bluetooth adapter

Find USB Bluetooth adapter according to device class and subclass.
See https://www.usb.org/defined-class-codes#anchor_BaseClassE0h.

変更サマリ

差分

--- a/vendor_libs/linux/interface/h4_protocol.cc
+++ b/vendor_libs/linux/interface/h4_protocol.cc
@@ -37,12 +37,6 @@ typedef uint16_t UINT16;
3737 #define T2_MAXIMUM_LATENCY 0x000D
3838 #define HCIC_PARAM_SIZE_ENH_ACC_ESCO_CONN 63
3939
40-#define INTEL_VID 0x8087
41-#define INTEL_PID_8265 0x0a2b // Windstorm peak
42-#define INTEL_PID_3168 0x0aa7 //SandyPeak (SdP)
43-#define INTEL_PID_9260 0x0025 // 9160/9260 (also known as ThunderPeak)
44-#define INTEL_PID_9560 0x0aaa // 9460/9560 also know as Jefferson Peak (JfP)
45-
4640 #include <errno.h>
4741 #include <fcntl.h>
4842 #include <log/log.h>
@@ -144,14 +138,8 @@ size_t H4Protocol::Send(uint8_t type, const uint8_t* data, size_t length) {
144138 return ret;
145139 }
146140
147-bool H4Protocol::IsIntelController(uint16_t vid, uint16_t pid) {
148- if ((vid == INTEL_VID) && ((pid == INTEL_PID_8265) ||
149- (pid == INTEL_PID_3168)||
150- (pid == INTEL_PID_9260)||
151- (pid == INTEL_PID_9560)))
152- return true;
153- else
154- return false;
141+bool IsBtController(uint8_t deviceClass, uint8_t deviceSubClass) {
142+ return deviceClass == LIBUSB_CLASS_WIRELESS && deviceSubClass == 0x01;
155143 }
156144
157145 void H4Protocol::GetUsbpath(void) {
@@ -159,7 +147,6 @@ void H4Protocol::GetUsbpath(void) {
159147 int ret, busnum, devnum;
160148 struct libusb_device **dev_list = NULL;
161149 struct libusb_context *ctx;
162- uint16_t vid = 0, pid = 0;
163150 ALOGD(" Initializing GenericUSB (libusb-1.0)...\n");
164151 ret = libusb_init(&ctx);
165152 if (ret < 0) {
@@ -182,12 +169,10 @@ void H4Protocol::GetUsbpath(void) {
182169 ALOGE("Error getting device descriptor %d ", ret);
183170 goto exit;
184171 }
185- vid = descriptor.idVendor;
186- pid = descriptor.idProduct;
187- if (H4Protocol::IsIntelController(vid, pid)) {
172+ if (IsBtController(descriptor.bDeviceClass, descriptor.bDeviceSubClass)) {
188173 snprintf(dev_address, sizeof(dev_address), "/dev/bus/usb/%03d/%03d",
189174 busnum, devnum);
190- ALOGV("Value of BT device address = %s", dev_address);
175+ ALOGD("Value of BT device address = %s", dev_address);
191176 goto exit;
192177 }
193178 }