Closed JoZ3 closed 7 months ago
very weird, it is failing to connect to the hid endpoint, have you tried running as root?
Either you are missing the needed udev rules or you have some other application running, which is requesting exclusive access to the USB device, in which case this won't work either.
I have updated the debugger script, please retry with that using root.
Hi, thanks for the fast reply, I run the script from root and get the following error:
DEBUG: Searching for keyboard...
DEBUG: Keyboard found! :)
DEBUG: requesting USB endpoint...
Traceback (most recent call last):
File "/home/myuser/keyboard-center/src/newDeviceDebugger.py", line 230, in <module>
main()
File "/home/myuser/keyboard-center/src/newDeviceDebugger.py", line 210, in main
HIDpath, HIDpathDisable = getHIDpaths()
^^^^^^^^^^^^^
File "/home/myuser/keyboard-center/src/newDeviceDebugger.py", line 99, in getHIDpaths
raise RuntimeError("Failed to find HIDpath (does other app have exclusive access?)")
RuntimeError: Failed to find HIDpath (does other app have exclusive access?)
I don't know if it will influence, but I have g15daemon on my system, I will uninstall it and run the script again.
yeah ok with the new error message it seems like there is something else having exclusive access to the USB device.
You don't actually need to uninstall it, doing a reboot and making sure it does not start should be enough.
I just checked the source code of g15daemon and its dependency libg15 and found two notable things:
first it does indeed use libusb which is probably why libHIDraw is unable to see the keyboard: https://gitlab.com/menelkir/libg15/-/blob/master/libg15.c?ref_type=heads#L168
and I also found the disable key sequence, which is the same as I use for the other G510 model, so that should work: https://gitlab.com/menelkir/libg15/-/blob/master/libg15.c?ref_type=heads#L124
In order to send data to the LCD, one would need to find out if the LCD is accessible through HIDraw and if yes port the required commands over from libg15.
Hi, I disabled the g15daemon service and restarted the system, the script worked fine, I pressed the keys in the order @Flying--Dutchman did:
M1, M2, M3, MR
G1 - G18
Game slider (on and off)
Headphone sound off
Microphone mute
LCD - App switch
LCD - Buttons 1-4
Keyboard light on/off
Play/Pause
Stop
Previous
Next
Sound off
Volume wheel (both directions)
I noticed something, I don't know if it is normal or there is a problem with my keyboard, when I press the keys M1, M2, M3 and MR, it doesn't shows information, the information shows from the G1 key.
DEBUG: Searching for keyboard...
DEBUG: Keyboard found! :)
DEBUG: requesting USB endpoint...
DEBUG: HIDraw read endpoint found: /dev/hidraw2
DEBUG: HIDraw disable endpoint found: /dev/hidraw2
DEBUG: HIDraw read endpoint found: /dev/hidraw2
DEBUG: HIDraw disable endpoint found: /dev/hidraw2
DEBUG: Checking for HID availability...
DEBUG: Connected to /dev/hidraw2
DEBUG: Connected to /dev/hidraw2
INFO: starting listener...
DEBUG: Using selector: EpollSelector
DEBUG: Connection using HIDAPI...
DEBUG: Sending sequence to disable G keys
0: b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
1: b'\x07\x03\x00'
2: b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DEBUG: listening to USB Interface (1, 0) | b'/dev/hidraw2'
got data from keyboard: b'\x03\x01\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x02\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x04\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x08\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x10\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03 \x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03@\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x80\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x01\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x02\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x04\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x08\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x10\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00 \x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00@\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x80\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x01\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x02\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x04\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00 '
got data from keyboard: b'\x04l'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00 '
got data from keyboard: b'\x04d'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00@'
got data from keyboard: b'\x04t'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00@'
got data from keyboard: b'\x04d'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x01'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x02'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x04'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x08'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x10'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x08\x00'
got data from keyboard: b'\x04`'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x08\x00'
got data from keyboard: b'\x04d'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x02\x08'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02\x04'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02\x02'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02\x01'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02\x10'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02@'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x02 '
got data from keyboard: b'\x02\x00'
got data from keyboard: b'\x01\x01\x00\x00\x00\x00\x00\x00'
got data from keyboard: b'\x01\x01\x06\x00\x00\x00\x00\x00'
^CHIDerrpr: Interrupted system call
got data from keyboard: b'\x01\x01\x00\x00\x00\x00\x00\x00'
got data from keyboard: b'\x01\x00\x00\x00\x00\x00\x00\x00'
INFO: stopping...
ERROR: Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<usbListener() running at /home/myuser/keyboard-center/src/newDeviceDebugger.py:160>>
oh nice this looks better now, mapping the buttons right now.
~Are you sure that G1 and M1 are the same?~ EDIT: they are different:
M1: b'\x03\x01\x00\x00\x00'
G1: b'\x03\x10\x00\x00\x00'
But they are indeed inverted compared to the other (older?) G510, which is really strange why they did that.
so I think I have almost all buttons mapped, I am not sure about G16 - 18 though, does it send 3 lines for one button press?
G16 - 18
got data from keyboard: b'\x03\x00\x80\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x01\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x02\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
oh nice this looks better now, mapping the buttons right now.
~Are you sure that G1 and M1 are the same?~ EDIT: they are different:
M1:
b'\x03\x01\x00\x00\x00'
G1:b'\x03\x10\x00\x00\x00'
But they are indeed inverted compared to the other (older?) G510, which is really strange why they did that.
I don't understand something, when I press M1, M2, M3 and MR no information appears, the one you indicate as M1, is the information when I press G1:
got data from keyboard: b'\x03\x01\x00\x00\x00'
got data from keyboard: b'\x03\x00\x00\x00\x00'
ah damn, the Mkeys then seem to be using a different USB channel, that sucks
could you please try changing the line 14 usbInterface = (1, 0)
to (0, 0)
or (2, 0)
etc to see if those show something when you press M key?
could you please try changing the line 14
usbInterface = (1, 0)
to(0, 0)
or(2, 0)
etc to see if those show something when you press M key?
with (0,0) nothing happend
with (2,0) this:
DEBUG: Searching for keyboard...
DEBUG: Keyboard found! :)
DEBUG: requesting USB endpoint...
Traceback (most recent call last):
File "/home/myuser/keyboard-center/src/newDeviceDebugger.py", line 230, in <module>
main()
File "/home/myuser/keyboard-center/src/newDeviceDebugger.py", line 191, in main
keyboardEndpoint: core.Endpoint = keyboard\
^^^^^^^^^
File "/usr/lib/python3.11/site-packages/usb/core.py", line 534, in __getitem__
return Endpoint(
^^^^^^^^^
File "/usr/lib/python3.11/site-packages/usb/core.py", line 347, in __init__
desc = backend.get_endpoint_descriptor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/usb/backend/libusb1.py", line 798, in get_endpoint_descriptor
ep_desc = i.endpoint[ep]
~~~~~~~~~~^^^^
ValueError: NULL pointer access
I will install a windows virtual machine and install the keyboard drivers to verify that there is no physical damage, although it seems strange to me, a long time ago the M1 - 3 and MR keys worked very well with the g15daemon and its utilities.
here an initial version for testing: keyboard-center-git.zip
here an initial version for testing: keyboard-center-git.zip
No device found :(
[root] INFO: 15.02.2024 04:29:43 PM ------------ starting -------------
[Configparser] DEBUG: 15.02.2024 04:29:43 PM Config file location: /home/XXXX/.config/keyboard-center/settings.yml
[Configparser] DEBUG: 15.02.2024 04:29:43 PM loading config file /home/XXXX/.config/keyboard-center/settings.yml
[Configparser] DEBUG: 15.02.2024 04:29:43 PM config loaded: {'mappings': {'MEMORY_1': {'MACRO_1': {'name': 'example-A', 'string': 'A', 'type': 'key', 'value': [1, 30]}, 'MACRO_2': {'name': 'example-cut', 'string': [['Ctrl', 'X'], ['Ctrl', 'V']], 'type': 'macro', 'value': [[[1, 29], [1, 45]], [[1, 29], [1, 47]]]}, 'MACRO_3': {'name': 'example-nice', 'string': [['N'], ['I'], ['C'], ['E']], 'type': 'macro', 'value': [[[1, 49]], [[1, 23]], [[1, 46]], [[1, 18]]]}}}, 'settings': {'retryCount': 5, 'usbDeviceID': 'None', 'usbTimeout': 1000}}
[BGService] INFO: 15.02.2024 04:29:43 PM setting up service...
[BGService] INFO: 15.02.2024 04:29:43 PM searching for supported keyboard...
[BGService] CRITICAL: 15.02.2024 04:29:43 PM no supported keyboard found, retrying...
[Configparser] DEBUG: 15.02.2024 04:29:43 PM setting deviceID to None
[QT] DEBUG: 15.02.2024 04:29:48 PM start health check...
[QT] DEBUG: 15.02.2024 04:29:48 PM setting up GUI...
[Configparser] DEBUG: 15.02.2024 04:29:48 PM loading config file /home/XXXX/.config/keyboard-center/settings.yml
[Configparser] DEBUG: 15.02.2024 04:29:48 PM config loaded: {'mappings': {'MEMORY_1': {'MACRO_1': {'name': 'example-A', 'string': 'A', 'type': 'key', 'value': [1, 30]}, 'MACRO_2': {'name': 'example-cut', 'string': [['Ctrl', 'X'], ['Ctrl', 'V']], 'type': 'macro', 'value': [[[1, 29], [1, 45]], [[1, 29], [1, 47]]]}, 'MACRO_3': {'name': 'example-nice', 'string': [['N'], ['I'], ['C'], ['E']], 'type': 'macro', 'value': [[[1, 49]], [[1, 23]], [[1, 46]], [[1, 18]]]}}}, 'settings': {'retryCount': 5, 'usbDeviceID': 'None', 'usbTimeout': 1000}}
Traceback (most recent call last):
File "/opt/keyboard-center-git/mainUi.py", line 376, in closeEvent
self.service.quit(False)
^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'quit'
And apparently the M1, M2 and M3 buttons are not working, from the virtual machine and the logitech center you can switch between M1, M2 and M3, but physically you can't, I will check it on a computer with windows 10 installed.
No device found :(
yes I did a mistake sorry :V
There you go, I hope this one works keyboard-center-git.zip
There you go, I hope this one works keyboard-center-git.zip
Mate, it works very well, thank you very much for your effort, I still have to verify if the M1, M2, M3 and MR keys work in my keyboard, but I could verify that the G keys work perfectly.
Again thank you very much for your work
awesome glad to hear, I will push a new version with those changes tomorrow.
As for the remaining functionality:
1.0.8 released, so closing.
Any of the other points mentioned above should be a separate issue if desired.
Hi I have a Logitech G510 from 2011, but it is different from the one sent by @Flying--Dutchman, because they have different USB ID, so the application does not detect it.
The USB ID is the following: 046d:c22e
python3 src/newDeviceDebugger.py --info:
But when I run python3 src/newDeviceDebugger.py I get an error:
I tried to comment out the default G815 disableGKeys lines and uncomment the G510 lines, but I get the same error.