On Tue, 24 Aug 2004, XOL wrote:
> This is my case:
> I have my own usb device let's say "ddd"
> Device has 1(one) Configuration, 1(one) Interface (IF) and 3 alternate IF
> I work with device only from user space using usb_devfs IOCTL's
>
> I do the following:
> 1. Run ddd_init executable
> open( "/proc/bus/usb/.... )
> ioctl(USBDEVFS_SETCONFIGURATION ... )
> ioctl(USBDEVFS_CLAIMINTERFACE ... )
> ioctl(USBDEVFS_SETINTERFACE ...) /* Select IF=1 alt_IF=2 */
> ioctl(USBDEVFS_RELEASEINTERFACE ... )
> close
>
> 2. I run applications "ddd_doit1, ddd_doit2, ddd_doit3, ..... )
> open( "/proc/bus/usb/.... )
> while( doing it ) {
> ioctl(USBDEVFS_CLAIMINTERFACE ... )
> ioctl(USBDEVFS_BULK ... ) /* device works with BULK on IF=1 alt_IF=2 in_EP=0x84
> out_EP=0x02 */
> ioctl(USBDEVFS_RELEASEINTERFACE ... )
> }
> close
>
> This processes can run simultaneously and use CLAIMEINTERFACE as mutex
>
> All this works fine on 2.4.xxx
>
> But Now I run it on 2.6.4-52-smp and got error in ioctl(USBDEVFS_BULK
> ... ) I made some digging in the kernel code and found out the problem
> is that after RELEASEINTERFACE all IF endpoints are disabled by reducing
> maxmessage to zero.
That's not the full story. What happens is that whenever you release an
interface the kernel automatically changes it back to altsetting 0.
> It seams like I have to call
> ioctl(USBDEVFS_SETINTERFACE ...) any time after I claime IF.
That's right. Unless you want to use altsetting 0, of course.
> My question is if I'm doing something wrong? I do not want to call
> ioctl(USBDEVFS_SETINTERFACE ...) all the time because as far as I
> understand USBDEVFS_SETINTERFACE cause to control transaction which has
> no reason as well as I made it once and selected the right IF and alt_IF
> in ddd_init.
There _is_ a reason for it. Once you release the interface, any other
program can claim it. So even if the kernel didn't change the altsetting,
it still might not be what you want. This way, every program that claims
an interface knows that it will start with the default altsetting = 0.
If you want to use an altsetting other than 0, you must always do
SETINTERFACE after claiming the interface.
Alan Stern
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel