kbd: provide default implementations of get_fkeystr/diag
Most keyboard drivers are using the genkbd implementations as it is; formally use them for any that aren't set and make genkbd_get_fkeystr/genkbd_diag private.
This commit is contained in:
parent
1c5c067aad
commit
eefc662f0b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355796
@ -214,9 +214,7 @@ keyboard_switch_t akbdsw = {
|
||||
.clear_state = akbd_clear_state,
|
||||
.get_state = akbd_get_state,
|
||||
.set_state = akbd_set_state,
|
||||
.get_fkeystr = genkbd_get_fkeystr,
|
||||
.poll = akbd_poll,
|
||||
.diag = genkbd_diag,
|
||||
};
|
||||
|
||||
KEYBOARD_DRIVER(akbd, akbdsw, akbd_configure);
|
||||
|
@ -247,9 +247,7 @@ static keyboard_switch_t atkbdsw = {
|
||||
.clear_state = atkbd_clear_state,
|
||||
.get_state = atkbd_get_state,
|
||||
.set_state = atkbd_set_state,
|
||||
.get_fkeystr = genkbd_get_fkeystr,
|
||||
.poll = atkbd_poll,
|
||||
.diag = genkbd_diag,
|
||||
};
|
||||
|
||||
KEYBOARD_DRIVER(atkbd, atkbdsw, atkbd_configure);
|
||||
|
@ -975,9 +975,7 @@ static keyboard_switch_t gpiokeyssw = {
|
||||
.clear_state = &gpiokeys_clear_state,
|
||||
.get_state = &gpiokeys_get_state,
|
||||
.set_state = &gpiokeys_set_state,
|
||||
.get_fkeystr = &genkbd_get_fkeystr,
|
||||
.poll = &gpiokeys_poll,
|
||||
.diag = &genkbd_diag,
|
||||
};
|
||||
|
||||
KEYBOARD_DRIVER(gpiokeys, gpiokeyssw, gpiokeys_configure);
|
||||
|
@ -462,9 +462,7 @@ static keyboard_switch_t hvkbdsw = {
|
||||
.clear_state = hvkbd_clear_state,
|
||||
.get_state = hvkbd_get_state, /* not used */
|
||||
.set_state = hvkbd_set_state, /* not used */
|
||||
.get_fkeystr = genkbd_get_fkeystr,
|
||||
.poll = hvkbd_poll,
|
||||
.diag = genkbd_diag,
|
||||
};
|
||||
|
||||
KEYBOARD_DRIVER(hvkbd, hvkbdsw, hvkbd_configure);
|
||||
|
@ -64,6 +64,9 @@ typedef struct genkbd_softc {
|
||||
unsigned int gkb_q_length;
|
||||
} genkbd_softc_t;
|
||||
|
||||
static u_char *genkbd_get_fkeystr(keyboard_t *kbd, int fkey, size_t *len);
|
||||
static void genkbd_diag(keyboard_t *kbd, int level);
|
||||
|
||||
static SLIST_HEAD(, keyboard_driver) keyboard_drivers =
|
||||
SLIST_HEAD_INITIALIZER(keyboard_drivers);
|
||||
|
||||
@ -176,6 +179,10 @@ kbd_add_driver(keyboard_driver_t *driver)
|
||||
{
|
||||
if (SLIST_NEXT(driver, link))
|
||||
return (EINVAL);
|
||||
if (driver->kbdsw->get_fkeystr == NULL)
|
||||
driver->kbdsw->get_fkeystr = genkbd_get_fkeystr;
|
||||
if (driver->kbdsw->diag == NULL)
|
||||
driver->kbdsw->diag = genkbd_diag;
|
||||
SLIST_INSERT_HEAD(&keyboard_drivers, driver, link);
|
||||
return (0);
|
||||
}
|
||||
@ -1121,7 +1128,7 @@ fkey_change_ok(fkeytab_t *oldkey, fkeyarg_t *newkey, struct thread *td)
|
||||
#endif
|
||||
|
||||
/* get a pointer to the string associated with the given function key */
|
||||
u_char *
|
||||
static u_char *
|
||||
genkbd_get_fkeystr(keyboard_t *kbd, int fkey, size_t *len)
|
||||
{
|
||||
if (kbd == NULL)
|
||||
@ -1154,7 +1161,7 @@ get_kbd_type_name(int type)
|
||||
return ("unknown");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
genkbd_diag(keyboard_t *kbd, int level)
|
||||
{
|
||||
if (level > 0) {
|
||||
|
@ -392,9 +392,6 @@ int kbd_detach(keyboard_t *kbd);
|
||||
#define LED_MASK (LED_CAP | LED_NUM | LED_SCR)
|
||||
*/
|
||||
|
||||
kbd_get_fkeystr_t genkbd_get_fkeystr;
|
||||
kbd_diag_t genkbd_diag;
|
||||
|
||||
int genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg);
|
||||
int genkbd_keyaction(keyboard_t *kbd, int keycode, int up,
|
||||
int *shiftstate, int *accents);
|
||||
|
@ -378,9 +378,7 @@ static keyboard_switch_t kbdmuxsw = {
|
||||
.clear_state = kbdmux_clear_state,
|
||||
.get_state = kbdmux_get_state,
|
||||
.set_state = kbdmux_set_state,
|
||||
.get_fkeystr = genkbd_get_fkeystr,
|
||||
.poll = kbdmux_poll,
|
||||
.diag = genkbd_diag,
|
||||
};
|
||||
|
||||
#ifdef EVDEV_SUPPORT
|
||||
|
@ -134,7 +134,6 @@ static keyboard_switch_t sunkbdsw = {
|
||||
.clear_state = sunkbd_clear_state,
|
||||
.get_state = sunkbd_get_state,
|
||||
.set_state = sunkbd_set_state,
|
||||
.get_fkeystr = genkbd_get_fkeystr,
|
||||
.poll = sunkbd_poll_mode,
|
||||
.diag = sunkbd_diag
|
||||
};
|
||||
|
@ -2282,9 +2282,7 @@ static keyboard_switch_t ukbdsw = {
|
||||
.clear_state = &ukbd_clear_state,
|
||||
.get_state = &ukbd_get_state,
|
||||
.set_state = &ukbd_set_state,
|
||||
.get_fkeystr = &genkbd_get_fkeystr,
|
||||
.poll = &ukbd_poll,
|
||||
.diag = &genkbd_diag,
|
||||
};
|
||||
|
||||
KEYBOARD_DRIVER(ukbd, ukbdsw, ukbd_configure);
|
||||
|
@ -579,9 +579,7 @@ static keyboard_switch_t vkbdsw = {
|
||||
.clear_state = vkbd_clear_state,
|
||||
.get_state = vkbd_get_state,
|
||||
.set_state = vkbd_set_state,
|
||||
.get_fkeystr = genkbd_get_fkeystr,
|
||||
.poll = vkbd_poll,
|
||||
.diag = genkbd_diag,
|
||||
};
|
||||
|
||||
static int typematic(int delay, int rate);
|
||||
|
Loading…
Reference in New Issue
Block a user