evBuf[0].value = (c | 0x80) ;
evBuf[0].value = c2;
hpcKbdGetEvents(pPriv, pNumEvents, pAgain)    hpcKbdPrivPtr pPriv;    int*	pNumEvents;    Bool*	pAgain;{    int fd;    int	nBytes;	    /* number of bytes of events available. */    u_char c;    static hpcEvent evBuf[MAXEVENTS];   /* Buffer for hpcEvents */    fd = pPriv->fd;AGAIN:    switch (pPriv->devtype) {    case HPC_KBDDEV_RAW:	    if (read(fd, &c, 1) < 0) {		if (errno == EWOULDBLOCK) {		    *pNumEvents = 0;		    *pAgain = FALSE;		} else {		    hpcError ("Reading keyboard");		    hpcFatalError (("Could not read the keyboard"));		}	    } else {		*pAgain = TRUE;		*pNumEvents = 0;		switch (pPriv->xlatestat) {		case HPC_KBDXSTAT_INIT:		    if (c == KBR_EXTENDED0) {			pPriv->xlatestat = HPC_KBDXSTAT_EXT0;			goto AGAIN;		    } else		    if (c == KBR_EXTENDED1) {			pPriv->xlatestat = HPC_KBDXSTAT_EXT1;			goto AGAIN;		    } else {			*pNumEvents = 1;			evBuf[0].value = (c & 0x7f);		    }		    break;		case HPC_KBDXSTAT_EXT0:		    *pNumEvents = 1;		    evBuf[0].value = (c | 0x80) ;		    pPriv->xlatestat = HPC_KBDXSTAT_INIT;		    break;		case HPC_KBDXSTAT_EXT1:		    if (c == 0x1d) {			pPriv->xlatestat = HPC_KBDXSTAT_EXT1_1D;			goto AGAIN;		    } else		    if (c == 0x9d) {			pPriv->xlatestat = HPC_KBDXSTAT_EXT1_9D;			goto AGAIN;		    } else {			hpcErrorF(("hpcKbdGetEvents: unexpected input"			    " %02x, stat=%d", c, pPriv->xlatestat));			pPriv->xlatestat = HPC_KBDXSTAT_INIT;			goto AGAIN;		    }		    break;		case HPC_KBDXSTAT_EXT1_1D:		case HPC_KBDXSTAT_EXT1_9D:		    if (c == 0x45 || c == (0x45 | 0x80)) {			*pNumEvents = 1;			evBuf[0].value = 0x7f;			pPriv->xlatestat = HPC_KBDXSTAT_INIT;		    } else {			hpcErrorF(("hpcKbdGetEvents: unexpected input %02x, stat=%d",			    c, pPriv->xlatestat));			pPriv->xlatestat = HPC_KBDXSTAT_INIT;			goto AGAIN;		    }		    break;		default:		    hpcFatalError(("hpcKbdGetEvents: invalid xlate status"));		    break;		}		if (*pNumEvents != 0) {		    struct timeval tv;		    gettimeofday(&tv, NULL);		    evBuf[0].type = (c & 0x80) ?				WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;		    TIMEVAL_TO_TIMESPEC(&tv, &evBuf[0].time);		}	    }	    break;    case HPC_KBDDEV_WSKBD:    case HPC_KBDDEV_WSMUX:	if ((nBytes = read(fd, evBuf, sizeof(evBuf))) == -1) {	    if (errno == EWOULDBLOCK) {		*pNumEvents = 0;		*pAgain = FALSE;	    } else {		hpcError ("Reading keyboard");		hpcFatalError (("Could not read the keyboard"));	    }	} else {	    *pNumEvents = nBytes / sizeof (hpcEvent);	    *pAgain = (nBytes == sizeof (evBuf));	}	break;    }    return evBuf;}