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.
@@ -37,12 +37,6 @@ typedef uint16_t UINT16; | ||
37 | 37 | #define T2_MAXIMUM_LATENCY 0x000D |
38 | 38 | #define HCIC_PARAM_SIZE_ENH_ACC_ESCO_CONN 63 |
39 | 39 | |
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 | - | |
46 | 40 | #include <errno.h> |
47 | 41 | #include <fcntl.h> |
48 | 42 | #include <log/log.h> |
@@ -144,14 +138,8 @@ size_t H4Protocol::Send(uint8_t type, const uint8_t* data, size_t length) { | ||
144 | 138 | return ret; |
145 | 139 | } |
146 | 140 | |
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; | |
155 | 143 | } |
156 | 144 | |
157 | 145 | void H4Protocol::GetUsbpath(void) { |
@@ -159,7 +147,6 @@ void H4Protocol::GetUsbpath(void) { | ||
159 | 147 | int ret, busnum, devnum; |
160 | 148 | struct libusb_device **dev_list = NULL; |
161 | 149 | struct libusb_context *ctx; |
162 | - uint16_t vid = 0, pid = 0; | |
163 | 150 | ALOGD(" Initializing GenericUSB (libusb-1.0)...\n"); |
164 | 151 | ret = libusb_init(&ctx); |
165 | 152 | if (ret < 0) { |
@@ -182,12 +169,10 @@ void H4Protocol::GetUsbpath(void) { | ||
182 | 169 | ALOGE("Error getting device descriptor %d ", ret); |
183 | 170 | goto exit; |
184 | 171 | } |
185 | - vid = descriptor.idVendor; | |
186 | - pid = descriptor.idProduct; | |
187 | - if (H4Protocol::IsIntelController(vid, pid)) { | |
172 | + if (IsBtController(descriptor.bDeviceClass, descriptor.bDeviceSubClass)) { | |
188 | 173 | snprintf(dev_address, sizeof(dev_address), "/dev/bus/usb/%03d/%03d", |
189 | 174 | busnum, devnum); |
190 | - ALOGV("Value of BT device address = %s", dev_address); | |
175 | + ALOGD("Value of BT device address = %s", dev_address); | |
191 | 176 | goto exit; |
192 | 177 | } |
193 | 178 | } |