![如何使用 SPP 配对 Datalogic QuickScan 蓝牙条码扫描仪?](https://linux22.com/image/144718/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20SPP%20%E9%85%8D%E5%AF%B9%20Datalogic%20QuickScan%20%E8%93%9D%E7%89%99%E6%9D%A1%E7%A0%81%E6%89%AB%E6%8F%8F%E4%BB%AA%EF%BC%9F.png)
我想在“串行端口配置文件模式”下配对蓝牙条码扫描仪(SPPbluetoothctl
)在 Arch Linux 上使用。该设备是:
[bluetooth]# info 00:07:BE:1C:40:C4
Device 00:07:BE:1C:40:C4 (public)
Name: QuickScan-i-QBT2131 E17C07052
Alias: QuickScan-i-QBT2131 E17C07052
Class: 0x00180000
Paired: no
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: yes
我扫描了条形码“启用射频链接到服务器”。
随着scan on
设备变得可见:
[NEW] Device 00:07:BE:1C:40:C4 00-07-BE-1C-40-C4
[CHG] Device 00:07:BE:1C:40:C4 LegacyPairing: no
[CHG] Device 00:07:BE:1C:40:C4 Name: QuickScan-i-QBT2131 E17C07052
[CHG] Device 00:07:BE:1C:40:C4 Alias: QuickScan-i-QBT2131 E17C07052
[CHG] Device 00:07:BE:1C:40:C4 LegacyPairing: yes
但是配对失败:
[NEW] Device 00:07:BE:1C:40:C4 00-07-BE-1C-40-C4
[CHG] Device 00:07:BE:1C:40:C4 LegacyPairing: no
[CHG] Device 00:07:BE:1C:40:C4 Name: QuickScan-i-QBT2131 E17C07052
[CHG] Device 00:07:BE:1C:40:C4 Alias: QuickScan-i-QBT2131 E17C07052
[CHG] Device 00:07:BE:1C:40:C4 LegacyPairing: yes
回归
我尝试禁用条形码扫描仪上的“LegacyPairing”:
- 扫描条码:进入编程模式
- 扫描条形码:BT 安全模式 = 禁用
- 扫描条码:退出编程模式
结果:Request PIN code
我尝试使用“Agent”“KeyboardOnly”和“NoInputNoOutput”。
结果:Request PIN code
只需输入0000
或1234
结果:
[agent] Enter PIN code: 1234
Failed to pair: org.bluez.Error.AuthenticationRejected
请求 PIN 码 [代理] 输入 PIN 码:
意味着您必须使用计算机键盘输入 PIN 码,以便稍后使用条形码扫描仪进行扫描。对于此 Datalogic 扫描仪,当设备要求您扫描先前输入的 PIN 码时,设备会亮起屏幕。
我在 HID 模式下确实有一些运气,通过将代理设置为 KeyboardOnly,通过扫描条形码来配置条形码扫描仪:
- “取消链接”
- “可变 PIN 码”
- “链接到 HID 中的 PC”
→ Pairing successful
→ hci0: last event is not cmd complete (0x0f)
。
HID:无需扫描条码 可变 PIN 码
扫描“恢复 EU 出厂配置”后,计算机重新启动并且不扫描“可变 PIN 码”,因此仅扫描“取消链接”和“链接到 HID 中的 PC”会出现这种情况:
[bluetooth]# pair 00:07:BE:1C:40:C4
Attempting to pair with 00:07:BE:1C:40:C4
[CHG] Device 00:07:BE:1C:40:C4 Connected: yes
[agent] PIN code: 352950
[CHG] Device 00:07:BE:1C:40:C4 Connected: no
[CHG] Device 00:07:BE:1C:40:C4 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationRejected
[CHG] Device 00:07:BE:1C:40:C4 Connected: no
现在需要 6 位 PIN 码,1 秒后连接就会断开。
SPP
对于串行“启用 RF 链接到服务器”,配对结果有所不同:
# bluetoothctl
Agent registered
[bluetooth]# agent off
Agent unregistered
[bluetooth]# agent KeyboardOnly
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 14:4F:8A:30:DF:AD Discovering: yes
[CHG] Device 00:07:BE:1C:40:C4 LegacyPairing: yes
[CHG] Device 00:07:BE:1C:40:C4 RSSI: -61
[bluetooth]# pair 00:07:BE:1C:40:C4
Attempting to pair with 00:07:BE:1C:40:C4
[CHG] Device 00:07:BE:1C:40:C4 Connected: yes
Request PIN code
[agent] Enter PIN code: 0000
Failed to pair: org.bluez.Error.AuthenticationTimeout
[CHG] Device 00:07:BE:1C:40:C4 Connected: no
QuickScan 上表示 PIN 码输入模式的绿灯未亮起。断开连接发生在 10 到 20 秒之间。
如何在串行模式下配对/连接此蓝牙条码扫描仪?