While USB keyboards attach as ukbd[0-9]+, the device node created by

kbd_attach() is called kbd[0-9]+, with a different unit number.  This
makes it impossible to write a devd rule which will automatically
switch to a USB keyboard when one is attached, because there is no way
to guess the correct device node to pass to kbdcontrol.

Therefore, change kbd_attach() to create a device node using the
keyboard device's real name (atkbd0, ukbd0...), and create the
kbd[0-9]+ node as an alias for backward compatibility.
This commit is contained in:
des 2004-01-27 15:40:30 +00:00
parent bcac357188
commit 58a1b901a4

View File

@ -454,7 +454,8 @@ kbd_attach(keyboard_t *kbd)
return EINVAL;
kbd->kb_dev = make_dev(&kbd_cdevsw, kbd->kb_index, UID_ROOT, GID_WHEEL, 0600,
"kbd%r", kbd->kb_index);
"%s%r", kbd->kb_name, kbd->kb_unit);
make_dev_alias(kbd->kb_dev, "kbd%r", kbd->kb_index);
kbd->kb_dev->si_drv1 = malloc(sizeof(genkbd_softc_t), M_DEVBUF,
M_WAITOK | M_ZERO);
printf("kbd%d at %s%d\n", kbd->kb_index, kbd->kb_name, kbd->kb_unit);