PS/2 keyboard emulating cases for CTRL-BREAK, CTRL/ALT-SYSRQ?

Emulation of old PCs, PC hardware, or PC peripherals.

PS/2 keyboard emulating cases for CTRL-BREAK, CTRL/ALT-SYSRQ?

Postby superfury » 2018-5-16 @ 19:54

Anyone knows the untranslated scancodes sent by the PS/2 keyboard when CTRL-BREAK, CTRL-SYSRQ or ALT-SYSRQ is pressed and/or released on the PS/2 keyboard?

What are their adjusting effects in each scancode set on the bytestream received by the PS/2 keyboard(untranslated by the 8042)?

Edit: So far, I've gotten this:
Code: Select all
KEYBOARDENTRY_EXTENDED CTRLSYSRQ[3] = {
   { { { 0xE0,0x37,0x00,0x00,0x00,0x00 },2,{ 0x00,0x00,0x00,0x00,0x00,0x00 } },1 },
   { { { 0x00,0x00,0x00,0x00,0x00,0x00 },0,{ 0x00,0x00,0x00,0x00,0x00,0x00 } },0 },
   { { { 0x00,0x00,0x00,0x00,0x00,0x00 },0,{ 0x00,0x00,0x00,0x00,0x00,0x00 } },0 }
};


KEYBOARDENTRY_EXTENDED ALTSYSRQ[3] = {
   {{{0x54,0x00,0x00,0x00,0x00,0x00},1,{0x00,0x00,0x00,0x00,0x00,0x00}},1},
   {{{ 0x84,0x00,0x00,0x00,0x00,0x00 },1,{0x00,0x00,0x00,0x00,0x00,0x00 }},1},
   {{{ 0x00,0x00,0x00,0x00,0x00,0x00 },0,{0x00,0x00,0x00,0x00,0x00,0x00 }},0}
};

KEYBOARDENTRY_EXTENDED CTRLBREAK[3] = {
   {{ { 0x46,0x00,0x00,0x00,0x00,0x00 },1,{ 0x00,0x00,0x00,0x00,0x00,0x00 },0 },1},
   {{ { 0xE0,0x46,0x00,0x00,0x00,0x00 },2,{ 0x00,0x00,0x00,0x00,0x00,0x00 },0 },1},
   {{ { 0x00,0x00,0x00,0x00,0x00,0x00 },0,{ 0x00,0x00,0x00,0x00,0x00,0x00 },0 },0}
};


The entry types being:
Code: Select all
typedef struct
{
byte keypress[8];
byte keypress_size; //1-8
byte keyrelease[8];
byte keyrelease_size; //0-8: 0 for none!
} KEYBOARDENTRY; //Entry containing keyboard character data (press/hold and release data)!

typedef struct
{
   KEYBOARDENTRY entry;
   byte used; //Are we used instead of a normal one?
} KEYBOARDENTRY_EXTENDED;


Set 1 defaults(no ctrl/alt applied):
Code: Select all
   {{0xE0,0x2A,0xE0,0x37,0x00,0x00,0x00,0x00},4,{0xE0,0xB7,0xE0,0xAA,0x00,0x00,0x00,0x00},4}, //PRNT SCRN
   {{0xE1,0x1D,0x45,0x00,0x00,0x00,0x00,0x00},3,{0xE1,0x9D,0xC5,0x00,0x00,0x00,0x00,0x00},3}, //PAUSE


Set 2 defaults(no ctrl/alt applied):
Code: Select all
   {{0xE0,0x12,0xE0,0x7C,0x00,0x00,0x00,0x00},4,{0xE0,0xF0,0x7C,0xE0,0xF0,0x12,0x00,0x00},6}, //PRNT SCRN
   {{0xE1,0x14,0x77,0xE1,0x00,0x00,0x00,0x00},4,{0xF0,0x14,0xF0,0x77,0x00,0x00,0x00,0x00},4}, //PAUSE


Set 3 defaults(no ctrl/alt applied):
Code: Select all
   {{0x57,0x00,0x00,0x00,0x00,0x00,0x00,0x00},1,{0xF0,0x57,0x00,0x00,0x00,0x00,0x00,0x00},2}, //PRNT SCRN
   {{0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00},1,{0xF0,0x62,0x00,0x00,0x00,0x00,0x00,0x00},2}, //PAUSE


How far is this correct? Are there any errors left to address there?

So, what are the none/CtrlBreak/CtrlSysRq/AltSysRQ combinations to result in proper scancodes in sets 1,2 and 3?
superfury
l33t
 
Posts: 2613
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: PS/2 keyboard emulating cases for CTRL-BREAK, CTRL/ALT-SYSRQ?

Postby superfury » 2018-5-16 @ 21:07

I've tried arriving at my own conclusion for custom ctrl/alt modifiers:
Code: Select all
KEYBOARDENTRY_EXTENDED CTRLSYSRQ[3] = {
   { { { 0x37,0x00,0x00,0x00,0x00,0x00 },1,{ 0x00,0x00,0x00,0x00,0x00,0x00 },0 },1 },
   { { { 0xE0,0x37,0xD4,0x00,0x00,0x00 },3,{ 0x00,0x00,0x00,0x00,0x00,0x00 },0 },1 },
   { { { 0xE0,0x37,0xD4,0x00,0x00,0x00 },3,{ 0x00,0x00,0x00,0x00,0x00,0x00 },0 },0 }
};


KEYBOARDENTRY_EXTENDED ALTSYSRQ[3] = {
   {{{0x54,0x00,0x00,0x00,0x00,0x00},1,{0x00,0x00,0x00,0x00,0x00,0x00},0},1},
   {{{ 0xE0,0x54,0xD4,0x00,0x00,0x00 },3,{0x00,0x00,0x00,0x00,0x00,0x00 },0},1},
   {{{ 0xE0,0x54,0xD4,0x00,0x00,0x00 },3,{0x00,0x00,0x00,0x00,0x00,0x00 },0},0}
};

KEYBOARDENTRY_EXTENDED CTRLBREAK[3] = {
   {{ { 0x46,0x00,0x00,0x00,0x00,0x00 },1,{ 0xC6,0x00,0x00,0x00,0x00,0x00 },1 },1},
   {{ { 0xE0,0x46,0x00,0x00,0x00,0x00 },2,{ 0xE0,0xF0,0x46,0x00,0x00,0x00 },2 },1},
   {{ { 0x62,0x00,0x00,0x00,0x00,0x00 },1,{ 0x77,0x00,0x00,0x00,0x00,0x00 },1 },0}
};


Anyone can tell me if this is correct?

Edit: Slight reinterpretation, based on https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html and https://www.win.tue.nl/~aeb/linux/kbd/s ... .html#mtek :
Code: Select all
KEYBOARDENTRY_EXTENDED CTRLSYSRQ[3] = {
   {{{0x37,0x00,0x00,0x00,0x00,0x00},1,{0x00,0x00,0x00,0x00,0x00,0x00},0},1},
   {{{0xE0,0x37,0x00,0x00,0x00,0x00},2,{0x00,0x00,0x00,0x00,0x00,0x00},0},1},
   {{{0xE0,0x37,0xD4,0x00,0x00,0x00},3,{0x00,0x00,0x00,0x00,0x00,0x00},0},0}
};

KEYBOARDENTRY_EXTENDED ALTSYSRQ[3] = {
   {{{0x54,0x00,0x00,0x00,0x00,0x00},1,{0x00,0x00,0x00,0x00,0x00,0x00},0},1},
   {{{0x54,0x00,0x00,0x00,0x00,0x00},1,{0x00,0x00,0x00,0x00,0x00,0x00},0},1},
   {{{0xE0,0x54,0xD4,0x00,0x00,0x00},3,{0x00,0x00,0x00,0x00,0x00,0x00},0},0}
};

KEYBOARDENTRY_EXTENDED CTRLBREAK[3] = {
   {{{0x46,0x00,0x00,0x00,0x00,0x00},1,{0xC6,0x00,0x00,0x00,0x00,0x00},1},1},
   {{{0xE0,0x46,0x00,0x00,0x00,0x00},2,{0xE0,0xC6,0x00,0x00,0x00,0x00},2},1},
   {{{0x62,0x00,0x00,0x00,0x00,0x00},1,{0x77,0x00,0x00,0x00,0x00,0x00},1},0}
};


Anyone????

Edit: Btw, the indexes into the tables themselves are the scancode sets. So each row is a different scancode set(with the final number for an entry being a simple used flag(1=Used, 0=Not used(apply normal key table)).
superfury
l33t
 
Posts: 2613
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: PS/2 keyboard emulating cases for CTRL-BREAK, CTRL/ALT-SYSRQ?

Postby Azarien » 2018-5-17 @ 17:05

Have you tried this document?
https://download.microsoft.com/download ... ancode.doc
(page 23)
Azarien
Oldbie
 
Posts: 561
Joined: 2015-5-14 @ 07:14

Re: PS/2 keyboard emulating cases for CTRL-BREAK, CTRL/ALT-SYSRQ?

Postby superfury » 2018-5-18 @ 17:30

Just implemented and changed the tables to implement that document.

One strange thing that's mentioned in the table, though: apparently shift affects Insert/Delete/Home/End/PageUp/PageDown and normal Arrows on the keyboard, instead of the NUMPAD versions of them?
superfury
l33t
 
Posts: 2613
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: PS/2 keyboard emulating cases for CTRL-BREAK, CTRL/ALT-SYSRQ?

Postby superfury » 2018-5-28 @ 12:40

Using the AT Diagnostics SETUP disk (1), after configuring the BIOS using GSETUP and booting said disk, I've managed to check the keyboard input for errors. The SysRq and Break keys work as expected: pressing them without the Ctrl/Alt keys makes them show up as a blinking P, but combining them with ALT and/or CTRL(CTRL only for CTRL-BREAK) makes them change from a blinking P to a blinking S(SysRq) and blinking P(Pause) :D

So it might just be an issue with Minix not listening for said key combinations(even though LInux(not running in UniPCemu) does)?
superfury
l33t
 
Posts: 2613
Joined: 2014-3-08 @ 11:25
Location: Netherlands


Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 2 guests