rust-embedded-community / pc-keyboard

PS/2 Keyboard Decoder in Rust
Apache License 2.0
96 stars 28 forks source link

Two fixes for scancode set 1 #3

Closed phil-opp closed 5 years ago

phil-opp commented 5 years ago

This PR updates the scancode set 1 state machine to make the Release and ExtendedRelease states equivalent to the Start state. Before, a clear call was required after each KeyEvent, because the Release and ExtendedRelease state were forever looping.

It also fixes a bug in the new scancode 1 implementation where a decimal 80 was subtracted instead of a hexadecimal 0x80. This fixes the issue that the KeyUp event of the shift key was not recognized so that the input stayed uppercase forever.

This PR also removes some trailing whitespace and runs rustfmt. This is of course optional and I can remove it if it's not wanted.

cc @ZerothLaw

phil-opp commented 5 years ago

Seems like I broke some tests. I will look into it…

phil-opp commented 5 years ago

Ok, seems like changing the state machine for scancode set 2 was the problem. I updated the PR to only apply the fixes for scancode set 1.

ZerothLaw commented 5 years ago

Thanks for finding that issue!

phil-opp commented 5 years ago

@thejpster Thanks! Could you release a new crates.io version with these fixes?

thejpster commented 5 years ago

Sure. Am I bumping x or y in 0.x.y?

phil-opp commented 5 years ago

I consider this PR a bugfix, so I would probably bump the y. But I'm also fine with bumping the x.

thejpster commented 5 years ago

Done

phil-opp commented 5 years ago

Thanks!