From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 29 22:59:01 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1984616A404 for ; Thu, 29 Mar 2007 22:59:01 +0000 (UTC) (envelope-from tbourke@triptrop.cse.unsw.edu.au) Received: from note.orchestra.cse.unsw.EDU.AU (note.orchestra.cse.unsw.EDU.AU [129.94.242.24]) by mx1.freebsd.org (Postfix) with ESMTP id 80D3313C45B for ; Thu, 29 Mar 2007 22:59:00 +0000 (UTC) (envelope-from tbourke@triptrop.cse.unsw.edu.au) Received: From triptrop.cse.unsw.edu.au ([129.94.175.153]) (for ) By note With Smtp ; Fri, 30 Mar 2007 08:43:45 +1000 Received: from triptrop.cse.unsw.edu.au (localhost [127.0.0.1]) by triptrop.cse.unsw.edu.au (8.13.8/8.13.6) with ESMTP id l2TMg7wj003346 for ; Fri, 30 Mar 2007 08:42:07 +1000 (EST) (envelope-from tbourke@triptrop.cse.unsw.edu.au) Received: (from tbourke@localhost) by triptrop.cse.unsw.edu.au (8.13.8/8.13.6/Submit) id l2TMg60A003345 for hackers@freebsd.org; Fri, 30 Mar 2007 08:42:06 +1000 (EST) (envelope-from tbourke) From: Timothy Bourke To: hackers@freebsd.org Date: Fri, 30 Mar 2007 08:42:06 +1000 Message-ID: <20070329224205.GA819@triptrop.cse.unsw.EDU.AU> Mail-Followup-To: hackers@freebsd.org References: <20070325015717.GA797@triptrop> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-PGP-Key: http://www.cse.unsw.edu.au/~tbourke/pubkey.txt Cc: Subject: Re: enable/disable in kbd drivers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2007 22:59:01 -0000 --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 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--