我有一个用于Linux的Logitech G613键盘。除了默认情况下G(1-6)键映射到F(1-6),并且没有重新映射F键就无法重新映射它们,效果很好。
因此,我浏览了Internet上的大量资源,并找到了 g15daemon 和 libg15 。不幸的是, libg15 不支持G613,但是我通过添加以下行找到了一种使库能够检测键盘的方法
DEVICE("Logitech G613",0x46d,0xc53d,G15_KEYS),
现在唯一的问题是, libg15 使用usb_detach_kernel_driver_np()
将kernerl驱动程序与设备分离,此操作成功。但是之后,对usb_set_configuration()
的调用失败了,
USB error: could not set config 1: Device or resource busy
hwinfo
的输出,在分离内核驱动程序之前
38: USB 00.0: 10800 Keyboard
[Created at usb.122]
Unique ID: ADDn.IsFhTXWBs20
Parent ID: k4bc.2DFUsyrieMD
SysFS ID: /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0
SysFS BusID: 1-1:1.0
Hardware Class: keyboard
Model: "Logitech USB Receiver"
Hotplug: USB
Vendor: usb 0x046d "Logitech, Inc."
Device: usb 0xc53d "USB Receiver"
Revision: "43.00"
Driver: "usbhid"
Driver Modules: "usbhid"
Speed: 12 Mbps
Module Alias: "usb:v046DpC53Dd4300dc00dsc00dp00ic03isc01ip01in00"
Driver Info #0:
XkbRules: xfree86
XkbModel: pc104
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #37 (Hub)
以及分离内核驱动程序后
38: USB 00.0: 10800 Keyboard
[Created at usb.122]
Unique ID: ADDn.IsFhTXWBs20
Parent ID: k4bc.2DFUsyrieMD
SysFS ID: /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0
SysFS BusID: 1-1:1.0
Hardware Class: keyboard
Model: "Logitech USB Receiver"
Hotplug: USB
Vendor: usb 0x046d "Logitech, Inc."
Device: usb 0xc53d "USB Receiver"
Revision: "43.00"
Speed: 12 Mbps
Module Alias: "usb:v046DpC53Dd4300dc00dsc00dp00ic03isc01ip01in00"
Driver Info #0:
XkbRules: xfree86
XkbModel: pc104
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #37 (Hub)
此外,一旦驱动程序被卸下,键盘也会停止运行。必须重新连接才能正常工作。
有人可以帮助我了解为什么usb_set_configuration()
失败的原因吗?