Uniquely identifying Logitech Unifying Keyboards (In C#)
Asked Answered
O

1

12

I have written a small program in C# 2010 which can split input from different keyboards by making an array of devices using, in part, the following:


--This code works fine for non-unified keyboards--

InputDevice id;
NumberOfKeyboards = id.EnumerateDevices();
id = new InputDevice( Handle );
id.KeyPressed += new InputDevice.DeviceEventHandler( m_KeyPressed );
private void m_KeyPressed( object sender, InputDevice.KeyControlEventArgs e ) {
  lbDescription.Text = e.Keyboard.Name;
  // e.Keyboard.* has many useful strings, none work for me anymore.
}


Very happy with this, I ran out and bought 4 Logitech K230 keyboards which use the Unifying receiver. Sadly, all the keyboard data is now multiplexed and shows up in my code as a single keyboard!

How can I identify which "unified" keyboard the input is coming from? Ideally in C#, but I suppose I am willing to look at other languages if solutions exist.

Overunder answered 12/11, 2012 at 0:12 Comment(7)
I have seen a Linux driver that breaks the "unified" input apart so the HID layer can see different keyboards (and treat them differently.) This made me optimistic a Windows solution should exist too.Overunder
Sorry to add so many comments to my own question, but to anyone interested, this is the project where my original input splitting came from: codeproject.com/Articles/17123/…Overunder
The USB dongle is a USB HID device, so all that traffic that you are seeing is basically generic HID traffic that has been generated by the USB dongle. Unless the specs have anything on the traffic that is generated holding metadata in them. I don't think its possible. You may be able to use USBlyzer to sniff the usb traffic. If you can interface with the USB dongle you may be able to request information from it.Newspaper
I am a little out of my area looking at Linux driver updates, but this is the article explaining that different keyboards, connected to the same unifying USB dongle, can be uniquely presented to the HID Layer. This gives me hope a solution exists in Windows. lwn.net/Articles/458418 Also, this weekend I will try to capture and read the USB data, thanks for the link to that tool.Overunder
After a bit of research, the Logitech USB Dongle does send some data between itself and the logitech program to retrieve device names and information. This may be limited to connected devices though, and probably isn't sent on a Keypress by keypress basis.Newspaper
I appreciate your research, but sadly if it isn't available for a particular keypress event, it won't be useful to split the input during runtime. Being limited to currently connected keyboards is no problem. They will all be connected from the start (and error catching does a re-scan if a new keyboard is heard.)Overunder
You may be able to write your own driver but that is a massive job. Maybe email Logitech for some help?Newspaper
L
1

I don't have unifying keyboard, but check if you can see multiple keyboards in Windows devices. Then you could try this http://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard and check output.

Lengel answered 14/11, 2012 at 14:9 Comment(1)
Thank you for the comment, but unfortunately that link is what I originally used as a starting point (and was given in my second comment.) It worked fine for non-unified keyboard, but was unable to distinguish unified keyboards.Overunder

© 2022 - 2024 — McMap. All rights reserved.