Skip to content

Fix PS2_KEY_PAUSE value (my attempt without having v1.0.10) #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/PS2KeyAdvanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ switch( value )
state = 4;
break;
case PS2_KC_EXTEND1: // Major extend code (PAUSE key only)
// PS2 Keyboard don't send break code when Pause/Break key is physically released, but immediately after the make code.
// On Make, it sends make CTRL+numlock then immediatly the break codes for that: E1 14 77 E1 F0 14 F0 77
// PS2_KC_EXTEND1 PS2_KC_CTRL PS2_KC_NUM then PS2_KC_EXTEND1 PS2_KC_KEYBREAK PS2_KC_CTRL PS2_KC_KEYBREAK PS2_KC_NUM
if( !( _ps2mode & _E1_MODE ) ) // First E1 only
{
_bytes_expected = 7; // seven more bytes
Expand Down Expand Up @@ -665,14 +668,11 @@ index++;
if( index >= _RX_BUFFER_SIZE )
index = 0;
_tail = index;

// Get the flags byte break modes etc in this order
data = _rx_buffer[ index ] & 0xFF;
index = ( _rx_buffer[ index ] & 0xFF00 ) >> 8;

// Catch special case of PAUSE key
if( index & _E1_MODE )
return PS2_KEY_PAUSE + _FUNCTION;

// Ignore anything not actual keycode but command/response
// Return untranslated as valid
if( ( data >= PS2_KC_BAT && data != PS2_KC_LANG1 && data != PS2_KC_LANG2 )
Expand All @@ -686,6 +686,12 @@ else
PS2_keystatus &= ~_BREAK;

retdata = 0; // error code by default

// Catch special case of PAUSE key
if( index & _E1_MODE ) {
retdata = PS2_KEY_PAUSE;
PS2_keystatus |= _FUNCTION;
} else
// Scan appropriate table
if( index & _E0_MODE )
{
Expand Down