Re: enable/disable in kbd drivers
- From: Timothy Bourke <timbob@xxxxxxxxxxx>
- Date: Fri, 30 Mar 2007 08:42:06 +1000
Thanks for responding, Max.
On Mar 29 at 09:08 -0800, Maksim Yevmenkin wrote:
On 3/24/07, Timothy Bourke <timbob@xxxxxxxxxxx> 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.
Attachment:
pgpUIpK4nCfpU.pgp
Description: PGP signature
- Follow-Ups:
- Re: enable/disable in kbd drivers
- From: Maksim Yevmenkin
- Re: enable/disable in kbd drivers
- References:
- enable/disable in kbd drivers
- From: Timothy Bourke
- Re: enable/disable in kbd drivers
- From: Maksim Yevmenkin
- enable/disable in kbd drivers
- Prev by Date: RE: NVIDIA FreeBSD kernel feature requests
- Next by Date: Re: Locking etc. (Long, boring, redundant, newbie questions)
- Previous by thread: Re: enable/disable in kbd drivers
- Next by thread: Re: enable/disable in kbd drivers
- Index(es):
Relevant Pages
|
|