From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 30 19:02:10 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 23A5E16A406 for ; Fri, 30 Mar 2007 19:02:10 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.251]) by mx1.freebsd.org (Postfix) with ESMTP id C7D4913C480 for ; Fri, 30 Mar 2007 19:02:09 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by an-out-0708.google.com with SMTP id c24so588980ana for ; Fri, 30 Mar 2007 12:02:09 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZSEGSj2Qw4IS+KQrrWgzUbTiXMRLJmGQ9lHdlw3IXHZtUO9Uyfn2qrQdI7q/FPZ3mTXqbe+xReaSDQ0omTP4q330LNxq9H64A4T615l2S5tnfFgQaX5ARCG2ViaDsTf9VsUylEmoh87AX454A9YiLKCEA+RAPTQqaqzCQYhKWgk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=trZZ/LlrXY+UiRretmtdHO+IjvnIigGCh89VOsISv+TQgduaAsK2pCbMvaYCl0M7dkEmzpXsd3ZQS0gS9Nt13B4Y/QK4MYhilytd8sWk9yzv8cstvzT6KHkUDH0ZcSLoSOjYtwwv+sPZmgBmqjOOy5nftelnu0mPlJRhuhrNiqk= Received: by 10.100.44.13 with SMTP id r13mr1644924anr.1175281328760; Fri, 30 Mar 2007 12:02:08 -0700 (PDT) Received: by 10.100.177.10 with HTTP; Fri, 30 Mar 2007 12:02:08 -0700 (PDT) Message-ID: Date: Fri, 30 Mar 2007 12:02:08 -0700 From: "Maksim Yevmenkin" To: "Timothy Bourke" , hackers@freebsd.org In-Reply-To: <20070329224205.GA819@triptrop.cse.unsw.EDU.AU> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070325015717.GA797@triptrop> <20070329224205.GA819@triptrop.cse.unsw.EDU.AU> 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: Fri, 30 Mar 2007 19:02:10 -0000 On 3/29/07, Timothy Bourke wrote: [...] > > >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. well, yes, if all kbdmux did was call KBD_ACTIVATE/_DEACTIVATE directly, i would not have any problem with it. however, kbdmux calls enable() method and other drivers (such as the one you wrote) may do other things in enable/disable() methods. perhaps the right thing to do to is to have kbdmux check is keyboard is "enabled" and if not - call enable()? thanks, max > 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. > > >