cvs commit: src/sys/dev/kbd kbd.c

Dag-ErlingSmørgrav des at des.no
Tue Jan 27 07:53:31 PST 2004


Dag-Erling Smorgrav <des at FreeBSD.org> writes:
> des         2004/01/27 07:40:30 PST
>
>   FreeBSD src repository
>
>   Modified files:
>     sys/dev/kbd          kbd.c 
>   Log:
>   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.
>   
>   Revision  Changes    Path
>   1.37      +2 -1      src/sys/dev/kbd/kbd.c

I use the following in /etc/devd.conf on my laptop to make it DTRT
regardless of whether it's in the docking station (USB keyboard and
mouse), on my lap (PS/2 keyboard and trackpoint), or on my desk at
home (PS/2 keyboard, USB mouse).

attach 0 {
        device-name     "ums[0-9]+";
        action          "/root/bin/usbmouse start $device-name";
};

detach 0 {
        device-name     "ums[0-9]+";
        action          "/root/bin/usbmouse stop $device-name";
};

attach 0 {
        device-name     "ukbd[0-9]+";
        action          "/root/bin/usbkeyboard start $device-name";
};

detach 0 {
        device-name     "ukbd[0-9]+";
        action          "/root/bin/usbkeyboard stop $device-name";
};

The scripts are attached.  Note that usbkeyboard will be confused if
more than one USB keyboard are attached at any one time; my next
project is to make it possible to have multiple keyboards active at
the same time, just like we can have multiple mice active at the same
time.

DES
-- 
Dag-Erling Smørgrav - des at des.no

-------------- next part --------------
A non-text attachment was scrubbed...
Name: usbkeyboard
Type: application/octet-stream
Size: 415 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20040127/e2634c0c/usbkeyboard-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: usbmouse
Type: application/octet-stream
Size: 491 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20040127/e2634c0c/usbmouse-0001.obj


More information about the cvs-src mailing list