Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Logitech K380/K780 #6

Open
egrath opened this issue Oct 17, 2019 · 11 comments
Open

Support for Logitech K380/K780 #6

egrath opened this issue Oct 17, 2019 · 11 comments

Comments

@egrath
Copy link

egrath commented Oct 17, 2019

Hi, would it be possible to add support for the Logitech K380 and K710 Keyboard?

K380:
#define HID_DEVICE_ID_K380 (__s16)0xb342
const char k380_seq_fkeys_on[] = {0x10, 0xff, 0x0b, 0x1e, 0x00, 0x00, 0x00};
const char k380_seq_fkeys_off[] = {0x10, 0xff, 0x0b, 0x1e, 0x01, 0x00, 0x00};

K780:
#define HID_DEVICE_ID_K780 (__s16)0xc52b
const char k780_seq_fkeys_on[] = {0x10, 0x02, 0x0c, 0x1c, 0x00, 0x00, 0x00};
const char k780_seq_fkeys_off[] = {0x10, 0x02, 0x0c, 0x1c, 0x01, 0x00, 0x00};

@egrath egrath changed the title Support for Logitech K380 Support for Logitech K380/K780 Oct 17, 2019
@themech
Copy link
Owner

themech commented Oct 21, 2019

@egrath I don't think it would be hard once you provided the device identifiers and sequence codes, thank you. Obviously I won't be able to test this app with those devices but I can prepare the code changes and a test build. Hopefully in the next few days :) Thanks!

@themech
Copy link
Owner

themech commented Nov 24, 2019

@egrath I've made the required changes on a separate branch. This tool should now recognize the K380 and K780 keyboards as well, thank you for providing the codes. I'm not able to test it myself as I only have access to K811. Could you please check if it works for you? This should be pretty straightforward:

  1. Clone the repo/branch by running git clone --single-branch --branch k380 https://github.com/themech/k810_k811_fkeys.git
  2. Go to the cloned k810_k811_fkeys directory and compile the binary by running make
  3. Run the compiled binary: sudo ./k81x-fkeys -v on

In case of any questions please let me know or check out the readme file.

@egrath
Copy link
Author

egrath commented Nov 25, 2019

Hi,

K380 works
K780 not, no difference if connected using Unifying Receiver or Bluetooth.

Error message (same for Unifying and Bluetooth)

Checking whether /dev/hidraw2 is a supported Logitech keyboard.
Cannot identify /dev/hidraw2 as a supported Logitech Keyboard
Device /dev/hidraw2 cannot be recognized as a supported Logitech keyboard.

Bluetooth info of K780:

Device E4:46:9A:42:13:C5 (random)
	Name: Keyboard K780
	Alias: Keyboard K780
	Appearance: 0x03c1
	Icon: input-keyboard
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
	UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
	UUID: Vendor specific           (00010000-0000-1000-8000-011f2000046d)
	Modalias: usb:v046DpB33Bd0029

@themech
Copy link
Owner

themech commented Nov 25, 2019

@egrath Hi again and thank you for your feedback. So maybe the product id is different than 0xc52b? Also the tool assumes the bus type to be 0x5 which is bluetooth, as originally I was targeting the K811 bluetooth keyboard. If your device is connected via usb, the bus type is 0x3 - I may relax this requirement to allow both types of connection.

Let's get some details first. I've added some extra debug info with the bus type and device details to the output, it is on the same k380 branch: 1583431. Could you please pull the new sources, rebuild the tool and post the output for the K780 keyboard?

@egrath
Copy link
Author

egrath commented Nov 25, 2019

K780 connected via Bluetooth on /dev/hidraw2:

Checking whether /dev/hidraw2 is a supported Logitech keyboard.
Bus type: 0x5
Vendor:   0x46d
Product:  0xb33b
Cannot identify /dev/hidraw2 as a supported Logitech Keyboard
Device /dev/hidraw2 cannot be recognized as a supported Logitech keyboard.

K780 connected via Unifying Receiver on /dev/hidraw5:

Checking whether /dev/hidraw5 is a supported Logitech keyboard.
Bus type: 0x3
Vendor:   0x46d
Product:  0x4057
Cannot identify /dev/hidraw5 as a supported Logitech Keyboard
Device /dev/hidraw5 cannot be recognized as a supported Logitech keyboard.

@themech
Copy link
Owner

themech commented Nov 25, 2019

I updated the K780 product id to 0xb33b - it makes sense, other keyboards also start with b3. I have doubts about the connection via the Unifying Receiver, the product id changes to 0x4057 so I'm not sure if this is the id of the keyboard or the receiver. In case of the latter the sequence to flip the Fn keys may not work, as we would be talking to the wrong device.

@egrath
Copy link
Author

egrath commented Nov 26, 2019

Hm... interestingly the K780 still does not switch it's F-Keys behavior even if it's recognized now when connected via Bluetooth. I will verify if there's something wrong with the control codes.

@egrath
Copy link
Author

egrath commented Nov 27, 2019

Monitored Logitech Options again, and it seems that i had an typo in the codes for the K780 ... correct ones:

const unsigned char k780_fn_keys_on[]  = {0x10, 0x01, 0x0c, 0x1c, 0x00, 0x00, 0x00};
const unsigned char k780_fn_keys_off[] = {0x10, 0x01, 0x0c, 0x1c, 0x01, 0x00, 0x00};

@themech
Copy link
Owner

themech commented Nov 27, 2019

Let's give it a shot, I've updated the K780 codes on the same branch as previously.

@maurimo
Copy link

maurimo commented Apr 11, 2020

Hello @egrath, I have a k780 myself and I have been trying to make this work, trying to run a windows inside a virtual machine and attempting to replay the USB commands.
However I am unable to make it work, and the sequences you have been proposing do not work for me either.
Any technique you can suggest for understanding these codes? When monitoring the toggle being set/unset under Windows I see via usbmon
ffff8b860c6de300 1671267107 S Bo:1:003:2 -115 30 = 10001a00 16000400 523c00ff 0c1c0000 00000000 00000000 00000000 0000
ffff8b860c6de300 1671267593 C Bo:1:003:2 0 30 >
ffff8b8644a4dec0 1672002263 C Bi:1:003:2 0 30 = 10201a00 16000400 1b3800ff 0c1c0001 00000000 00000000 00000000 0000
ffff8b860c0b95c0 1672003679 S Bi:1:003:2 -115 1536 <

While if I try to send "00ff 0c1c0000 00000000 00000000 00000000 0000" the packet is different and the reply appears to be an error complaint.

@Jerther
Copy link

Jerther commented Dec 2, 2021

FYI. I use this project for my K810 and it works very well. I just got a K380 for another computer and I was about to use this project for this keyboard as well but I just realized Solaar already supports the swap function for this model, amongst a handful of other features.

I hope that helps someone :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants