rsm-gh / akbl

Control the lights of Alienware computers under GNU/Linux systems.
GNU General Public License v3.0
127 stars 24 forks source link

Add support to M15R3 per key rgb lights keyboard #102

Open samuaz opened 2 years ago

samuaz commented 2 years ago

Hello, thanks for the hard work.

I have an Alienware M15R3, I see there is a configuration profile for this model, but my model has a per key light keyboard, I change the colors but nothing happen.

It must be difficult to map each of the keys, but would it be possible to apply at least by zone or to the entire keyboard?

if i use the block-testing i see this Resource busy error:

Traceback (most recent call last):
  File "/usr/lib/python3.9/AKBL/Engine/Driver.py", line 147, in take_over
    self._device.set_configuration()
  File "/usr/lib/python3.9/site-packages/usb/core.py", line 915, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
  File "/usr/lib/python3.9/site-packages/usb/core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/usb/core.py", line 159, in managed_set_configuration
    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
  File "/usr/lib/python3.9/site-packages/usb/backend/libusb1.py", line 812, in set_configuration
    _check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
  File "/usr/lib/python3.9/site-packages/usb/backend/libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 16] Resource busy

Thanks.

Bus 005 Device 012: ID 04f2:1830 Chicony Electronics Co., Ltd Alienware 510K
Bus 005 Device 011: ID 0461:4ec0 Primax Electronics, Ltd Alienware 610M
Bus 005 Device 015: ID 0461:4e9d Primax Electronics, Ltd Alienware 610M
Bus 001 Device 002: ID 187c:0550 Alienware Corporation LED controller
[samuaz@M15R3 ~]$ sudo lsusb -D /dev/bus/usb/001/002
Device: ID 187c:0550 Alienware Corporation LED controller
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x187c Alienware Corporation
  idProduct          0x0550 LED controller
  bcdDevice            2.00
  iManufacturer           1 Alienware
  iProduct                2 AW-ELC
  iSerial                 3 00.01
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0029
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      25
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval             100
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0021
  bNumDeviceCaps          1
  Platform Device Capability:
    bLength                28
    bDescriptorType        16
    bDevCapabilityType      5
    bReserved               0
    PlatformCapabilityUUID    {d8dd60df-4589-4cc7-9cd2-659d9e648a9f}
    CapabilityData[0]    0x00
    CapabilityData[1]    0x00
    CapabilityData[2]    0x03
    CapabilityData[3]    0x06
    CapabilityData[4]    0x48
    CapabilityData[5]    0x00
    CapabilityData[6]    0x01
    CapabilityData[7]    0x00
Device Status:     0x0001
  Self Powered
rsm-gh commented 2 years ago

Hello @samuaz ,

Mapping a light to each key is possible because AKBL has a dynamic configuration file. Then for doing that the block testing window must work. I don't know how to fix the usb.core.USBError: [Errno 16] Resource busy problem because I cant reproduce it on my computer, but that may be caused by the LD_PRELOAD patch. Here you have some info:

Maybe removing the LD_PRELOAD for using the native libusb-1.0.so.0 will make it work. and in other cases, maybe updating the library to the last Ubuntu release will also make it work.

if you have more info please keep me updated, Best Regards, rsm

samuaz commented 2 years ago

@rsm-gh thanks for the reply, i will try to fix the sb.core.USBError: [Errno 16] Resource busy and try to do the block testing.

Right now, I'm running Arch Linux.

Removing the LD_PRELOAD or replace the lib with the latest from ubuntu i get:

Traceback (most recent call last):
  File "/usr/lib/python3.9/AKBL/Addons/BlockTesting/BlockTesting.py", line 206, in on_togglebutton_find_device_clicked
    self._testing_driver.load_device(id_vendor=vendor, id_product=product, empty_computer=True)
  File "/usr/lib/python3.9/AKBL/Engine/Driver.py", line 92, in load_device
    self.take_over()
  File "/usr/lib/python3.9/AKBL/Engine/Driver.py", line 145, in take_over
    self._device.detach_kernel_driver(0)
  File "/usr/lib/python3.9/site-packages/usb/core.py", line 1121, in detach_kernel_driver
    self._ctx.backend.detach_kernel_driver(
  File "/usr/lib/python3.9/site-packages/usb/backend/libusb1.py", line 920, in detach_kernel_driver
    _check(self.lib.libusb_detach_kernel_driver(dev_handle.handle, intf))
  File "/usr/lib/python3.9/site-packages/usb/backend/libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 2] Entity not found

another information is that when block testing starts detect my external alienware 510k keyboard by default instead of my laptop keyboard

i continue investigating.