showjean / ps2avrU

ps2avrU custom keyboard firmware
131 stars 39 forks source link

Add a timeout when waiting for RX #11

Closed fjullien closed 6 years ago

fjullien commented 6 years ago

When setting some keys, we sometimes expect receive a command from the host (e.g. caps lock). Some host send commands to set LED status during set or break.

For example, when it comes to turn on a LED host commands are sent just after the key is pushed and nothing when released. The second time the key is pushed no command are sent but when the key is released commands are sent.

Corrent firmware does not handle this and always expect a command from the host after sending some set commands. In this situation firmware is stuck waiting for some commands that won't come.

This patch adds a timeout when waiting for commands from host. If the command is not received after RX_TIMEOUT (which is expressed as timer tick) its not waited anymore.

Signed-off-by: Franck Jullien franck.jullien@odyssee-systemes.fr

fjullien commented 6 years ago

May be not the bast way to fix it but at least it's a solution.

fjullien commented 6 years ago

Capture of a HOST command just after caps set: https://pasteboard.co/H3kphmX.png

Capture of a HOST command just after caps break: https://pasteboard.co/H3kpIaP.png

fjullien commented 6 years ago

Cool we can upload directly here !

After set:

cmd_just_after_set

After break:

cmd_just_after_break

showjean commented 6 years ago

Thank you very much 👍