libratbag / piper

GTK application to configure gaming devices
GNU General Public License v2.0
4.59k stars 173 forks source link

Support for keyboards #453

Open stephanlachnit opened 4 years ago

stephanlachnit commented 4 years ago

Since we have now support for several keyboards, we should think about keyboard support in Piper. This thread is for discussion.

cc @FFY00

stephanlachnit commented 4 years ago

Current roadmap:

stephanlachnit commented 4 years ago

329 gives an example for an application with clickable svgs using GTK/Python. I don't think I'll have time to look into that code before February, just wanted to mention it.

FFY00 commented 4 years ago

329 shows a good path forward.

I am not sure if we need to add a DeviceType property. My thought was that we could move forward with the clickable buttons and automatically hide the configuration buttons on the side if there was no space left. This would also adapt piper better for smaller screens. We could even remove the configuration buttons entirely but that is something that will need more testing.

FFY00 commented 4 years ago

Add MouseMap equivalent (ie KeyboardMap)

I am not sure what this is supposed to be.

stephanlachnit commented 4 years ago

Add MouseMap equivalent (ie KeyboardMap)

I am not sure what this is supposed to be.

mousemap.py is the file responsible for drawing the svgs and the buttons if I got it right.

My thought was that we could move forward with the clickable buttons and automatically hide the configuration buttons on the side if there was no space left.

That's a very good idea. However we might run into problems, but we have to check the MouseMap for this. Anyway, I think we can both agree that the starting point should be clickable svgs for mice, and then the actual keyboard integration.

I am not sure if we need to add a DeviceType property.

With your idea it's definitely less obvious. Still could be useful for svg-size checks or the resolution page, but I think that's something we'll see on the way while implementing it.

FFY00 commented 4 years ago

mousemap.py is the file responsible for drawing the svgs and the buttons if I got it right.

Ah, ok.

That's a very good idea. However we might run into problems, but we have to check the MouseMap for this. Anyway, I think we can both agree that the starting point should be clickable svgs for mice, and then the actual keyboard integration.

Yes. That sounds like a good plan.

With your idea it's definitely less obvious. Still could be useful for svg-size checks or the resolution page, but I think that's something we'll see on the way while implementing it.

Yeah, I think this is something we should discuss when we have some kind of implentation.

GitJamz commented 4 years ago

yes please support for the logitech craft keyboard!

stephanlachnit commented 4 years ago

Looking at #479 we might not need to do anything, looks pretty good so far. Could get problematic if we allow to remap every key, including normal alphanumeric keys, but we probably shouldn't allow that in Piper anyway.

GitJamz commented 4 years ago

how is it going with piper support for logitech craft?

hwooo commented 4 years ago

Please support for K580

FFY00 commented 4 years ago

Please try adding a device file for those devices (both should use the hidpp20 driver) and see what works in the current driver.

GitJamz commented 4 years ago

Please try adding a device file for those devices (both should use the hidpp20 driver) and see what works in the current driver.

Some instructions please for a total newbie with these stuff...?

FFY00 commented 4 years ago

Please run the daemon with verbosity and paste the output here.

$ sudo killall ratbagd
$ sudo ratbag --verbose=debug
GitJamz commented 4 years ago

Please run the daemon with verbosity and paste the output here.

$ sudo killall ratbagd
$ sudo ratbag --verbose=debug
ratbag: command not found

ratbagd though:

Initializing libratbag
ratbag debug: New device: AsusTek Computer Inc. AURA LED Controller
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 0b05:1872
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c541
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c541
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c541
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c539
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c539
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c539
ratbag debug: New device: MX Master 2S
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: device assigned driver hidpp20
ratbag debug: hidraw info: bus 0x05 vendor 0x46d product 0xffffb019
ratbag debug: MX Master 2S is device '/dev/hidraw8'.
ratbag debug: Parsing HID report descriptor
ratbag debug: Parsing HID report descriptor
ratbag debug: - HID report ID 01
ratbag debug: - HID report ID 02
ratbag debug: - HID report ID 11
ratbag debug: hidpp: device supports long reports
ratbag debug: 'MX Master 2S' is using protocol v4.5
ratbag debug: device battery level is 90% (next 50%), status 0 
ratbag debug: device has programmable keys/buttons
ratbag debug: device has 8 buttons
ratbag debug: device has adjustable dpi
ratbag debug: device is at 1150 dpi (variable between 200 and 4000).
ratbag debug: device is at 1150 dpi (variable between 200 and 4000).
ratbag debug: device has 8 buttons
ratbag debug: driver match found: Logitech HID++2.0
hidraw8: "MX Master 2S", 1 profiles
ratbag debug: New device: Keyboard Craft
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:b350
DBus server ready
FFY00 commented 4 years ago

Typo, it should be ratbagd.

GitJamz commented 4 years ago

Typo, it should be ratbagd.

I noticed after a min.. I edited my post.

FFY00 commented 4 years ago

The keyboard is connected via bluetooth right?

GitJamz commented 4 years ago

The keyboard is connected via bluetooth right?

Keyboard and mouse is connected with bluetooth correct.

FFY00 commented 4 years ago

Okay, please create a file in /usr/share/libratbag/logitech-craft.device with the following content:

[Device]
Name=Logitech Craft
DeviceMatch=bluetooth:046d:b350
Driver=hidpp20
GitJamz commented 4 years ago

[Device] Name=Logitech Craft DeviceMatch=bluetooth:046d:b350 Driver=hidpp20

Done.. You believe this problem is because of my keyboard?

GitJamz commented 4 years ago

new debug:

Initializing libratbag
ratbag debug: New device: AsusTek Computer Inc. AURA LED Controller
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 0b05:1872
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c541
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c541
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c541
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c539
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c539
ratbag debug: New device: Logitech USB Receiver
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: No data file found for 046d:c539
ratbag debug: New device: MX Master 2S
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: device assigned driver hidpp20
ratbag debug: hidraw info: bus 0x05 vendor 0x46d product 0xffffb019
ratbag debug: MX Master 2S is device '/dev/hidraw8'.
ratbag debug: Parsing HID report descriptor
ratbag debug: Parsing HID report descriptor
ratbag debug: - HID report ID 01
ratbag debug: - HID report ID 02
ratbag debug: - HID report ID 11
ratbag debug: hidpp: device supports long reports
ratbag debug: 'MX Master 2S' is using protocol v4.5
ratbag debug: device battery level is 90% (next 50%), status 0 
ratbag debug: device has programmable keys/buttons
ratbag debug: device has 8 buttons
ratbag debug: device has adjustable dpi
ratbag debug: device is at 1150 dpi (variable between 200 and 4000).
ratbag debug: device is at 1150 dpi (variable between 200 and 4000).
ratbag debug: device has 8 buttons
ratbag debug: driver match found: Logitech HID++2.0
hidraw8: "MX Master 2S", 1 profiles
ratbag debug: New device: Keyboard Craft
ratbag debug: Using data directory '/usr/share/libratbag'
ratbag debug: device assigned driver hidpp20
ratbag debug: hidraw info: bus 0x05 vendor 0x46d product 0xffffb350
ratbag debug: Keyboard Craft is device '/dev/hidraw7'.
ratbag debug: Parsing HID report descriptor
ratbag debug: Parsing HID report descriptor
ratbag debug: - HID report ID 01
ratbag debug: - HID report ID 02
ratbag debug: - HID report ID 03
ratbag debug: - HID report ID 11
ratbag debug: hidpp: device supports long reports
ratbag debug: 'Keyboard Craft' is using protocol v4.5
ratbag debug: device battery level is 0% (next 0%), status 1 
ratbag debug: device has programmable keys/buttons
ratbag debug: device has 24 buttons
ratbag debug: device has 24 buttons
ratbag debug: driver match found: Logitech HID++2.0
hidraw7: "Keyboard Craft", 1 profiles
DBus server ready
FFY00 commented 4 years ago

Can you test piper and see what is working?

GitJamz commented 4 years ago

Well Now it looks different. It shows me both mouse and keybord to configure at start. But if I go to keyboard then theres just htis picture of a mouse holding a 404 sign, and bunch of "unkown" buttons on the right. If I go to the mouse instead and do some change, like change DPI and press apply. Exactly the same error message

GitJamz commented 4 years ago

Ok wait I found something.. If I dont touch the update rate, basically change it from 500hz to 1000hz then I can change DPI and hit save. I get: ratbag error: hidpp20: failed to update report rate

FFY00 commented 4 years ago

Okay, that is expected. There's no image for your keyboard so we show the default one. The buttons show unknown because we don't have the symbols for those key codes (keyboard support is quite recent).

The easiest thing right now would be adding the key codes.

GitJamz commented 4 years ago

Can I give you some codes or something for this keyboard so you know how to fix it in future release? How do I add the "key codes" ? Also why do you think I cant put 1000hz without it crashing?

GitJamz commented 4 years ago

yeah also changing some bind for the mouse fails: ratbag error: hidpp20: failed to update button ratbagd error: error committing device (-1000)

GitJamz commented 4 years ago

Wait a minute.. Maybe the Mx Master series does not support 500hz pollingrate ... Maybe this is the problem..