not-jan/apex-tux

Apex Pro Tkl Wireless

Opened this issue · 29 comments

eix128 commented

i tried to use your software on
TK Pro Wireless
with
Zorin ( Ubuntu fork )
kadir@kadir-GE76-Raider-11UH:~/repo/apex-tux$ sudo target/release/apex-tux
Error: No supported SteelSeries device found!

kadir@kadir-GE76-Raider-11UH:~/repo/apex-tux$ cat /etc/udev/rules.d/97-steelseries.rules
SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1630", MODE="0666", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1630", MODE="0666", GROUP="plugdev"

kadir@kadir-GE76-Raider-11UH:~/repo/apex-tux$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 005: ID 1038:1122 SteelSeries ApS SteelSeries KLC
Bus 003 Device 004: ID 1038:1630 SteelSeries ApS Apex Pro TKL Wireless
Bus 003 Device 011: ID 1e0e:9001 Qualcomm / Option
Bus 003 Device 013: ID 1038:172b SteelSeries ApS SteelSeries Rival 650 Wireless
Bus 003 Device 008: ID 8087:0032 Intel Corp.
Bus 003 Device 007: ID 5986:1160 Acer, Inc Integrated Camera
Bus 003 Device 006: ID 1038:1134 SteelSeries ApS SteelSeries ALC
Bus 003 Device 002: ID 1038:1726 SteelSeries ApS SteelSeries Rival 650 Wireless
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Whats wrong ?

Hi, this is "normal", as we do not have every steelseries' keyboard, there are some that are not recognized by the the software, the list of recognized keyboard is stored in apex-hardware/src/usb.rs, currently, only 5 should work, I will do a pull request adding the apex pro tkl wireless (but won't be added now, I don't know when not-jan will be available)

If you want to try it out, you can download my pull request here and compile it again, it should "just work", but since I'm not seeing any other wireless keyboard in the code, I can't promise anything

eix128 commented

okay btw , when i connect cable i see 2 device
kadir@kadir-GE76-Raider-11UH:~/repo$ lsusb | grep -E Wireless
Bus 003 Device 004: ID 1038:1630 SteelSeries ApS Apex Pro TKL Wireless
Bus 003 Device 014: ID 1038:1632 SteelSeries ApS Apex Pro TKL Wireless

one is cable connected other one is wireless.
I will check it out now with new

okay btw , when i connect cable i see 2 device
oh, I don't know how it's going to handle being plugged, I hope it just works, but since it makes another interface I'm not sure

eix128 commented

kadir@kadir-GE76-Raider-11UH:~/repo/apex-tux$ sudo target/release/apex-tux
Error: hidapi error: hid_error is not implemented yet

eix128 commented

not i got this error

can you try running it as root? it seems like a udev issue

eix128 commented

yeah i am running it as root.
i m not sure my udev is true

i have tried this:

kadir@kadir-GE76-Raider-11UH:~/repo/apex-tux$ sudo cat /etc/udev/rules.d/97-steelseries.rules
SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1630", MODE="0666", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1630", MODE="0666", GROUP="plugdev"

SUBSYSTEM=="usb", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1632", MODE="0666", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1632", MODE="0666", GROUP="plugdev"

if you're already running as root, udev rules don't matter, I'm perplexed

by chance, are you running openrgb?

eix128 commented

i have sim7600 module connected to my laptop also
i have msi ge76 raider 11th intel gen with rtx 3080

thank you for your clarification, i'm running an AMD system, but I don't think there should be any difference in how usb is handled by linux, the main difference that i can think of is the wireless part.

can you try to edit the line in apex-hardware/src/usb.rs#21 from

    ApexProTKLWireless = 0x1630,

to

    ApexProTKLWireless = 0x1632,

then recompile, and try it in root when your keyboard is plugged in (to see if, when wired, apex-tux can recognize it)

eix128 commented

kadir@kadir-GE76-Raider-11UH:~/repo/apex-tux$ sudo target/release/apex-tux
Error: hidapi error: hid_error is not implemented yet

eix128 commented

The thing i want is , i also want to watch battery status what i do on windows also.
Well i cant even pair now i dont know what to do

Depending on how the wireless is implemented this project may or may not work. I wouldn't hold my breath. Battery status for example is not implemented at all (and likely won't be unless one of the devs gets their hands on one of those keyboards).

eix128 commented

do you know how to sniff pcie data on windows ?
if yes , i can do it on other pc and get the required communication data on usb.

Hi, I'm hitting the Error: hidapi error: hid_error is not implemented yet issue with my Apex Pro TKL Wireless. I tried all combinations of wired or wireless mode, a regular user or root, 0x1630 or 0x1632.

Anything I can do to help out? I'm up for a live debugging session over zoom (or any other conferencing option) if that would help...

I tried to troubleshoot this myself and i've found out that the problem is at

usb.rs:50:                 let handle = device.open_device(&api)?;
hidapi::lib.rs:498:   hidapi.open_path(self.path.as_c_str()) // note: self.path here is 3-1:1.1
hidapi::lib.rs:259:   let device = unsafe { ffi::hid_open_path(device_path.as_ptr()) };
hidapi::hid.c:1025: res = libusb_open(usb_dev, &dev->device_handle); // note: this returns -3

tldr: the libusb_open(...) call returns this error:

      /** Access denied (insufficient permissions) */
        LIBUSB_ERROR_ACCESS = -3,

I've tried chmod 666 /dev/hidraw*, and i've tried disabling selinux (i'm using Fedora 39), but none of that helped and neither did running apex-tux as root.

Hi, sorry for responding late, I haven't touched apex-tux for quite some time.

It seems weird, are sure no other software is using the keyboard? (openrgb, for example)

I'm wondering if the wireless keyboard uses an alternate interface?

could you try lsusb -d 1038: -v?
my apex 5 gives me :

Bus 001 Device 003: ID 1038:161c SteelSeries ApS SteelSeries Apex 5
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 [unknown]
  bDeviceSubClass         0 [unknown]
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1038 SteelSeries ApS
  idProduct          0x161c SteelSeries Apex 5
  bcdDevice            2.01
  iManufacturer           1 SteelSeries
  iProduct                2 SteelSeries Apex 5
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0086
    bNumInterfaces          5
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      65
          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     0x0008  1x 8 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 [unknown]
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      37
          Report Descriptors: 
            ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 [unknown]
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      43
          Report Descriptors: 
            ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 [unknown]
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     106
          Report Descriptors: 
            ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0006  1x 6 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 [unknown]
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      21
          Report Descriptors: 
            ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)
 lsusb -d 1038: -v

Bus 001 Device 007: ID 1038:1630 SteelSeries ApS [unknown]
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 [unknown]
  bDeviceSubClass         0 [unknown]
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1038 SteelSeries ApS
  idProduct          0x1630 [unknown]
  bcdDevice            3.d4
  iManufacturer           1 SteelSeries
  iProduct                2 Apex Pro TKL Wireless
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x009f
    bNumInterfaces          6
    bConfigurationValue     1
    iConfiguration          3 SteelSeries Config
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      98
          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     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      65
          Report Descriptors: 
            ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 [unknown]
      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     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 [unknown]
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      37
          Report Descriptors: 
            ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 [unknown]
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      21
          Report Descriptors: 
            ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        5
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      43
          Report Descriptors: 
            ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

Well this is weird, the second interface is a keyboard while the first is a mouse, I guess they share the same dongle for both keyboard and mouse?
if that's the case, it will be way more complicated as it probably mean a new protocol that we don't know and that apex-tux doesn't support, to know we'd need packet capture (with a virtual machine), but I don't know how to do one

One thing you can try (but I wouldn't even place a bet on it), is change the line 44~ in usb.rs

device.interface_number() == 1

and change the 1 to values between 2 and 5

if you want I can try to come on zoom or another site but I'm french so english is not my main language
if you want I have skype and discord, but I can install another one if you want

So we had a quick zoom meeting with jehendeoff but we couldn't make any progress.
I think I'll be able to create a wireshark capture of the usb traffic of a KVM windows machine that has the keyboard configured as a passthru device.
I will configure / switch some profiles in the vm and upload the capture, in hopes of @not-jan being able to make heads or tails of it.
Not sure if I should use the dongle or plug the cable, maybe I will try both.

Quick recap :

  • changing the interface does nothing
  • darkprokoba will try to get a usb capture and upload it

(EDIT: darkprokoba also had the idea to make a recap, thank you)

Hi, everyone. Thanks for the effort :) I think the easiest way would be for @darkprokoba to use the official SteelSeries software on Windows or Mac and use something like Wireshark to capture the USB traffic. Please include a step-by-step of what you did in the SteelSeries app so we can make sense of the data more easily. Please also include any images of GIFs so we can find them in the data stream.

Hi, @not-jan
Here are the steps i took.

  1. Booted a win10 kvm domain, with steelseries gg running.
  2. Started the wireshark capture.
  3. Configured passthru for 0x1038, 0x1630 (a.k.a. usb redirection)
  4. Waited for 15 seconds, this caused my keyboard lighting to change.
  5. Unconfigured passhtru
  6. Stopped wireshark

I have a color profile for all-white static backlight. I will attach the image i'm testing with.
getfedora

And here's the capture: https://prokoba.com/apex_pro_tkl_wireless.pcapng

One thing bothers me though, apex-tux fails to open the hid raw device. I.e. it never gets to speaking to the device. Perhaps this is the first thing we need to address before looking for any protocol changes...

BTW if you can recommend a set of steps to perform in the official windows software, I can provide another capture.