Date: Fri, 30 Mar 2007 08:42:06 +1000 From: Timothy Bourke <timbob@bigpond.com> To: hackers@freebsd.org Subject: Re: enable/disable in kbd drivers Message-ID: <20070329224205.GA819@triptrop.cse.unsw.EDU.AU> In-Reply-To: <bb4a86c70703291008n4a82e627l3f45b1ff8e5ac571@mail.gmail.com> References: <20070325015717.GA797@triptrop> <bb4a86c70703291008n4a82e627l3f45b1ff8e5ac571@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thanks for responding, Max. On Mar 29 at 09:08 -0800, Maksim Yevmenkin wrote: > On 3/24/07, Timothy Bourke <timbob@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. >=20 > 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,=20 * 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. --h31gzZEtNLTqOjlF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (FreeBSD) iD8DBQFGDEC9tKVK1sFb0ecRAk6HAJ9NvvzHrBRVJNx3Lqo8nSUd6PmyzACfTC4p nB6QMxJ8C0UKcBwbwFSQlU4= =Haie -----END PGP SIGNATURE----- --h31gzZEtNLTqOjlF--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070329224205.GA819>