maf@dtek.chalmers.se (Martin Forssen) (04/11/91)
Below follows a patch which enables the LEDs on a sun type 4 keyboard. Please notet that this patch is not official in any way, but it works well at our site (running X11R4 pl18 on Sun 3/80). The file which should be patched is .../mit/server/ddx/sun/sunKbd.c, so to patch cd to the directory .../mit/server/ddx/sun and give the command patch < "This article" \MaF *** sunKbd.c.old Mon Dec 31 14:54:18 1990 --- sunKbd.c Sun Apr 7 18:33:32 1991 *************** *** 397,402 **** --- 397,406 ---- ErrorF("sunKbdCtrl: can't open keyboard"); return; } + if (ioctl(pPriv->fd, KIOCTYPE, &pPriv->type) < 0) { + ErrorF("sunKbdCtrl: can't get keyboard"); + goto bad; + } } if (ioctl (pPriv->fd, KIOCCMD, &kbdClickCmd) < 0) { *************** *** 404,409 **** --- 408,428 ---- goto bad; } + /* + * Led control for type 4 keyboard done by maf@dtek.chalmers.se + */ + if (pPriv->type == KB_SUN4 && ctrl->leds & 0x0f) { + char leds; + if (ctrl->leds & 0x08) leds |= LED_CAPS_LOCK; + if (ctrl->leds & 0x04) leds |= LED_COMPOSE; + if (ctrl->leds & 0x02) leds |= LED_SCROLL_LOCK; + if (ctrl->leds & 0x01) leds |= LED_NUM_LOCK; + if (ioctl (pPriv->fd, KIOCSLED, &leds) < 0) { + ErrorF("Failed to set leds"); + goto bad; + } + } + *pPriv->ctrl = *ctrl; bad: -- Chalmers |USENET:maf@dtek.chalmers.se | " Of course I'm not lost, University |SNAIL: Martin Forssen | I just haven't pinpointed of | Marielundsgatan 9 | exactly where we are at the Technology |SWEDEN 431 67 Molndal | moment " (David Eddings)