Logitech keyboard on linux, could not set config as device or resource is busy
Asked Answered
H

0

6

I have a Logitech G613 keyboard for linux. It works fine except that the G(1-6) keys are mapped to F(1-6) by default and there is no way to remap them without remapping the F keys.

So, I went through a lot of resources on the internet and found g15daemon and libg15. Unfortunately, libg15 does not support G613 but I found a way for the library to detect my keyboard by adding the following line

DEVICE("Logitech G613",0x46d,0xc53d,G15_KEYS),

The only issue now is, libg15 detaches the kernerl driver from the device with usb_detach_kernel_driver_np(), which is successful. But after that, the call to usb_set_configuration() fails with

USB error: could not set config 1: Device or resource busy

Output of hwinfo before detaching kernel driver

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)

and after detaching the kernel driver

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)

Also, once the driver is detached, the keyboard stops functioning. It has to be reconnected again to be functional.

Can anyone please help me understand why usb_set_configuration() is failing?

Heath answered 2/9, 2018 at 16:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.