enable/disable in kbd drivers
Timothy Bourke
timbob at bigpond.com
Thu Mar 29 22:59:01 UTC 2007
Thanks for responding, Max.
On Mar 29 at 09:08 -0800, Maksim Yevmenkin wrote:
> On 3/24/07, Timothy Bourke <timbob at bigpond.com> wrote in part:
> >However, enable is called too many times and disable is never called.
> >
> >In the kbdmux_ioctl routine:
> > KBADDKBD: enable is called via the KBDMUX_ENABLE macro.
> > KBRELKBD: does NOT call disable
> >
> >Taking dev/usb/ukbd.c as an example, the effect can be seen by adding
> >this line to the ukbd_enable function (after the call to KBD_ACTIVATE):
> > printf("ukbd_enable: %d\n", KBD_IS_ACTIVE(kbd));
> >And similarly for ukbd_disable and then running dmesg or kbdcontrol.
> >
> >Additionally, each kbd driver calls its own enable function when
> >attached. For example, in USB_ATTACH(ukbd):
> > (*sw->enable)(kbd);
> >This would appear to be unnecessary for keyboards connected via kbdmux.
> >I am less certain about those connected directly, but the syscons
> >sccngetch routine does seems to call enable and disable. Perhaps it
> >should also call enable when it first starts?
> >
> >Does the attached patch seem reasonable? It would fix my immediate
> >problem.
>
> sorry for the delay. i'm not sure about this patch. basically, i do
> not think that keyboard should be disabled if it is released from
> kbdmux. it is perfectly fine, imo, to have two (or more) active
> keyboards attached to the system as long as only one of them is
> primary. it is possible to use /dev/kbdX interface to talk to
> non-primary keyboard(s) directly.
It seems that, for the extant drivers:
* enable only increments kb_active,
* disable only decrements kb_active.
With the printf suggested above, one can see that repeating the
commands:
kbdcontrol -A usb0 < /dev/console
kbdcontrol -a usb0 < /dev/console
continually increases kb_active.
Even with the patch, detaching any of the current kbd drivers will not
deactivate them (reduce kb_active to zero) because they all call
enable (increment kb_active) when initialized. Which answers one of
the other questions.
Alternative (not serious) suggestion: since the disable hook seems
never to be called, it might as well be removed from the
keyboard_switch...
Tim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20070329/311e5db5/attachment.pgp
More information about the freebsd-hackers
mailing list