summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Mainz <roland.mainz@nrubsig.org>2004-12-13 14:03:44 +0000
committerRoland Mainz <roland.mainz@nrubsig.org>2004-12-13 14:03:44 +0000
commit87a3b1931cc3e1526c283d1c148bbf659dcf6ab3 (patch)
treeaf2eb17f54e347e423f72f21394d2da911591751
parent02f760a84d6ee0c862c7cd56906729816527e27c (diff)
xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c
//bugs.freedesktop.org/show_bug.cgi?id=1824) attachment #1288 (https://bugs.freedesktop.org/attachment.cgi?id=1288): Fix kbd driver for wskbd protocol and pure wscons console driver Patch by Matthieu Herrb <matthieu.herrb@laas.fr>
-rw-r--r--hw/xfree86/os-support/bsd/bsd_KbdMap.c42
-rw-r--r--hw/xfree86/os-support/bsd/bsd_kbd.c46
2 files changed, 55 insertions, 33 deletions
diff --git a/hw/xfree86/os-support/bsd/bsd_KbdMap.c b/hw/xfree86/os-support/bsd/bsd_KbdMap.c
index c0a8f8890..542eb2630 100644
--- a/hw/xfree86/os-support/bsd/bsd_KbdMap.c
+++ b/hw/xfree86/os-support/bsd/bsd_KbdMap.c
@@ -677,11 +677,11 @@ TransMapRec wsAdb = {
};
static CARD8 wsSunMap[] = {
- /* 0x00 */ KEY_NOTUSED,
- /* 0x01 */ KEY_NOTUSED, /* stop */
- /* 0x02 */ KEY_NOTUSED, /* BrightnessDown / S-VolumeDown */
- /* 0x03 */ KEY_NOTUSED, /* again */
- /* 0x04 */ KEY_NOTUSED, /* BridgtnessUp / S-VolumeUp */
+ /* 0x00 */ KEY_Help,
+ /* 0x01 */ KEY_L1, /* stop */
+ /* 0x02 */ KEY_AudioLower, /* BrightnessDown / S-VolumeDown */
+ /* 0x03 */ KEY_L2, /* again */
+ /* 0x04 */ KEY_AudioRaise, /* BridgtnessUp / S-VolumeUp */
/* 0x05 */ KEY_F1,
/* 0x06 */ KEY_F2,
/* 0x07 */ KEY_F10,
@@ -700,10 +700,10 @@ static CARD8 wsSunMap[] = {
/* 0x14 */ KEY_Up,
/* 0x15 */ KEY_Pause,
/* 0x16 */ KEY_Print,
- /* 0x17 */ KEY_NOTUSED, /* props */
+ /* 0x17 */ KEY_ScrollLock,
/* 0x18 */ KEY_Left,
- /* 0x19 */ KEY_ScrollLock,
- /* 0x1a */ KEY_NOTUSED, /* undo */
+ /* 0x19 */ KEY_L3, /* props */
+ /* 0x1a */ KEY_L4, /* undo */
/* 0x1b */ KEY_Down,
/* 0x1c */ KEY_Right,
/* 0x1d */ KEY_Escape,
@@ -722,13 +722,13 @@ static CARD8 wsSunMap[] = {
/* 0x2a */ KEY_Tilde,
/* 0x2b */ KEY_BackSpace,
/* 0x2c */ KEY_Insert,
- /* 0x2d */ KEY_KP_Equal,
+ /* 0x2d */ KEY_Mute, /* Audio Mute */
/* 0x2e */ KEY_KP_Divide,
/* 0x2f */ KEY_KP_Multiply,
/* 0x30 */ KEY_NOTUSED,
- /* 0x31 */ KEY_NOTUSED, /* front */
+ /* 0x31 */ KEY_L5, /* front */
/* 0x32 */ KEY_KP_Decimal,
- /* 0x33 */ KEY_NOTUSED, /* copy */
+ /* 0x33 */ KEY_L6, /* copy */
/* 0x34 */ KEY_Home,
/* 0x35 */ KEY_Tab,
/* 0x36 */ KEY_Q,
@@ -744,13 +744,13 @@ static CARD8 wsSunMap[] = {
/* 0x40 */ KEY_LBrace,
/* 0x41 */ KEY_RBrace,
/* 0x42 */ KEY_Delete,
- /* 0x43 */ KEY_NOTUSED, /* compose */
+ /* 0x43 */ KEY_Menu, /* compose */
/* 0x44 */ KEY_KP_7,
/* 0x45 */ KEY_KP_8,
/* 0x46 */ KEY_KP_9,
/* 0x47 */ KEY_KP_Minus,
- /* 0x48 */ KEY_NOTUSED, /* open */
- /* 0x49 */ KEY_NOTUSED, /* paste */
+ /* 0x48 */ KEY_L7, /* open */
+ /* 0x49 */ KEY_L8, /* paste */
/* 0x4a */ KEY_End,
/* 0x4b */ KEY_NOTUSED,
/* 0x4c */ KEY_LCtrl,
@@ -772,9 +772,9 @@ static CARD8 wsSunMap[] = {
/* 0x5c */ KEY_KP_5,
/* 0x5d */ KEY_KP_6,
/* 0x5e */ KEY_KP_0,
- /* 0x5f */ KEY_NOTUSED, /* find */
+ /* 0x5f */ KEY_L9, /* find */
/* 0x60 */ KEY_PgUp,
- /* 0x61 */ KEY_NOTUSED, /* cut */
+ /* 0x61 */ KEY_L10, /* cut */
/* 0x62 */ KEY_NumLock,
/* 0x63 */ KEY_ShiftL,
/* 0x64 */ KEY_Z,
@@ -801,7 +801,7 @@ static CARD8 wsSunMap[] = {
/* 0x79 */ KEY_Space,
/* 0x7a */ KEY_RMeta,
/* 0x7b */ KEY_PgDown,
- /* 0x7c */ KEY_NOTUSED,
+ /* 0x7c */ KEY_Less, /* < > on some keyboards */
/* 0x7d */ KEY_KP_Plus,
/* 0x7e */ KEY_NOTUSED,
/* 0x7f */ KEY_NOTUSED
@@ -1044,9 +1044,11 @@ KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
case PCCONS:
case PCVT:
pKbd->RemapScanCode = ATScancode;
+ break;
#endif
#ifdef WSCONS_SUPPORT
case WSCONS:
+ if (!pKbd->isConsole) {
switch (pKbd->wsKbdType) {
case WSKBD_TYPE_PC_XT:
case WSKBD_TYPE_PC_AT:
@@ -1061,6 +1063,9 @@ KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
break;
#endif
#ifdef WSKBD_TYPE_SUN
+#ifdef WSKBD_TYPE_SUN5
+ case WSKBD_TYPE_SUN5:
+#endif
case WSKBD_TYPE_SUN:
pKbd->scancodeMap = &wsSun;
break;
@@ -1068,6 +1073,9 @@ KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
default:
ErrorF("Unknown wskbd type %d\n", pKbd->wsKbdType);
}
+ } else {
+ pKbd->RemapScanCode = ATScancode;
+ }
break;
#endif
}
diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.c b/hw/xfree86/os-support/bsd/bsd_kbd.c
index 871bd2411..67f0b800d 100644
--- a/hw/xfree86/os-support/bsd/bsd_kbd.c
+++ b/hw/xfree86/os-support/bsd/bsd_kbd.c
@@ -143,7 +143,7 @@ static int
KbdOn(InputInfoPtr pInfo, int what)
{
KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
+#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private;
struct termios nTty;
#endif
@@ -154,7 +154,7 @@ KbdOn(InputInfoPtr pInfo, int what)
if (pKbd->isConsole) {
switch (pKbd->consType) {
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
+#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
case SYSCONS:
case PCCONS:
case PCVT:
@@ -170,7 +170,10 @@ KbdOn(InputInfoPtr pInfo, int what)
nTty.c_cc[VMIN] = 1;
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
- tcsetattr(pInfo->fd, TCSANOW, &nTty);
+ if (tcsetattr(pInfo->fd, TCSANOW, &nTty) < 0) {
+ xf86Msg(X_ERROR, "KbdOn: tcsetattr: %s\n",
+ strerror(errno));
+ }
break;
#endif
}
@@ -197,7 +200,7 @@ KbdOn(InputInfoPtr pInfo, int what)
"or use for example:\n\n"
"Option \"Protocol\" \"wskbd\"\n"
"Option \"Device\" \"/dev/wskbd0\"\n"
- "\nin your XF86Config(5) file\n");
+ "\nin your xorg.conf(5) file\n");
}
break;
#endif
@@ -232,7 +235,7 @@ KbdOff(InputInfoPtr pInfo, int what)
case WSCONS:
option = WSKBD_TRANSLATED;
ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &(priv->kbdtty));
+ tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty));
break;
#endif
}
@@ -380,22 +383,30 @@ stdReadInput(InputInfoPtr pInfo)
}
#ifdef WSCONS_SUPPORT
+
static void
WSReadInput(InputInfoPtr pInfo)
{
KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
struct wscons_event events[64];
- int n, i;
+ int type;
+ int blocked, n, i;
+
if ((n = read( pInfo->fd, events, sizeof(events))) > 0) {
n /= sizeof(struct wscons_event);
- for (i = 0; i < n; i++)
- pKbd->PostEvent(pInfo, events[i].value,
- events[i].type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE);
- }
+ for (i = 0; i < n; i++) {
+ type = events[i].type;
+ if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) {
+ /* It seems better to block SIGIO there */
+ blocked = xf86BlockSIGIO();
+ pKbd->PostEvent(pInfo, (unsigned int)(events[i].value),
+ type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE);
+ xf86UnblockSIGIO(blocked);
+ }
+ } /* for */
+ }
}
-#endif
-#ifdef WSCONS_SUPPORT
static void
printWsType(char *type, char *devname)
{
@@ -448,15 +459,14 @@ OpenKeyboard(InputInfoPtr pInfo)
pKbd->consType = xf86Info.consType;
}
} else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
+ pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
if (pInfo->fd == -1) {
xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
xfree(s);
return FALSE;
}
pKbd->isConsole = FALSE;
- /* XXX What is consType here? */
- pKbd->consType = SYSCONS;
+ pKbd->consType = xf86Info.consType;
xfree(s);
}
@@ -495,6 +505,11 @@ OpenKeyboard(InputInfoPtr pInfo)
printWsType("Sun", pInfo->name);
break;
#endif
+#ifdef WSKBD_TYPE_SUN5
+ case WSKBD_TYPE_SUN5:
+ xf86Msg(X_PROBED, "Keyboard type: Sun5\n");
+ break;
+#endif
default:
xf86Msg(X_ERROR, "%s: Unsupported wskbd type \"%d\"",
pInfo->name, pKbd->wsKbdType);
@@ -535,4 +550,3 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
}
return TRUE;
}
-