Re: loading firmware while usermodehelper disabled.

From: Oliver Neukum
Date: Mon Jan 02 2012 - 03:34:09 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/