找到你要的答案

Q:Issue in Bluetooth pairing

Q:蓝牙配对问题

We are testing Bluetooth in WEC2013 with a USB based dongle from generic vendor on iMx6 platform. We are using the default HCI Transport layer provided with WEC2013 BSP.

BT is turned on and able to scan all the nearby devices.

We have enabled following set of sysgen variables and registry entry.

Sysgen Variables:

SYSGEN_BTH (Bluetooth stack with universal loadable driver)
SYSGEN_BTH_BTHUTIL (Bluetooth Profile Management APIs)
SYSGEN_BTH_HID_KEYBOARD (Bluetooth HID - Keyboard)
SYSGEN_BTH_HID_MOUSE (Bluetooth HID - Mouse)
SYSGEN_BTH_AG (Bluetooth HS/HF and Audio gateway service)
SYSGEN_BTH_SETTINGS (Bluetooth settings UI)
SYSGEN_OBEX_CLIENT (Obex client)
SYSGEN_OBEX_SERVER (Obex server)
SYSGEN_OBEX_FILEBROWSER (OBEX file browser)
SYSGEN_OBEX_INBOX (OBEX Inbox)
SYSGEN_FTPD (FTP server)
SYSGEN_BTH_BTHSSVC(Support Secure Simple Pairing)

Registry entry:

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\Default\224_1_1\Default\Bluetooth_USB_Driver]
  "DLL"="bthusb.dll"

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\Default\Default\224_1_1\Bluetooth_USB_Driver]
  "DLL"="bthusb.dll"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transports\PnP\{B3DD867A-1E6E-4215-8AA7-EAC1DFC46548}]
"flags"=dword:80000000
"driver"="bthusb.dll"
"resetdelay"=dword:0
"PacketSize"=dword:200
"BlockSize"=dword:5

[HKEY_LOCAL_MACHINE\ControlPanel\Bluetooth]
"PinAttemptInterval"=dword:200000
"PinEntries"=multi_sz:"0000","8888"

We observed different scenario's in pairing to a device.

  1. Connecting to mobile from board(imx6+usb dongle running with WEC2013) Here pairing is success when pair is initiated through bthsettings UI. It will trigger the 6-digit automated passkey on both the sides.

  2. Connecting from mobile to board without opening bthsettings UI. Here pairing is success once. When the UI is not open (BT is ON in background), pairing is initiated from mobile, both will be paired using automated 6-digit passkey method. But this will internally invoke bthsettings UI, so next time when we give pairing from mobile, mobile side will ask for manual key insertion. As soon as the key is entered on mobile and pair is pressed, pairing rejected notification will be observed on mobile terminal. So pairing is failed in this case.

  3. Connecting from mobile to board when bthsettings is opened. Here pairing is failed. When pair is initiated from mobile, manual key insertion UI will be invoked and when key is inserted and pair is pressed, pairing rejected notification will be displayed on mobile terminal and pairing is failed.

In these failed senarios, the upper layer is responding with "Pin code request negative reply command" for "Pin code request event" from chip.

We need input on this pairing process. Why this automated key and manual key generation methods are invoked based on whether UI is open or never opened? And why manual key case is failing?

Are we missing any registry entry or stack feature ?

我们是一个基于USB加密狗从imx6平台通用的供应商在wec2013蓝牙测试。我们使用的是默认的HCI传输层提供wec2013 BSP。

BT打开并能够扫描所有附近的设备。

我们已经启用下列SYSGEN变量和注册表项。

SYSGEN变量:

SYSGEN_BTH (Bluetooth stack with universal loadable driver)
SYSGEN_BTH_BTHUTIL (Bluetooth Profile Management APIs)
SYSGEN_BTH_HID_KEYBOARD (Bluetooth HID - Keyboard)
SYSGEN_BTH_HID_MOUSE (Bluetooth HID - Mouse)
SYSGEN_BTH_AG (Bluetooth HS/HF and Audio gateway service)
SYSGEN_BTH_SETTINGS (Bluetooth settings UI)
SYSGEN_OBEX_CLIENT (Obex client)
SYSGEN_OBEX_SERVER (Obex server)
SYSGEN_OBEX_FILEBROWSER (OBEX file browser)
SYSGEN_OBEX_INBOX (OBEX Inbox)
SYSGEN_FTPD (FTP server)
SYSGEN_BTH_BTHSSVC(Support Secure Simple Pairing)

注册表项:

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\Default\224_1_1\Default\Bluetooth_USB_Driver]
  "DLL"="bthusb.dll"

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\Default\Default\224_1_1\Bluetooth_USB_Driver]
  "DLL"="bthusb.dll"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transports\PnP\{B3DD867A-1E6E-4215-8AA7-EAC1DFC46548}]
"flags"=dword:80000000
"driver"="bthusb.dll"
"resetdelay"=dword:0
"PacketSize"=dword:200
"BlockSize"=dword:5

[HKEY_LOCAL_MACHINE\ControlPanel\Bluetooth]
"PinAttemptInterval"=dword:200000
"PinEntries"=multi_sz:"0000","8888"

我们观察到不同的场景在配对设备。

  1. Connecting to mobile from board(imx6+usb dongle running with WEC2013) Here pairing is success when pair is initiated through bthsettings UI. It will trigger the 6-digit automated passkey on both the sides.

  2. Connecting from mobile to board without opening bthsettings UI. Here pairing is success once. When the UI is not open (BT is ON in background), pairing is initiated from mobile, both will be paired using automated 6-digit passkey method. But this will internally invoke bthsettings UI, so next time when we give pairing from mobile, mobile side will ask for manual key insertion. As soon as the key is entered on mobile and pair is pressed, pairing rejected notification will be observed on mobile terminal. So pairing is failed in this case.

  3. Connecting from mobile to board when bthsettings is opened. Here pairing is failed. When pair is initiated from mobile, manual key insertion UI will be invoked and when key is inserted and pair is pressed, pairing rejected notification will be displayed on mobile terminal and pairing is failed.

在这些失败的场景,上层是“PIN码要求消极应答命令”为“PIN码请求事件”从芯片的响应。

我们需要在配对过程中输入。为什么自动键和手动密钥生成方法被调用基于UI是否打开或从未打开?为什么手动键的情况下是失败的?

是否缺少注册表项或堆栈特性?

answer1: 回答1:

It all got to do with SSP(Secured Simple Pairing), which decides the pairing authentication model. This is affected in WEC8(2013) through the changes under bthsettings.

Under WEC8 they disable SSP(via function EnbaleSSP()) whenever a connection is initiated from external device and enable back SSP when conenction is initiated internally. Though this is the logic, I'm not aware of why this is introduced(and is it a bug, that'll be fixed in upcoming updates as they initially did for NDIS 5 wireless driver connection).

And as a workaround to this, disable EnableSSP().

Also SYSGEN_BTH_BTHSSVC is implicitly needed by SYSGEN_BTH_SETTINGS component, and the link is broken under WEC8.

Microsoft has provided the fix in April 2015 update. Details available here.

这一切跟SSP(安全简单的配对),这决定了对认证模型。这是影响wec8(2013)通过在bthsettings变化。

wec8他们禁用SSP下(通过功能enbalessp())每当连接从外部设备启动和重新启用SSP时启动内部连接。虽然这是逻辑,我不知道这是为什么了(它是一个错误,那就定在即将到来的更新他们当初对NDIS 5无线驱动程序连接)。

作为一个解决方法,禁用enablessp()。

也sysgen_bth_bthssvc由sysgen_bth_settings成分隐含的需要,和链路断下wec8。

微软提供了修复在四月2015更新。详情可在此。

bluetooth  embedded  windows-ce  windows-embedded-compact  hci