From owner-freebsd-usb@FreeBSD.ORG Wed Dec 10 11:17:56 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AED81065670 for ; Wed, 10 Dec 2008 11:17:56 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out1.uni-muenster.de (ZIVM-OUT1.UNI-MUENSTER.DE [128.176.192.8]) by mx1.freebsd.org (Postfix) with ESMTP id A39888FC1C for ; Wed, 10 Dec 2008 11:17:55 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.33,746,1220220000"; d="scan'208";a="264832062" Received: from zivmaildisp1.uni-muenster.de (HELO ZIVMAILUSER02.UNI-MUENSTER.DE) ([128.176.188.85]) by zivm-relay1.uni-muenster.de with ESMTP; 10 Dec 2008 11:48:32 +0100 Received: by ZIVMAILUSER02.UNI-MUENSTER.DE (Postfix, from userid 149459) id 142D91B0866; Wed, 10 Dec 2008 11:48:32 +0100 (CET) Date: Wed, 10 Dec 2008 11:48:31 +0100 (CET) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: hardcoded usb1 modules in certain binaries X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 11:17:56 -0000 hi there, i talked to Petter a while ago, because binaries like moused have certain usb1 modules hardcoded into them. moused e.g. relies on ums.ko. if it is unable to detect the module it will load it, thus also loading usb.ko (even if we're running the usb2 stack). this line in moused is responsible for loading ums.ko and usb.ko: return (kld_isloaded("uhub/ums") || kld_load("ums") != -1); changing the line to return (kld_isloaded("ushub/ums") || kld_load("usb2_input_ms") != -1 || kld_isloaded("uhub/ums") || kld_load("ums") != -1); fixes the issue where ums.ko and usb.ko get loaded although usb2 with input_ms is present, but isn't more that a quick hack. how about this: let's introduce a new sysctl variable. if the kernel gets compiled with usb1 support we set the variable to 0. it it is compiled with the usb2 stack we set the variable to 1. that way we could check to see which stack the user is running. if he's running the usb1 stack we check for "uhub/ums" and in case we're running the usb2 stack we rely on "ushub/ums". if the kernel doesn't include any of the usb stacks we set to variable to 0 so the usb1 stack gets loaded as kernel module. if at some point we want usb2 to become the standard usb stack we can change the default settings from 0 to 1 so that usb2.ko get's loaded if no usb stack got compiled into the kernel. what are your thoughts on this one? another way of taking care of the problem would be to adjust kld_isloaded so that it includes aliases for all the usb2 modules. calling kld_isloaded with "uhub/ums" would first check for "ushub/ums" and then for "uhub/ums". this solution wouldn't require any changes to the actual binaries that have usb1 modules hardcoded into them. imo this is the best solution. a third way would be to get rid of all the kld_isloaded calls and instead check to see if /dev/ums0 exists, but that's far from being a clean solution. cheers.