Go Down

Topic: Leonardo keyboard leds emulation? (Read 1 time) previous topic - next topic

anv

I am trying to create an USB keyboard controller with an Arduino Leonardo, but I can't find the way to emulate the keyboard leds. The PC sends the leds status to the keyboard but the Keyboard object on Arduino seems not to have any read function or any way to get the leds status.

PaulS

Quote
The PC sends the leds status to the keyboard

What LED and what status are you talking about? Shift lock, num lock? If so, didn't YOU send that information to the PC?

anv

#2
Jun 23, 2013, 02:31 pm Last Edit: Jun 23, 2013, 02:35 pm by anv Reason: 1

What LED and what status are you talking about? Shift lock, num lock? If so, didn't YOU send that information to the PC?


In the very very old XT keyboards, the num lock/caps lock/scroll lock status where sent only from keyboard to PC. Xt keyboards didn't receive info from the PC. But since many years with the AT keyboards, the communication is bidirectional, then you can connect two keyboards to the PC and hitting num lock in one affects the led status in all keyboards. Then, you can change the caps/scrool/num lock statys by software and this status is shown in the leds. Remember that keyboards does not send "letters" to the PC; it sends row/column of the key. Caps lock key is only another key with it's own row/column scan code and hitting it not necessarily will cause the caps lock led to get on or off. It is controlled by software in the PC.


UKHeliBob

Your original posting made no mention of a second keyboard, only the one being emulated by the Leonardo, hence the comment that as you were setting the Shift lock/Num lock status using the Arduino you had sent the status to the PC and did not need to receive it back.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

anv


Your original posting made no mention of a second keyboard, only the one being emulated by the Leonardo, hence the comment that as you were setting the Shift lock/Num lock status using the Arduino you had sent the status to the PC and did not need to receive it back.


It does not matter how-many keyboards have you connected to the PC. The system is made in a way that allows many keyboards, then, the lock status is managed by the operating system and NOT by the keyboard. Then, the leds are controlled by the PC software and NOT by the keyboard itself. When you press caps lock, it does not turns on the caps lock led. The heyboard send the scan code (row/column) to the PC. The PC software changes the status of a flag and sends back to the keyboard the command for tuning on or off the led. The led status is not decided by the keyboard chip: it is completely controlled by the PC's operating system. Then, the keyboad chip must be able to receive controls from the PC... what seems to be lacking in Arduino HID implementation...

Go Up