Re: [PATCH v2 0/5] usb: Add usb interface authorization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Dienstag, den 16.06.2015, 15:26 -0400 schrieb Alan Stern:
> 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);
> 
OK. I will try it...
> > > > 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.
With my test case that works only with bus_probe_device() becaus it
checks the autoprobe status and calls then device_attach().

I have compiled the source once with bus_probe_device() and once with
device_attach() only.

To conclude: bus_probe_device() was required to ensure that if
autoprobing was off that no driver was probed without writing it to
drivers_probe...

> 
> Alan Stern
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux