pwr-Solaar / Solaar

Linux device manager for Logitech devices
https://pwr-solaar.github.io/Solaar
GNU General Public License v2.0
5.37k stars 401 forks source link

k290 & k780 keyboards can't switch Fn key behavior #329

Closed fdev31 closed 7 years ago

fdev31 commented 7 years ago

Those two keyboards have already some code to switch the Fn key behavior:

For k290: https://github.com/milgner/jugendhackt-2015-usb/blob/master/demo.py For k780:

unifying=0xc52b

IFACE=2
# find keyboard
dev = usb.core.find(idVendor=0x046d, idProduct=unifying)

if dev is None:
  raise ValueError('Keyboard not found')

reattach = dev.is_kernel_driver_active(IFACE)
if reattach:
    dev.detach_kernel_driver(IFACE)

cfg = dev[0]
iface = cfg[(IFACE,0)]

dev.set_interface_altsetting(iface)

# code

ON=[16, 2, 12, 26, 0, 0, 0]
OFF=[16, 2, 12, 28, 1, 0, 0]

for n in range(3):
    dev.ctrl_transfer(33, 9, 528, 2, OFF if len(sys.argv) > 1 else ON)
    time.sleep(0.2)

time.sleep(0.5)

dev.reset()
if reattach:
    dev.attach_kernel_driver(IFACE)

The code for k780 is my first shot, I don't know why I have to insist (call repeatedly) for it to work... anyway, I think adding the support for those keyboards into solaar can be helpful for some people.

Lekensteyn commented 7 years ago

Decoding ON=[16, 2, 12, 26, 0, 0, 0] into:

10 short message
02 device index 2
0c feature index 12
1a function index 1, application 10
00 00 00 parameters

Feature 12 for the K780 can be found in docs/devices/k780.txt:

    12: NEW FN INVERSION       {40A2}   

This feature is already supported by Solaar since 952495ce04cde4a4fab829d7dab5e605a45ed40c and a515cc38605b7bfc533ba32910c6ea7b02c1dad0 (in the master branch, not in 0.9.2). Can you confirm this?

fdev31 commented 7 years ago

I confirm :) I had to restart solaar & the keyboard several times before it lists it but then I had the option (not very visible, I see lots of UI issues... maybe a refactor in progress ?).

Thank you !

Le mar. 24 janv. 2017 à 17:18, Peter Wu notifications@github.com a écrit :

Decoding ON=[16, 2, 12, 26, 0, 0, 0] into:

10 short message 02 device index 2 0c feature index 12 1a function index 1, application 10 00 00 00 parameters

Feature 12 for the K780 can be found in docs/devices/k780.txt https://github.com/pwr/Solaar/tree/master/docs/devices/k780.txt:

12: NEW FN INVERSION       {40A2}

This feature is already supported by Solaar since 952495c https://github.com/pwr/Solaar/commit/952495ce04cde4a4fab829d7dab5e605a45ed40c and a515cc3 https://github.com/pwr/Solaar/commit/a515cc38605b7bfc533ba32910c6ea7b02c1dad0 (in the master branch, not in 0.9.2). Can you confirm this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pwr/Solaar/issues/329#issuecomment-274852204, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOkHqoW5rhIkAOKglBl9AzX6Jnexwnbks5rViRrgaJpZM4LgBVM .

Lekensteyn commented 7 years ago

Maybe there is a race condition somewhere between enumerating the device and updating the UI, but I will close this ticket since the original issue is resolved.

Thanks for your feedback!

fdev31 commented 7 years ago

You are welcome! Thank you for the app! 😉

Le 24 janv. 2017 5:54 PM, "Peter Wu" notifications@github.com a écrit :

Maybe there is a race condition somewhere between enumerating the device and updating the UI, but I will close this ticket since the original issue is resolved.

Thanks for your feedback!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pwr/Solaar/issues/329#issuecomment-274864998, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOkHp9TFBMVpSu0oWgJIQIPxOf3vwnFks5rVizTgaJpZM4LgBVM .

ghost commented 7 years ago

Hello, I'm new to Solaar and I don't have completely clear how it should work. My K780 works fine but from this closed issue I don't understand what I should do to change fn switch behaviour (e.g. I would like to have standard F1=help and fn+F1=change pc). What modification should I implement on configuration file, if any?

ghost commented 7 years ago

just to clarify that solaar-cli config 1 (where 1 stands for my k780) says: "error: no settings for K780 multi-device keyboard)" :(

Lekensteyn commented 7 years ago

@tetiogit The feature is not yet available in a released version, but it is available in the development version (the "git master branch").

hxss commented 6 years ago

Hello. I'm have same problem that @ghost with k780. I also see error when trying to watch available settings. More than year since last message. It's still available only in git version?

odume commented 5 years ago

Hello, would it be possible to make a released version including this fix ? It's been quite a long time since last release...