Arduino Leonardo as USB KEYBOARD incompatibility with KVM device

Hello,

I have the issue that the Arduino Leonardo is not recognized as a keyboard if plugged into a KVM device.
It is actually exactly this topic: Arduino Leonardo as USB KEYBOARD incompatibility with KVM device - Programming Questions - Arduino Forum
(For some weird reason this forum doesn't allow to bump topics older than 120 days, so unfortunately I have to replicate it - this rule makes it unfortunately unnecessary difficult for users...)

In the old post was a solution suggested with replacing HID core files with another version which stops the USB device of the Leonardo to show up as serial device first. But somehow that didn't work out in my case.

As I want to use the Leonardo to send the switch sequence (Ctrl+Ctrl+ 1 or 2 or 3 or 4) with one hardware button I'm still searching for a solution to it.

Best,
Tjareson

Do you really need a KVM ? Is there perhaps a software solution ? Either by sharing the keyboard and mouse or controlling a computer via VNC. There are Logitech mice with a button that can select between three computers. Perhaps there are also keyboards that can do that.

The Serial port can not be removed from the Leonardo. I think that is no problem.

Could you try an other USB keyboard from the NicoHood HID library ? GitHub - NicoHood/HID: Bring enhanced HID functions to your Arduino!.
I never understood why there are three types of USB keyboards.

Koepel:
Do you really need a KVM ? Is there perhaps a software solution ? Either by sharing the keyboard and mouse or controlling a computer via VNC. There are Logitech mice with a button that can select between three computers. Perhaps there are also keyboards that can do that.

I would prefer to discuss the problem and not if my use case is really necessary. I wouldn't go for a hardware implementation, if there would be an easier option, believe me... :wink:

Koepel:
The Serial port can not be removed from the Leonardo. I think that is no problem.

As described, this is not about the serial port on the Arduino and that is also not causing the problem: the issue is that the USB driver on the Leonardo somehow first identify itself as serial interface to the USB hub. If used with a KVM switch, the switch gives up with that device and is not recognizing it later on as keyboard anymore. (as explained in the initial thread).

Koepel:
Could you try an other USB keyboard from the NicoHood HID library ? GitHub - NicoHood/HID: Bring enhanced HID functions to your Arduino!.
I never understood why there are three types of USB keyboards.

Thanks for the link. I will have a look into it, even that in its issue list the same KVM-problem seems to be mentioned on the first page already: KVM Switch (Disable CDC Serial for better BIOS/UEFi/Custom compatibility) · Issue #225 · NicoHood/HID · GitHub
Looks like a known issue with keyboard simulation on Arduino. I wonder if anyone ever fixed it on a Leonardo.

tjareson:
if there would be an easier option, believe me... :wink:

Someone asking a question is often too focused on a very small part of the problem. Our job is to give a broader view.

  • Question: The hinge of my cat flap door makes a squeaking sound. How can I use millis to oil it twice a day ?
  • Our question: Do you have a cat ?

tjareson:
the switch gives up with that device and is not recognizing it later on as keyboard anymore. (as explained in the initial thread).

I did not read the other thread that thorough. Sorry. If the KVM gives up, then you have a serious problem.
It seems that some Teensy boards can disable the serial port.
I have not heard that someone has a good fix to disable the standard usb-serial port of a Leonardo or a SAMD21G board.
Could you investigate the Arduino Zero ? Can one connector be a USB keyboard and the other connector just for the Arduino IDE ?

Can the KVM select the keyboard without the keyboard being plugged in ? What happens if you connect the Arduino (in keyboard mode) to the KWM afterwards ? Is the serial port still the problem ?

Perhaps it can be solved with other hardware. There are sharing/switching devices for the USB. The buttons can probably be controlled with an Arduino.

If it was for myself and I really needed to solve this, then would check if there was a nice solution with a Teensy board. If you somehow can trick the KVM into accepting the Arduino Leonardo, then perhaps mini reed relais to switch the two data signals of the USB can be used. Mini reed relais of 5V 10mA can be directly powered with an Arduino pin. It would be a silly workaround and the KWM can probably not be tricked into that. What if your replace the KVM with an Arduino and a bunch of reed relais ?

Koepel:

  • Question: The hinge of my cat flap door makes a squeaking sound. How can I use millis to oil it twice a day ?
  • Our question: Do you have a cat ?

...or why do I need more than one computer at all?

Koepel:
Could you investigate the Arduino Zero ? Can one connector be a USB keyboard and the other connector just for the Arduino IDE ?
If it was for myself and I really needed to solve this, then would check if there was a nice solution with a Teensy board.

Look, of course I can try all kind of arduino models and hope that one will work. But as this doesn't seem to be very efficient, I've tried to ask in this forum and still hope there is someone with subject matter expertise regarding the USB drivers which are used and which part would probably need to be tweaked to avoid showing up as serial interface first.
My understanding is that the USB behavior of ATmega32U4 boards is software driven. (leonardo as well as teensy are based on this micro controller)