Index: xf86-input-keyboard/src/lnx_kbd.c =================================================================== --- xf86-input-keyboard.orig/src/lnx_kbd.c +++ xf86-input-keyboard/src/lnx_kbd.c @@ -386,10 +386,31 @@ stdReadInput(InputInfoPtr pInfo) unsigned char rBuf[64]; int nBytes, i; if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) { - for (i = 0; i < nBytes; i++) - pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, - rBuf[i] & 0x80 ? FALSE : TRUE); + for (i = 0; i < nBytes; i++) { + /* This is extended medium raw mode interpreter + see linux/drivers/keyboard.c (kbd->kbdmode == VC_MEDIUMRAW) */ + switch (pKbd->mediumrawState) { + case MEDIUMRAW_DEFAULT: + if ( (rBuf[i] & 0x7f) == 0) { + pKbd->mediumrawState = MEDIUMRAW_EXTBYTE1; + pKbd->mediumrawUp = (rBuf[i] & 0x80 ? FALSE : TRUE); + } + else + pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, + rBuf[i] & 0x80 ? FALSE : TRUE); + break; + case MEDIUMRAW_EXTBYTE1: + pKbd->mediumrawData = (rBuf[i] & 0x7f); + pKbd->mediumrawState = MEDIUMRAW_EXTBYTE2; + break; + case MEDIUMRAW_EXTBYTE2: + pKbd->PostEvent(pInfo, (int)(pKbd->mediumrawData) << 7 | (rBuf[i] & 0x7f), + pKbd->mediumrawUp); + pKbd->mediumrawState = MEDIUMRAW_DEFAULT; + break; + } } + } } static Bool @@ -463,6 +484,8 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd->OpenKeyboard = OpenKeyboard; pKbd->vtSwitchSupported = FALSE; + pKbd->mediumrawState = MEDIUMRAW_DEFAULT; + pKbd->private = xcalloc(sizeof(LnxKbdPrivRec), 1); if (pKbd->private == NULL) { xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n"); Index: xf86-input-keyboard/src/xf86OSKbd.h =================================================================== --- xf86-input-keyboard.orig/src/xf86OSKbd.h +++ xf86-input-keyboard/src/xf86OSKbd.h @@ -56,6 +56,12 @@ typedef struct { unsigned char *map; } TransMapRec, *TransMapPtr; +typedef enum { + MEDIUMRAW_DEFAULT, + MEDIUMRAW_EXTBYTE1, + MEDIUMRAW_EXTBYTE2 +} KbdMediumRawState; + typedef struct { KbdInitProc KbdInit; KbdOnProc KbdOn; @@ -95,7 +101,9 @@ typedef struct { int wsKbdType; Bool sunKbd; Bool Panix106; - + KbdMediumRawState mediumrawState; + char mediumrawData; + Bool mediumrawUp; } KbdDevRec, *KbdDevPtr; typedef enum {