[sane-devel] Fwd: sanei_usb limitations

m. allan noah kitno455 at gmail.com
Wed Jan 5 01:25:24 UTC 2011

On Tue, Jan 4, 2011 at 8:01 PM, Reinhold Kainhofer
<reinhold at kainhofer.com> wrote:
> Am Dienstag, 4. Januar 2011, um 22:19:16 schrieb m. allan noah:
>> I think your previous idea of adding a a new function to set the
>> currently 'active' endpoint would be simpler.
> Actually, that was never my idea for overriding the endpoints for a single
> transactions, only for setting the global defaults. For the defaults, it is
> definitely cleaner/easier to use one function to set the default endpoints.

certainly easier than a callback, but really you don't need the
defaults to be changed once you have the ability to override it on a
per-call basis.

> For overriding the ep of a single transaction I don't like this approach too
> much. Having to call a setter function first to set a global variable, before
> you do the actual function call is highly thread-unsafe, and I would prefer to
> pass the ep right to the function itself.

Yes- it does seem cleaner to pass the ep to the function, but I'm not
sure about your threading argument. You are pretty sure to break
something if you've got two threads talking to the scanner at the same

>> something like:
>> /*endpoint types*/
>> #define SANEI_USB_BULK_OUT 0
>> #define SANEI_USB_BULK_IN  1
>> ...
> What do you have against bitmasks like (USB_DIR_IN | USB_ENDPOINT_TYPE_BULK)?
> Then we don't need any new constants...

where are USB_DIR_IN and USB_ENDPOINT_TYPE_BULK defined? :)

"The truth is an offense, but not a sin"

More information about the sane-devel mailing list