[sane-devel] sanei_usb_open() and multifuntion devices

Wittawat Yamwong wy-sane-devel at arcor.de
Wed Sep 13 11:29:04 UTC 2006


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



More information about the sane-devel mailing list