[sane-devel] How to handle devices with multiple USB bulk-in endpoints

Reinhold Kainhofer reinhold at kainhofer.com
Mon Nov 1 23:59:16 UTC 2010

Am Montag, 1. November 2010, um 01:03:23 schrieb m. allan noah:
> Yes- what we should probably do is add a new set of
> sanei_usb_{read,write,etc}_extended() functions,  which take the
> endpoint as a argument. Then all of the existing functions could
> become a wrapper around those, which call a helper function to
> determine the 'automatic' endpoint to use.

Here's a first shot at this extension:

I added sanei_usb_*_extended functions, whenever an endpoint is used in the 
code. If the endpoint argument is -1, then the auto-detected endpoints are 
used (first found is taken, all others are ignored, just like things worked so 

I'm not sure if we should add an (optional) pointer to (bulk|int|...)-(in|out) 
endpoints to the sanei_usb_open function to make it possible to override the 
default in/out endpoints...?

What do you think?

With this patch, the magicolor backend works fine for USB-connections (two 
bulk-in endpoints, where the second needs to be used)...


PS: Why are the files in sanei/sanei* and include/sane/sanei_*.h not installed 
and rather directly linked to by the backends? The problem with this approach 
is that any backend outside the sane-backends tree needs to copy those files 
over and keep them up to date from sane-backends. 
Reinhold Kainhofer, reinhold at kainhofer.com, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org

More information about the sane-devel mailing list