1*561e6c8bSriastradh /* $NetBSD: hpf1275a_tty.c,v 1.33 2023/05/10 00:09:54 riastradh Exp $ */
26bed93d4Suwe
36bed93d4Suwe /*
46bed93d4Suwe * Copyright (c) 2004 Valeriy E. Ushakov
56bed93d4Suwe * All rights reserved.
66bed93d4Suwe *
76bed93d4Suwe * Redistribution and use in source and binary forms, with or without
86bed93d4Suwe * modification, are permitted provided that the following conditions
96bed93d4Suwe * are met:
106bed93d4Suwe * 1. Redistributions of source code must retain the above copyright
116bed93d4Suwe * notice, this list of conditions and the following disclaimer.
126bed93d4Suwe * 2. Redistributions in binary form must reproduce the above copyright
136bed93d4Suwe * notice, this list of conditions and the following disclaimer in the
146bed93d4Suwe * documentation and/or other materials provided with the distribution.
156bed93d4Suwe * 3. The name of the author may not be used to endorse or promote products
166bed93d4Suwe * derived from this software without specific prior written permission
176bed93d4Suwe *
186bed93d4Suwe * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
196bed93d4Suwe * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
206bed93d4Suwe * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
216bed93d4Suwe * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
226bed93d4Suwe * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
236bed93d4Suwe * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246bed93d4Suwe * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256bed93d4Suwe * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266bed93d4Suwe * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
276bed93d4Suwe * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286bed93d4Suwe */
296bed93d4Suwe
306bed93d4Suwe #include <sys/cdefs.h>
31*561e6c8bSriastradh __KERNEL_RCSID(0, "$NetBSD: hpf1275a_tty.c,v 1.33 2023/05/10 00:09:54 riastradh Exp $");
3250e02865Suwe
3350e02865Suwe #include "opt_wsdisplay_compat.h"
346bed93d4Suwe
356bed93d4Suwe #include <sys/param.h>
366bed93d4Suwe #include <sys/kernel.h>
376bed93d4Suwe #include <sys/conf.h>
386bed93d4Suwe #include <sys/device.h>
396bed93d4Suwe #include <sys/tty.h>
406bed93d4Suwe #include <sys/fcntl.h>
41f7d6597dSuwe #include <sys/proc.h>
426bed93d4Suwe #include <sys/systm.h>
4352da0471Syamt #include <sys/kauth.h>
446bed93d4Suwe
456bed93d4Suwe #include <dev/wscons/wsconsio.h>
466bed93d4Suwe #include <dev/wscons/wskbdvar.h>
476bed93d4Suwe #include <dev/wscons/wsksymdef.h>
486bed93d4Suwe #include <dev/wscons/wsksymvar.h>
496bed93d4Suwe
50f7d6597dSuwe #include <dev/pckbport/wskbdmap_mfii.h>
51f7d6597dSuwe #ifdef WSDISPLAY_COMPAT_RAWKBD
52f7d6597dSuwe #include <dev/hpc/pckbd_encode.h>
53f7d6597dSuwe #endif
54f7d6597dSuwe
5582b8cabaSriastradh #include "ioconf.h"
566bed93d4Suwe
576bed93d4Suwe struct hpf1275a_softc {
58cbab9cadSchs device_t sc_dev;
596bed93d4Suwe
606bed93d4Suwe struct tty *sc_tp; /* back reference to the tty */
61529e91fcScegger device_t sc_wskbd; /* wskbd child */
626bed93d4Suwe int sc_enabled;
6350e02865Suwe #ifdef WSDISPLAY_COMPAT_RAWKBD
6450e02865Suwe int sc_rawkbd;
6550e02865Suwe #endif
666bed93d4Suwe };
676bed93d4Suwe
686bed93d4Suwe
696bed93d4Suwe /* pseudo-device initialization */
706bed93d4Suwe extern void hpf1275aattach(int);
716bed93d4Suwe
726bed93d4Suwe /* line discipline methods */
736bed93d4Suwe static int hpf1275a_open(dev_t, struct tty *);
746bed93d4Suwe static int hpf1275a_close(struct tty *, int);
756bed93d4Suwe static int hpf1275a_input(int, struct tty *);
766bed93d4Suwe
776bed93d4Suwe /* autoconf(9) methods */
78529e91fcScegger static int hpf1275a_match(device_t, cfdata_t, void *);
79529e91fcScegger static void hpf1275a_attach(device_t, device_t, void *);
80529e91fcScegger static int hpf1275a_detach(device_t, int);
816bed93d4Suwe
826bed93d4Suwe /* wskbd(4) accessops */
836bed93d4Suwe static int hpf1275a_wskbd_enable(void *, int);
846bed93d4Suwe static void hpf1275a_wskbd_set_leds(void *, int);
8553524e44Schristos static int hpf1275a_wskbd_ioctl(void *, u_long, void *, int,
86be72c765Suwe struct lwp *);
876bed93d4Suwe
886bed93d4Suwe
89f7d6597dSuwe /*
90f7d6597dSuwe * It doesn't need to be exported, as only hpf1275aattach() uses it,
91f7d6597dSuwe * but there's no "official" way to make it static.
92f7d6597dSuwe */
93cbab9cadSchs CFATTACH_DECL_NEW(hpf1275a, sizeof(struct hpf1275a_softc),
946bed93d4Suwe hpf1275a_match, hpf1275a_attach, hpf1275a_detach, NULL);
956bed93d4Suwe
966bed93d4Suwe
976bed93d4Suwe static struct linesw hpf1275a_disc = {
987d00e1afSthorpej .l_name = "hpf1275a",
997d00e1afSthorpej .l_open = hpf1275a_open,
1007d00e1afSthorpej .l_close = hpf1275a_close,
1017d00e1afSthorpej .l_read = ttyerrio,
1027d00e1afSthorpej .l_write = ttyerrio,
1037d00e1afSthorpej .l_ioctl = ttynullioctl,
1047d00e1afSthorpej .l_rint = hpf1275a_input,
1057d00e1afSthorpej .l_start = ttstart,
1067d00e1afSthorpej .l_modem = nullmodem,
1077d00e1afSthorpej .l_poll = ttpoll
1086bed93d4Suwe };
1096bed93d4Suwe
1106bed93d4Suwe
1116bed93d4Suwe static const struct wskbd_accessops hpf1275a_wskbd_accessops = {
1126bed93d4Suwe hpf1275a_wskbd_enable,
1136bed93d4Suwe hpf1275a_wskbd_set_leds,
1146bed93d4Suwe hpf1275a_wskbd_ioctl
1156bed93d4Suwe };
1166bed93d4Suwe
1176bed93d4Suwe
118b2d14e97Suwe static const struct wskbd_mapdata hpf1275a_wskbd_keymapdata = {
1196bed93d4Suwe pckbd_keydesctab, KB_US
1206bed93d4Suwe };
1216bed93d4Suwe
1226bed93d4Suwe
1236bed93d4Suwe /* F1275A scancodes -> XT scancodes so that we can use pckbd_keydesctab. */
124bf9317f6Suwe static const uint8_t hpf1275a_to_xtscan[128] = {
1256bed93d4Suwe [0x04] = 30, /* a */
1266bed93d4Suwe [0x05] = 48, /* b */
1276bed93d4Suwe [0x06] = 46, /* c */
1286bed93d4Suwe [0x07] = 32, /* d */
1296bed93d4Suwe [0x08] = 18, /* e */
1306bed93d4Suwe [0x09] = 33, /* f */
1316bed93d4Suwe [0x0a] = 34, /* g */
1326bed93d4Suwe [0x0b] = 35, /* h */
1336bed93d4Suwe [0x0c] = 23, /* i */
1346bed93d4Suwe [0x0d] = 36, /* j */
1356bed93d4Suwe [0x0e] = 37, /* k */
1366bed93d4Suwe [0x0f] = 38, /* l */
1376bed93d4Suwe [0x10] = 50, /* m */
1386bed93d4Suwe [0x11] = 49, /* n */
1396bed93d4Suwe [0x12] = 24, /* o */
1406bed93d4Suwe [0x13] = 25, /* p */
1416bed93d4Suwe [0x14] = 16, /* q */
1426bed93d4Suwe [0x15] = 19, /* r */
1436bed93d4Suwe [0x16] = 31, /* s */
1446bed93d4Suwe [0x17] = 20, /* t */
1456bed93d4Suwe [0x18] = 22, /* u */
1466bed93d4Suwe [0x19] = 47, /* v */
1476bed93d4Suwe [0x1a] = 17, /* w */
1486bed93d4Suwe [0x1b] = 45, /* x */
1496bed93d4Suwe [0x1c] = 21, /* y */
1506bed93d4Suwe [0x1d] = 44, /* z */
1516bed93d4Suwe
1526bed93d4Suwe [0x1e] = 2, /* 1 */
1536bed93d4Suwe [0x1f] = 3, /* 2 */
1546bed93d4Suwe [0x20] = 4, /* 3 */
1556bed93d4Suwe [0x21] = 5, /* 4 */
1566bed93d4Suwe [0x22] = 6, /* 5 */
1576bed93d4Suwe [0x23] = 7, /* 6 */
1586bed93d4Suwe [0x24] = 8, /* 7 */
1596bed93d4Suwe [0x25] = 9, /* 8 */
1606bed93d4Suwe [0x26] = 10, /* 9 */
1616bed93d4Suwe [0x27] = 11, /* 0 */
1626bed93d4Suwe
1636bed93d4Suwe [0x28] = 28, /* Enter */
1646bed93d4Suwe
1656bed93d4Suwe [0x29] = 1, /* ESC */
1666bed93d4Suwe [0x2a] = 14, /* Backspace */
1676bed93d4Suwe [0x2b] = 15, /* Tab */
1686bed93d4Suwe [0x2c] = 57, /* Space */
1696bed93d4Suwe
1706bed93d4Suwe [0x2d] = 12, /* - */
1716bed93d4Suwe [0x2e] = 13, /* = */
1726bed93d4Suwe [0x2f] = 26, /* [ */
1736bed93d4Suwe [0x30] = 27, /* ] */
1746bed93d4Suwe [0x31] = 43, /* \ */
1756bed93d4Suwe
1766bed93d4Suwe [0x33] = 39, /* ; */
1776bed93d4Suwe [0x34] = 40, /* ' */
1786bed93d4Suwe [0x35] = 41, /* ` */
1796bed93d4Suwe [0x36] = 51, /* , */
1806bed93d4Suwe [0x37] = 52, /* . */
1816bed93d4Suwe [0x38] = 53, /* / */
1826bed93d4Suwe
1836bed93d4Suwe [0x3a] = 59, /* F1 */
1846bed93d4Suwe [0x3b] = 60, /* F2 */
1856bed93d4Suwe [0x3c] = 61, /* F3 */
1866bed93d4Suwe [0x3d] = 62, /* F4 */
1876bed93d4Suwe [0x3e] = 63, /* F5 */
1886bed93d4Suwe [0x3f] = 64, /* F6 */
1896bed93d4Suwe [0x40] = 65, /* F7 */
1906bed93d4Suwe [0x41] = 66, /* F8 */
1916bed93d4Suwe
1926bed93d4Suwe [0x42] = 68, /* "OK" -> F10 */
1936bed93d4Suwe [0x43] = 87, /* "Cancel" -> F11 */
1946bed93d4Suwe
1956bed93d4Suwe [0x4c] = 211, /* Del */
1966bed93d4Suwe
1976bed93d4Suwe [0x4f] = 205, /* Right */
1986bed93d4Suwe [0x50] = 203, /* Left */
1996bed93d4Suwe [0x51] = 208, /* Down */
2006bed93d4Suwe [0x52] = 200, /* Up */
2016bed93d4Suwe
2026bed93d4Suwe [0x53] = 67, /* "task switch" -> F9 */
2036bed93d4Suwe
2046bed93d4Suwe [0x65] = 221, /* windows */
2056bed93d4Suwe [0x66] = 88, /* "keyboard" -> F12 */
2066bed93d4Suwe
2076bed93d4Suwe [0x74] = 42, /* Shift (left) */
2086bed93d4Suwe [0x75] = 54, /* Shift (right) */
2096bed93d4Suwe [0x76] = 56, /* Alt (left) */
2106bed93d4Suwe [0x77] = 184, /* Fn -> AltGr == Mode Switch */
2116bed93d4Suwe [0x78] = 29, /* Control (left) */
2126bed93d4Suwe };
2136bed93d4Suwe
2146bed93d4Suwe
2156bed93d4Suwe /*
2166bed93d4Suwe * Pseudo-device initialization routine called from main().
2176bed93d4Suwe */
2186bed93d4Suwe void
hpf1275aattach(int n)219168cd830Schristos hpf1275aattach(int n)
2206bed93d4Suwe {
2216bed93d4Suwe int error;
2226bed93d4Suwe
2237d00e1afSthorpej error = ttyldisc_attach(&hpf1275a_disc);
2247d00e1afSthorpej if (error) {
2257d00e1afSthorpej printf("%s: unable to register line discipline, error = %d\n",
2267d00e1afSthorpej hpf1275a_cd.cd_name, error);
2276bed93d4Suwe return;
2286bed93d4Suwe }
2296bed93d4Suwe
2306bed93d4Suwe error = config_cfattach_attach(hpf1275a_cd.cd_name, &hpf1275a_ca);
2316bed93d4Suwe if (error) {
2326bed93d4Suwe printf("%s: unable to register cfattach, error = %d\n",
2336bed93d4Suwe hpf1275a_cd.cd_name, error);
2346bed93d4Suwe config_cfdriver_detach(&hpf1275a_cd);
235be72c765Suwe (void) ttyldisc_detach(&hpf1275a_disc);
2366bed93d4Suwe }
2376bed93d4Suwe }
2386bed93d4Suwe
2396bed93d4Suwe
2406bed93d4Suwe /*
2416bed93d4Suwe * Autoconf match routine.
2426bed93d4Suwe *
2436bed93d4Suwe * XXX: unused: config_attach_pseudo(9) does not call ca_match.
2446bed93d4Suwe */
2456bed93d4Suwe static int
hpf1275a_match(device_t self,cfdata_t cfdata,void * arg)246cbab9cadSchs hpf1275a_match(device_t self, cfdata_t cfdata, void *arg)
2476bed93d4Suwe {
2486bed93d4Suwe
2496bed93d4Suwe /* pseudo-device; always present */
2506bed93d4Suwe return (1);
2516bed93d4Suwe }
2526bed93d4Suwe
2536bed93d4Suwe
2546bed93d4Suwe /*
2556bed93d4Suwe * Autoconf attach routine. Called by config_attach_pseudo(9) when we
2566bed93d4Suwe * open the line discipline.
2576bed93d4Suwe */
2586bed93d4Suwe static void
hpf1275a_attach(device_t parent,device_t self,void * aux)259cbab9cadSchs hpf1275a_attach(device_t parent, device_t self, void *aux)
2606bed93d4Suwe {
26192c7bba3Sthorpej struct hpf1275a_softc *sc = device_private(self);
2626bed93d4Suwe struct wskbddev_attach_args wska;
2636bed93d4Suwe
2646bed93d4Suwe wska.console = 0;
2656bed93d4Suwe wska.keymap = &hpf1275a_wskbd_keymapdata;
2666bed93d4Suwe wska.accessops = &hpf1275a_wskbd_accessops;
2676bed93d4Suwe wska.accesscookie = sc;
2686bed93d4Suwe
269cbab9cadSchs sc->sc_dev = self;
2706bed93d4Suwe sc->sc_enabled = 0;
27150e02865Suwe #ifdef WSDISPLAY_COMPAT_RAWKBD
27250e02865Suwe sc->sc_rawkbd = 0;
27350e02865Suwe #endif
274c7fb772bSthorpej sc->sc_wskbd = config_found(self, &wska, wskbddevprint, CFARGS_NONE);
2756bed93d4Suwe }
2766bed93d4Suwe
2776bed93d4Suwe
2786bed93d4Suwe /*
2796bed93d4Suwe * Autoconf detach routine. Called when we close the line discipline.
2806bed93d4Suwe */
2816bed93d4Suwe static int
hpf1275a_detach(device_t self,int flags)282529e91fcScegger hpf1275a_detach(device_t self, int flags)
2836bed93d4Suwe {
28492c7bba3Sthorpej struct hpf1275a_softc *sc = device_private(self);
2856bed93d4Suwe int error;
2866bed93d4Suwe
287*561e6c8bSriastradh error = config_detach_children(self, flags);
288*561e6c8bSriastradh if (error)
289*561e6c8bSriastradh return error;
2906bed93d4Suwe
291*561e6c8bSriastradh return 0;
2926bed93d4Suwe }
2936bed93d4Suwe
2946bed93d4Suwe
2956bed93d4Suwe /*
2966bed93d4Suwe * Line discipline open routine.
2976bed93d4Suwe */
2985807cbebSuwe static int
hpf1275a_open(dev_t dev,struct tty * tp)299168cd830Schristos hpf1275a_open(dev_t dev, struct tty *tp)
3006bed93d4Suwe {
30145bba4e1Sthorpej static struct cfdata hpf1275a_cfdata = {
30245bba4e1Sthorpej .cf_name = "hpf1275a",
30345bba4e1Sthorpej .cf_atname = "hpf1275a",
304f6c86815Sdrochner .cf_unit = 0,
30545bba4e1Sthorpej .cf_fstate = FSTATE_STAR,
30645bba4e1Sthorpej };
3073029ac48Sad struct lwp *l = curlwp; /* XXX */
30802e8a058Suwe struct hpf1275a_softc *sc;
309cbab9cadSchs device_t self;
3106bed93d4Suwe int error, s;
3116bed93d4Suwe
31265792a03Selad if ((error = kauth_authorize_device_tty(l->l_cred,
31365792a03Selad KAUTH_DEVICE_TTY_OPEN, tp)))
3146bed93d4Suwe return (error);
3156bed93d4Suwe
3166bed93d4Suwe s = spltty();
3176bed93d4Suwe
318bcd4abc3Suwe if (tp->t_linesw == &hpf1275a_disc) {
319bcd4abc3Suwe splx(s);
320bcd4abc3Suwe return 0;
321bcd4abc3Suwe }
322bcd4abc3Suwe
323cbab9cadSchs self = config_attach_pseudo(&hpf1275a_cfdata);
324cbab9cadSchs if (self == NULL) {
3256bed93d4Suwe splx(s);
3266bed93d4Suwe return (EIO);
3276bed93d4Suwe }
3286bed93d4Suwe
32902e8a058Suwe sc = device_private(self);
33092ee2313Schristos tp->t_sc = sc;
3316bed93d4Suwe sc->sc_tp = tp;
3326bed93d4Suwe
3336bed93d4Suwe splx(s);
3346bed93d4Suwe return (0);
3356bed93d4Suwe }
3366bed93d4Suwe
3376bed93d4Suwe
3386bed93d4Suwe /*
3396bed93d4Suwe * Line discipline close routine.
3406bed93d4Suwe */
3415807cbebSuwe static int
hpf1275a_close(struct tty * tp,int flag)342168cd830Schristos hpf1275a_close(struct tty *tp, int flag)
3436bed93d4Suwe {
344f7d6597dSuwe struct hpf1275a_softc *sc = tp->t_sc;
3456bed93d4Suwe int s;
3466bed93d4Suwe
3476bed93d4Suwe s = spltty();
348a0c46e17Sriastradh ttylock(tp);
3496bed93d4Suwe ttyflush(tp, FREAD | FWRITE);
350a0c46e17Sriastradh ttyunlock(tp); /* XXX */
3517d00e1afSthorpej ttyldisc_release(tp->t_linesw);
3527d00e1afSthorpej tp->t_linesw = ttyldisc_default();
3536bed93d4Suwe if (sc != NULL) {
3546bed93d4Suwe tp->t_sc = NULL;
3556bed93d4Suwe if (sc->sc_tp == tp)
356cbab9cadSchs config_detach(sc->sc_dev, 0);
3576bed93d4Suwe }
3586bed93d4Suwe splx(s);
3596bed93d4Suwe return (0);
3606bed93d4Suwe }
3616bed93d4Suwe
3626bed93d4Suwe
3636bed93d4Suwe /*
3646bed93d4Suwe * Feed input from the keyboard to wskbd(4).
3656bed93d4Suwe */
3665807cbebSuwe static int
hpf1275a_input(int c,struct tty * tp)3676bed93d4Suwe hpf1275a_input(int c, struct tty *tp)
3686bed93d4Suwe {
369f7d6597dSuwe struct hpf1275a_softc *sc = tp->t_sc;
3706bed93d4Suwe int code;
3716bed93d4Suwe u_int type;
3726bed93d4Suwe int xtscan;
3736bed93d4Suwe
3746bed93d4Suwe if (!sc->sc_enabled)
3756bed93d4Suwe return (0);
3766bed93d4Suwe
3776bed93d4Suwe if (c & TTY_ERRORMASK)
3786bed93d4Suwe return (0); /* TODO? */
3796bed93d4Suwe
3806bed93d4Suwe code = c & TTY_CHARMASK;
3816bed93d4Suwe if (code & 0x80) {
3826bed93d4Suwe type = WSCONS_EVENT_KEY_UP;
3836bed93d4Suwe code &= ~0x80;
3846bed93d4Suwe } else
3856bed93d4Suwe type = WSCONS_EVENT_KEY_DOWN;
3866bed93d4Suwe
3876bed93d4Suwe xtscan = hpf1275a_to_xtscan[code];
3886bed93d4Suwe if (xtscan == 0) {
389cbab9cadSchs aprint_error_dev(sc->sc_dev, "unknown code 0x%x\n", code);
3906bed93d4Suwe return (0);
3916bed93d4Suwe }
3926bed93d4Suwe
3936bed93d4Suwe KASSERT(sc->sc_wskbd != NULL);
39450e02865Suwe
39550e02865Suwe #ifdef WSDISPLAY_COMPAT_RAWKBD
39650e02865Suwe if (sc->sc_rawkbd) {
39750e02865Suwe u_char data[16];
39850e02865Suwe int n;
39950e02865Suwe
40050e02865Suwe n = pckbd_encode(type, xtscan, data);
40150e02865Suwe wskbd_rawinput(sc->sc_wskbd, data, n);
40250e02865Suwe } else
40350e02865Suwe #endif
4046bed93d4Suwe wskbd_input(sc->sc_wskbd, type, xtscan);
4056bed93d4Suwe
4066bed93d4Suwe return (0);
4076bed93d4Suwe }
4086bed93d4Suwe
4096bed93d4Suwe
4106bed93d4Suwe static int
hpf1275a_wskbd_enable(void * self,int on)4116bed93d4Suwe hpf1275a_wskbd_enable(void *self, int on)
4126bed93d4Suwe {
41392c7bba3Sthorpej struct hpf1275a_softc *sc = self;
4146bed93d4Suwe
4156bed93d4Suwe sc->sc_enabled = on;
4166bed93d4Suwe return (0);
4176bed93d4Suwe }
4186bed93d4Suwe
4196bed93d4Suwe
4206bed93d4Suwe /* ARGSUSED */
4216bed93d4Suwe static void
hpf1275a_wskbd_set_leds(void * self,int leds)422168cd830Schristos hpf1275a_wskbd_set_leds(void *self, int leds)
4236bed93d4Suwe {
4246bed93d4Suwe
4256bed93d4Suwe /* this keyboard has no leds; nothing to do */
4266bed93d4Suwe return;
4276bed93d4Suwe }
4286bed93d4Suwe
4296bed93d4Suwe
4306bed93d4Suwe static int
hpf1275a_wskbd_ioctl(void * self,u_long cmd,void * data,int flag,struct lwp * l)43153524e44Schristos hpf1275a_wskbd_ioctl(void *self, u_long cmd, void *data, int flag,
432168cd830Schristos struct lwp *l)
4336bed93d4Suwe {
43450e02865Suwe #ifdef WSDISPLAY_COMPAT_RAWKBD
43592c7bba3Sthorpej struct hpf1275a_softc *sc = self;
43650e02865Suwe #endif
4376bed93d4Suwe
4386bed93d4Suwe switch (cmd) {
4396bed93d4Suwe case WSKBDIO_GTYPE:
4406bed93d4Suwe *(int *)data = WSKBD_TYPE_HPC_KBD; /* may be use new type? */
4416bed93d4Suwe return (0);
4426bed93d4Suwe
4436bed93d4Suwe case WSKBDIO_GETLEDS:
4446bed93d4Suwe *(int *)data = 0; /* this keyboard has no leds */
4456bed93d4Suwe return (0);
4466bed93d4Suwe
44750e02865Suwe #ifdef WSDISPLAY_COMPAT_RAWKBD
44850e02865Suwe case WSKBDIO_SETMODE:
44950e02865Suwe sc->sc_rawkbd = (*(int *)data == WSKBD_RAW);
45050e02865Suwe return (0);
45150e02865Suwe #endif
45250e02865Suwe
4536bed93d4Suwe default:
4546bed93d4Suwe return (EPASSTHROUGH);
4556bed93d4Suwe }
4566bed93d4Suwe }
457