Module Name: xsrc
Committed By: mrg
Date: Thu Mar 20 06:40:47 UTC 2014
Modified Files:
xsrc/external/mit/xf86-input-keyboard/dist/src: bsd_KbdMap.c bsd_kbd.c
Log Message:
merge xf86-input-keyboard 1.8.0.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c
cvs rdiff -u -r1.18 -r1.19 \
xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c
diff -u xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c:1.8 xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c:1.9
--- xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c:1.8 Mon Jul 16 12:49:42 2012
+++ xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c Thu Mar 20 06:40:47 2014
@@ -260,7 +260,6 @@ static CARD8 wsUsbMap[] = {
/* 47 */ KEY_LBrace, /* [ { */
/* 48 */ KEY_RBrace, /* ] } */
/* 49 */ KEY_BSlash, /* \ | */
- /* this was KEY_BSlash2 which seems bogus */
/* 50 */ KEY_BSlash, /* \ _ # ~ on some keyboards */
/* 51 */ KEY_SemiColon, /* ; : */
/* 52 */ KEY_Quote, /* ' " */
@@ -444,7 +443,7 @@ static CARD8 wsUsbMap[] = {
/* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
/* 231 */ KEY_LMeta, /* Right Meta XXX */
};
-#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char))
+#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(*wsUsbMap))
static
TransMapRec wsUsb = {
@@ -458,7 +457,7 @@ static CARD8 wsXtMap[] = {
/* 1 */ KEY_Escape,
/* 2 */ KEY_1,
/* 3 */ KEY_2,
- /* 4 */ KEY_3,
+ /* 4 */ KEY_3,
/* 5 */ KEY_4,
/* 6 */ KEY_5,
/* 7 */ KEY_6,
@@ -677,7 +676,7 @@ static CARD8 wsXtMap[] = {
/* 220 */ KEY_RMeta,
/* 221 */ KEY_Menu,
};
-#define WS_XT_MAP_SIZE (sizeof(wsXtMap)/sizeof(unsigned char))
+#define WS_XT_MAP_SIZE (sizeof(wsXtMap)/sizeof(*wsXtMap))
static
TransMapRec wsXt = {
@@ -817,7 +816,7 @@ static CARD8 wsAdbMap[] = {
/* 126 */ KEY_NOTUSED,
/* 127 */ KEY_Power
};
-#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char))
+#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(*wsAdbMap))
static
TransMapRec wsAdb = {
@@ -1081,7 +1080,7 @@ static CARD8 wsLk201Map[] = {
/* 250 */ KEY_NOTUSED,
/* 251 */ KEY_NOTUSED,
};
-#define WS_LK201_MAP_SIZE (sizeof(wsLk201Map)/sizeof(unsigned char))
+#define WS_LK201_MAP_SIZE (sizeof(wsLk201Map)/sizeof(*wsLk201Map))
static
TransMapRec wsLk201 = {
@@ -1220,7 +1219,7 @@ static CARD8 wsSunMap[] = {
/* 0x7e */ KEY_NOTUSED,
/* 0x7f */ KEY_NOTUSED
};
-#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char))
+#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(*wsSunMap))
static
TransMapRec wsSun = {
@@ -1373,7 +1372,7 @@ KbdGetMapping (InputInfoPtr pInfo, KeySy
#endif
#ifdef WSKBD_TYPE_LK201
case WSKBD_TYPE_LK201:
- pKbd->scancodeMap = &wsLk201;
+ pKbd->scancodeMap = &wsLk201;
break;
#endif
#ifdef WSKBD_TYPE_SUN
Index: xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c
diff -u xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.18 xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.19
--- xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.18 Mon Mar 18 11:50:08 2013
+++ xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c Thu Mar 20 06:40:47 2014
@@ -39,6 +39,21 @@ typedef struct {
struct termios kbdtty;
} BsdKbdPrivRec, *BsdKbdPrivPtr;
+#ifdef WSCONS_SUPPORT
+static Bool
+WSSetVersion(int fd, const char *name)
+{
+#ifdef WSKBDIO_SETVERSION
+ int version = WSKBDIO_EVENT_VERSION;
+ if (ioctl(fd, WSKBDIO_SETVERSION, &version) == -1) {
+ xf86Msg(X_WARNING, "%s: cannot set version\n", name);
+ return FALSE;
+ }
+#endif
+ return TRUE;
+}
+#endif
+
static
int KbdInit(InputInfoPtr pInfo, int what)
{
@@ -54,7 +69,7 @@ int KbdInit(InputInfoPtr pInfo, int what
#if defined WSCONS_SUPPORT
case WSCONS:
#endif
- tcgetattr(pInfo->fd, &(priv->kbdtty));
+ tcgetattr(pInfo->fd, &(priv->kbdtty));
#endif
break;
}
@@ -173,8 +188,8 @@ KbdOn(InputInfoPtr pInfo, int what)
xf86Msg(X_ERROR, "KbdOn: tcsetattr: %s\n",
strerror(errno));
}
- break;
-#endif
+ break;
+#endif
}
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT)
switch (pKbd->consType) {
@@ -208,18 +223,17 @@ KbdOn(InputInfoPtr pInfo, int what)
switch (pKbd->consType) {
#ifdef WSCONS_SUPPORT
case WSCONS:
- if ((pKbd->wsKbdDev[0] != 0) && (pInfo->fd == -1)) {
- xf86Msg(X_INFO, "opening %s\n", pKbd->wsKbdDev);
- pInfo->fd = open(pKbd->wsKbdDev, O_RDONLY | O_NONBLOCK | O_EXCL);
-#ifdef WSKBDIO_SETVERSION
- int version = WSKBDIO_EVENT_VERSION;
- if (ioctl(pInfo->fd, WSKBDIO_SETVERSION, &version) == -1) {
- xf86Msg(X_WARNING, "%s: cannot set version\n", pInfo->name);
- return FALSE;
- }
-#endif
- }
- break;
+ if ((pKbd->wsKbdDev[0] != 0) && (pInfo->fd == -1)) {
+ xf86Msg(X_INFO, "opening %s\n", pKbd->wsKbdDev);
+ pInfo->fd = open(pKbd->wsKbdDev, O_RDONLY | O_NONBLOCK | O_EXCL);
+ if (pInfo->fd == -1) {
+ xf86Msg(X_ERROR, "cannot open \"%s\"\n", pKbd->wsKbdDev);
+ return FALSE;
+ }
+ if (WSSetVersion(pInfo->fd, pInfo->name) == FALSE)
+ return FALSE;
+ }
+ break;
#endif
}
}
@@ -261,15 +275,15 @@ KbdOff(InputInfoPtr pInfo, int what)
#ifdef WSCONS_SUPPORT
case WSCONS:
if ((pKbd->wsKbdDev[0] != 0) && (pInfo->fd != -1)) {
- xf86Msg(X_INFO, "closing %s\n", pKbd->wsKbdDev);
- /* need to close the fd while we're gone */
- close(pInfo->fd);
- pInfo->fd = -1;
+ xf86Msg(X_INFO, "closing %s\n", pKbd->wsKbdDev);
+ /* need to close the fd while we're gone */
+ close(pInfo->fd);
+ pInfo->fd = -1;
}
break;
#endif
}
- }
+ }
return Success;
}
@@ -282,7 +296,7 @@ SoundBell(InputInfoPtr pInfo, int loudne
#endif
if (loudness && pitch) {
- switch (pKbd->consType) {
+ switch (pKbd->consType) {
#ifdef PCCONS_SUPPORT
case PCCONS:
{ int data[2];
@@ -352,9 +366,9 @@ WSReadInput(InputInfoPtr pInfo)
}
static void
-printWsType(const char *type, char *name)
+printWsType(const char *type, const char *name)
{
- xf86Msg(X_PROBED, "%s: Keyboard type: %s\n", name, type);
+ xf86Msg(X_PROBED, "%s: Keyboard type: %s\n", name, type);
}
#endif
@@ -375,7 +389,7 @@ OpenKeyboard(InputInfoPtr pInfo)
}
switch (prot) {
- case PROT_STD:
+ case PROT_STD:
pInfo->read_input = stdReadInput;
break;
#ifdef WSCONS_SUPPORT
@@ -390,9 +404,9 @@ OpenKeyboard(InputInfoPtr pInfo)
}
free(s);
- if (prot == PROT_WSCONS) {
+ if (prot == PROT_WSCONS)
s = xf86SetStrOption(pInfo->options, "Device", "/dev/wskbd");
- } else
+ else
s = xf86SetStrOption(pInfo->options, "Device", NULL);
if (s == NULL) {
@@ -416,13 +430,8 @@ OpenKeyboard(InputInfoPtr pInfo)
#ifdef WSCONS_SUPPORT
if( prot == PROT_WSCONS) {
pKbd->consType = WSCONS;
-#ifdef WSKBDIO_SETVERSION
- int version = WSKBDIO_EVENT_VERSION;
- if (ioctl(pInfo->fd, WSKBDIO_SETVERSION, &version) == -1) {
- xf86Msg(X_WARNING, "%s: cannot set version\n", pInfo->name);
- return FALSE;
- }
-#endif
+ if (WSSetVersion(pInfo->fd, pInfo->name) == FALSE)
+ return FALSE;
/* Find out keyboard type */
if (ioctl(pInfo->fd, WSKBDIO_GTYPE, &(pKbd->wsKbdType)) == -1) {
xf86Msg(X_ERROR, "%s: cannot get keyboard type", pInfo->name);
@@ -442,6 +451,12 @@ OpenKeyboard(InputInfoPtr pInfo)
case WSKBD_TYPE_PC_AT:
printWsType("AT", pInfo->name);
break;
+ case 0:
+ /* If wsKbdType==0, no keyboard attached to the mux. Assume USB. */
+ xf86Msg(X_WARNING, "%s: No keyboard attached, assuming USB\n",
+ pInfo->name);
+ pKbd->wsKbdType = WSKBD_TYPE_USB;
+ /* FALLTHROUGH */
case WSKBD_TYPE_USB:
printWsType("USB", pInfo->name);
break;
@@ -478,16 +493,6 @@ OpenKeyboard(InputInfoPtr pInfo)
}
}
#endif
-
-#if 0 /* no more vtSwitchSupported in xf86-input-keyboard-1.6.0 */
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT)
- if ((pKbd->isConsole &&
- ((pKbd->consType == SYSCONS) || (pKbd->consType == PCVT))) ||
- (pKbd->consType == WSCONS))
- pKbd->vtSwitchSupported = TRUE;
-#endif
-#endif
-
return TRUE;
}