[sane-devel] sanei_usb_open() and multifuntion devices

Gerard Klaver gerard at gkall.hobby.nl
Wed Sep 13 19:31:56 UTC 2006


On Wed, 2006-09-13 at 13:29 +0200, Wittawat Yamwong wrote:
> Hello,
> 
> I think that how sanei_usb_open() collects endponts is not correct. It loops 
> through all configurations, interfaces and alternate settings and takes the 
> first bulk in, bulk out and interrupt endpoint it found. This works only for 
> some special cases and it is likely to fail for multifunction devices, e.g. 
> Smartbase MP360 which has endpoints for the scanner function in the interface 
> #1. 
> 
> I would propose that sanei_usb_open() accepts two additional parameters 
> specifying an interface number and an alternate setting. These parameters can 
> be omitted (e.g. set to -1). In this case the behaviour described above is 
> valid. If the parameters are given, sanei_usb_open() must use only the 
> endpoints belonging to the specified interface.
> 
> There is also an issue with sanei_usb_set_configuration(), it simply doesn't 
> work this way because setting new configuration will succeed if and only if 
> there is no interfaces claimed by any driver. But the function takes the 
> device number returned by sanei_usb_open() as a parameter and, unfortunely, 
> sanei_usb_open() implicitly claims one interface. We have chicken and egg 
> problem here. Solution: sanei_usb_set_configuration() have to take the device 
> name instead of the device number as the first parameter.
> 
> If I understand correctly, sanei_usb_claim_interface(), 
> sanei_usb_release_interface() and sanei_usb_set_altinterface() are useless 
> because sanei_usb_open() already claims an interface for you and 
> sanei_usb_close() will release it afterward. Why does one want to claim 
> another interface while he cannot use its endpoints through sanei_usb 
> functions?
> 
> Regards
> -- 
> Wittawat Yamwong
> Hannover, Germany
> 

I use them for my stv680 backend, one problem i had after some updates
(sane, libusb,kernel)  was that setting the configuration didn't work
anymore. Disable of the set_configuration solved it for me at that
moment. If setting the configuration is needed for other devices, i
don't know at the moment if some of the webcams i have need that.

-- 
--------
m.vr.gr.
Gerard Klaver




More information about the sane-devel mailing list