Re: New multi-use device

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Fri, 26 Oct 2007, Pete Zaitcev wrote:

> >     2) I wanted to be able to switch configurations via an IOCTL call so
> > I started to add the
> >        code for this into the device_ioctl routine and after browsing
> > the code for 
> >        "usb_set_configuration()" found out by reading the comments in
> > the code that this is 
> >        not really the best way to do it, but then what is the best way
> > to do this? []
> 
> I suspect Alan is the only one who knows the intent behind the
> current code.

Surely things aren't _that_ bad!  :-)

The basic idea behind the kernel's implementation is that configuration
changes are initiated by userspace.  If a program uses usbfs or libusb,
it can make a simple function call to change the device's config.  
Even a stupid shell script can change a config by writing to
/sys/bus/usb/devices/.../bConfigurationValue.

If a kernel driver wants to set a particular config then it should call 
usb_driver_set_configuration() from within its probe method and then 
return an error code such as -EIO.  This function lies in 
drivers/usb/core/messages.c and the kerneldoc explains how the function 
works.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.