Peter Wu wrote:
>
> The documentation says:
>
>     number of bytes returned in data, or LIBUSB_ERROR code on failure
>
> In my opinion in makes perfectly sense for the API to return an error
> when the format does not conform to the USB standard.
>

This is an interesting policy question.  As you yourself pointed out,
the USB spec does not specifically address this behavior.  That is, it
does not explicitly require that the length be >= 2.  It says that the
length of the string is the descriptor length minus 2, so one might
debate the meaning of a string with negative length, but again that is
not prohibited.

Thus, what you have here is your interpretation.  We've debated before
whether it is up to the library to try to present meaningful results
when given broken devices.  In this particular case, I would argue that
the most flexible response is for the library to return exactly what it
got, unless the user has requested interpretation (that is, the _ascii
version).  In that case, we can be free to reject bad data.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to