On Tue, 16 Jun 2015, Stefan Koch wrote:
> > And call the attribute "authorize", not "interface_authorize". It will
> > be obvious that the attribute applies to the interface, because the
> > attribute file will be inside the interface's sysfs directory.
> How do you solve the problem that the devices authorization show and
> store functions are in the same file?
> If the others get the same name this wouldn't work.
> One option could be to make the functions used by both attributes
> (device and interface) and check the device type.
> Or is it possible to set a different name in SysFS with indivudual
> function name?
> Do you now a simplier method?
Don't use the DEVICE_ATTR_RW macro; put the actual declaration there
instead. For example, instead of doing
static DEVICE_ATTR_RW(authorized);
do
static struct device_attribute dev_attr_intf_authorized =
__ATTR(authorized, S_IWUSR | S_IRUGO,
intf_authorized_show, intf_authorized_store);
> > > bus_probe_device() checks the autoprobe status... Otherwise a getter for
> > > the autoprobe status must implemented...
> >
> > Actually, this isn't necessary at all. After updating all the
> > "authorize" attributes, the user can simply write the interface names
> > to /sys/bus/usb/drivers_probe. This has the advantages of using a mask
> > without the disadvantages.
>
> I have tested it. If the autoprobing is disbaled and device_attach()
> will used the interface driver binds, too. If bus_probe_device() is used
> the driver doesn't binds.
>
> The manaual probing is possible in both cases, that is correct.
> But only bus_probe_device() could avoid driver probing after
> authorization.
> So I think the move from the one header file to the other makes sense.
If autoprobing is disabled, all the user has to do is avoid writing to
/sys/bus/usb/drivers_probe.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html