我正在尝试在 Ubuntu 13.10(已安装最新内核和更新)下将我的 Harmony Smart Control 设置为 PS3 蓝牙遥控器(它假装是这个遥控器)。我的蓝牙适配器无法开箱即用,因此我不得不执行以下操作:
modprobe btusb
echo "050d 065a" >> /sys/bus/usb/drivers/btusb/new_id
之后,我可以使用 GUI 中的蓝牙管理器完美配对遥控器。根据 bt-device,它看起来像一个普通的 PS3 遥控器:
root@server:/dev/input# bt-device -i "BD Remote Contol"
[00:04:20:E8:B4:B4]
Name: BD Remote Contol
Alias: BD Remote Contol [rw]
Address: 00:04:20:E8:B4:B4
Icon: undefined
Class: 0x250c
Paired: 1
Trusted: 1 [rw]
Blocked: 0 [rw]
Connected: 1
UUIDs: [HumanInterfaceDevice, PnPInformation, 00001800-0000-1000-8000-00805f9b34fb]
我可以看到每次按下按键时都会从蓝牙发送如下的数据包:
root@server:/dev/input# hcidump -x -i hci0
HCI sniffer - Bluetooth packet analyzer ver 2.5
device: hci0 snap_len: 1500 filter: 0xffffffffffffffff
> ACL data: handle 11 flags 0x02 dlen 17
L2CAP(d): cid 0x0041 len 13 [psm 0]
A1 01 00 00 00 00 FF FF FF FF FF 01 05
> ACL data: handle 11 flags 0x02 dlen 17
L2CAP(d): cid 0x0041 len 13 [psm 0]
A1 01 00 00 00 FF FF FF FF FF FF 00 05
因此配对肯定没问题,并且按键已收到。根据系统日志,该设备被识别为输入设备:
Bluetooth: HIDP (Human Interface Emulation) ver 1.2
Bluetooth: HIDP socket layer initialized
input: Bluetooth HID Boot Protocol Device as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/bluetooth/hci0/hci0:11/input14
但是当我在设备上执行 evtest 时,我只得到这个:
root@server:/dev/input# evtest /dev/input/event6
Input driver version is 1.0.1
Input device ID: bus 0x5 vendor 0x46d product 0xc129 version 0x0
Input device name: "Bluetooth HID Boot Protocol Device"
Supported events:
Event type 0 (EV_SYN)
Properties:
Testing ... (interrupt to exit)
在我看来,这个遥控器只有一种事件类型,而且没有按键会触发它。下面是我的加密狗的 lsusb 附加输出 [1]。我的问题:
- btusb 是正确的内核模块吗?
- 为什么我必须使用 echo 命令才能让模块识别我的加密狗?
- 我是否需要对输入层进行额外配置才能识别其他事件类型?
[1] 蓝牙适配器的 lsusb 输出:http://pastebin.com/xHM5YZXB
答案1
您可能已经修复了这个问题,但为了以防万一,这里是我用来使其在内核为 3.12.6 的 Arch Linux 下运行的内核补丁:
diff -u linux-3.12.org/drivers/hid/hid-core.c linux-3.12/drivers/hid/hid-core.c
--- linux-3.12.org/drivers/hid/hid-core.c 2013-11-03 16:41:51.000000000 -0700
+++ linux-3.12/drivers/hid/hid-core.c 2014-01-10 19:53:45.000000000 -0700
@@ -1738,6 +1738,7 @@
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_SMART_PS3) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) },
@@ -2347,7 +2348,8 @@
return true;
break;
case USB_VENDOR_ID_LOGITECH:
- if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST &&
+ if (hdev->product != USB_DEVICE_ID_LOGITECH_HARMONY_SMART_PS3 &&
+ hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST &&
hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST)
return true;
/*
diff -u linux-3.12.org/drivers/hid/hid-ids.h linux-3.12/drivers/hid/hid-ids.h
--- linux-3.12.org/drivers/hid/hid-ids.h 2013-11-03 16:41:51.000000000 -0700
+++ linux-3.12/drivers/hid/hid-ids.h 2014-01-10 19:47:39.000000000 -0700
@@ -542,6 +542,7 @@
#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
#define USB_DEVICE_ID_LOGITECH_HARMONY_PS3 0x0306
+#define USB_DEVICE_ID_LOGITECH_HARMONY_SMART_PS3 0xc129
#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD 0xc20a
#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211
#define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215
diff -u linux-3.12.org/drivers/hid/hid-sony.c linux-3.12/drivers/hid/hid-sony.c
--- linux-3.12.org/drivers/hid/hid-sony.c 2013-11-03 16:41:51.000000000 -0700
+++ linux-3.12/drivers/hid/hid-sony.c 2014-01-10 19:47:39.000000000 -0700
@@ -709,6 +709,9 @@
/* Logitech Harmony Adapter for PS3 */
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3),
.driver_data = PS3REMOTE },
+ /* Logitech Harmony Smart Control for PS3 */
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_SMART_PS3),
+ .driver_data = PS3REMOTE },
{ }
};
MODULE_DEVICE_TABLE(hid, sony_devices);
按键映射不太好——我接下来正在研究这个问题!