Return-path: Received: from smtp-out002.kontent.com ([81.88.40.216]:37631 "EHLO smtp-out002.kontent.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751294Ab2ABIdj convert rfc822-to-8bit (ORCPT ); Mon, 2 Jan 2012 03:33:39 -0500 From: Oliver Neukum To: Michael =?iso-8859-1?q?B=FCsch?= Subject: Re: loading firmware while usermodehelper disabled. Date: Mon, 2 Jan 2012 08:56:25 +0100 Cc: Linus Torvalds , Alan Stern , Matthew Garrett , Dave Jones , Linux Kernel , Larry Finger , Chaoming Li , "John W. Linville" , "Greg Kroah-Hartman" , USB list , Linux Wireless List References: <201201011322.34483.oliver@neukum.org> <201201012227.56568.oliver@neukum.org> <20120101223913.3ff57d0f@milhouse> In-Reply-To: <20120101223913.3ff57d0f@milhouse> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Message-Id: <201201020856.26235.oliver@neukum.org> (sfid-20120102_093414_753753_28269424) Sender: linux-wireless-owner@vger.kernel.org List-ID: Am Sonntag, 1. Januar 2012, 22:39:13 schrieb Michael B?sch: > These change-id-on-bootstrap devices usually work like this, > as far as I know: > > probe bootstrap device (switches hw to real device) And you will find no driver if the firmware is uploaded in user space. udev runs a firmware loader that uses libusb. usb_modeswitch presents you with the same problem. > probe real device (firmware is loaded) The real driver will often be generic and have no idea the device needs firmware to turn it into a functional generic device. And we really don't want to contaminate the generic drivers with that information. So we'd need a) kernel infrastructure to track "shadow" drivers for firmware upload b) a heuristic to decide when a device underwent a virtual replug > Suspend machine > Resume machine > usb detects that the device is "gone" > probe/resume bootstrap device (switches hw to real device) We need a way to verify this is really the device which we need firmware for. > probe/resume real device (No need to fetch fw from userspace. It's already cached) Now we need to wait for the firmware upload to take effect. How long? And we need to hold off telling the driver that its device was disconnected. > What did I get wrong? In addition you now need logic to tell the "shadow" drivers that a device is gone so that they can free the firmware. Oh and of course you will need to refcount firmware (but we probably need to do that anyway) Regards Oliver