蓝牙适配器(USB):胜为 UDC-321
Linux 2.6.29
首先查看USB是否识别:
#lsusb
Bus 005 Device 004: ID 0402:5602 ALi Corp. Video Camera Controller
Bus 005 Device 003: ID 05e3:0718 Genesys Logic, Inc.
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 015: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:c062 Logitech, Inc.
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
说明USB正确识别。
查看系统的蓝牙设备:
#hciconfig -a
该命令没输出。
注:hciconfig 等命令属于 bluez-utils,Debian 系统可以使用 apt-get install bluez-utils 安装
查看系统设备:
cat /proc/bus/usb/devices | more
lhvictor:/home/lh/usr-level-dsmip/lightdsmip# cat /proc/bus/usb/devices | more.
…
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 13/900 us ( 1%), #Int= 1, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0001 Rev= 2.06
S: Manufacturer=Linux 2.6.29 uhci_hcd
S: Product=UHCI Host Controller
S: SerialNumber=0000:00:1d.1
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 15 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(unk. ) Sub=01 Prot=01 MxPS=16 #Cfgs= 1
P: Vendor=0a12 ProdID=0001 Rev= 1.34
C:* #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(unk. ) Sub=01 Prot=01 Driver=(none)
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
可以看到,原因是没有找到相应的驱动。经查,是因为linux 2.6.29没有hci_usb驱动所致。
解决办法,从2.6.27版本及以前的版本中,获取
/drivers/bluetooth/hci_usb.c and hci_usb.h
/drivers/bluetooth/hci_usb.c and hci_usb.c
编译hci_usb模块即可。
其中,会出现编译错误,error: ‘HCI_QUIRK_RESET_ON_INIT’ undeclared ,
解决办法:打开hci_usb.c,把HCI_QUIRK_RESET_ON_INIT修改为HCI_QUIRK_NO_RESET
加载hci_usb模块:
insmod hci_usb.ko
再次查看蓝牙设备:
#hciconfig -a
hci0: Type: USB
BD Address: 00:15:83:15:A3:10 ACL MTU: 339:8 SCO MTU: 128:2
UP RUNNING PSCAN ISCAN
RX bytes:1413 acl:0 sco:0 events:35 errors:0
TX bytes:358 acl:0 sco:0 commands:28 errors:0
Features: 0xff 0x3e 0x85 0x30 0x18 0x18 0x00 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: ‘lhvictor-0’
Class: 0x000104
Service Classes: Unspecified
Device Class: Computer, Desktop workstation
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c
Manufacturer: Cambridge Silicon Radio (10)
说明蓝牙设备已正确识别。