Dear All,

I may have found a problem with 'deferred configuration' mode in 
gadgetfs.  Or, more likely, I have misunderstood something or found an 
error that you already know about...

Normally, activate_ep_files() creates inodes for the per-endpoint files 
with f_op set to ep_config_operations.  The endpoint descriptors are 
then written to these files and are processed by ep_config().  This 
will call usb_ep_enable() and if all is OK it will change f_op to 
ep_io_operations, so endpoint reads and writes call ep_read() and 
ep_write respectively, transfering real data.

However, endpoint descriptors can be written before the device is 
connected, in which case the speed of the connection is not known; to 
cope with this the code in ep_config() can postpone actual 
configuration.  It does this by setting the endpoint state to 
STATE_EP_DEFER_ENABLE.  Subsequently, endpoints in this state are 
checked for in gadgetfs_setup(), which is called in response to a 
CONNECT message, and usb_ep_enable() is called from there.  However, in 
this case, f_op is not changed over to ep_io_operations, and endpoint 
reads and writes do not go to ep_read() and ep_write().

I can see two possibilities for how this should work:

1. f_op could be changed over in ep_config() even in the deferred 
case.  This would happen if value equalled 0 in the deferred case; 
currently as far as I can see it equals len.  I am experimenting with 
this change, and my test program seems to get a bit further than it 
used to.

2. f_op could be changed over in gadgetfs_setup(), immediately after 
the call to usb_ep_enable() there.

I am unsure about what should happen to the endpoint configurations 
during DISCONNECT/CONNECT, especially if the speed changes.  I worry 
about this particularly as I always see CONNECT/DISCONNECT/CONNECT when 
my test program starts - is this normal???

Any thoughts anyone?

Cheers,

Phil.


(You are welcome to CC me in any replies)





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to