RE: [PATCH 3/9] usb/gadget: change sysfs parent device for USB Ethernet

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

 



On Wed, 17 Apr 2013, Andrzej Pietrasiewicz wrote:

> The procedure of setting a gadget up with configfs is like this:
> 
> 1) create the gadget directory
> 2) create functions directories corresponding to functions to be used
> by the gadget
> 3) create configurations directories
> 
> Anytime before 4) below echo some parameters to configfs attributes
> Why before 4)? Because it would be good if configfs' state reflected
> the state of the system. A function can be associated with
> more than one configuration, but once a function is associated with
> a configuration (symlink), I think it would be desirable for the function's
> attributes to remain unmodifiable (writing to them results in EBUSY).
> Otherwise, a function which is in a given state can be associated
> with one configuration, then the function's state can be changed
> and the function can be associated with another configuration.
> 
> 4) create symbolic links in configurations' directories, pointing to
> appropriate functions' directories
> 5) In the gadget directory echo <udc_name> > UDC
> 
> Now, what you suggest is that a net device is registered only at step 5)
> above.

Right.

>  But changing a device address is possible only _after_ the device
> is registered. Which is in contradiction with the assumptions above.

How is it in contradiction?

> And in practice you would have a directory structure like this:
> 
> .
> .
> .
> ./functions
> ./functions/ncm.usb0
> ./functions/ncm.usb0/ifname
> ./functions/ncm.usb0/qmult
> ./functions/ncm.usb0/host_addr
> ./functions/ncm.usb0/dev_addr
> .
> .
> .
> 
> Where ifname, qmult and host_addr can be written to before the gadget
> is bound, but writing to dev_addr in such a situation would result in
> ENODEV.

True.  But why would you want to write to either host_addr or dev_addr 
before the gadget is bound?  Network addresses in general are not set 
up until the corresponding network interface exists.  (When static 
addressing is used, you know in advance what the address will be.  But 
the address doesn't actually get assigned to the interface until the 
interface exists.  You can't specify the name of an interface that 
doesn't exist yet when you run ifconfig!)

Suppose the host ran a DHCP server, and that server was used to set up 
the addresses.  Then how could you possibly know what values to use for 
host_addr and dev_addr before the gadget was bound?

For that matter, why should f_ncm care about the network addresses in 
the first place?  That should all be handled by a different layer.  
Suppose after the gadget was bound and the network link was set up, I 
use ifconfig to change the addresses.  Would f_ncm care about that?

> If, on the other hand, the net device is registered at the moment
> of ./functions/ncm.usb0 creation, access to all attributes is
> consistent. But for this to happen, a parent must be known, and - 
> as it is now - it is not known until the gadget is bound. Hence the
> patch we are discussing.

Okay, now I understand your reasoning.  I just don't agree with it.  :-)

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