PERFORCE change 161423 for review

Hans Petter Selasky hselasky at c2i.net
Fri May 1 10:21:38 UTC 2009


>  int
>  libusb_get_string_descriptor_ascii(libusb_device_handle * dev,
>      uint8_t desc_index, unsigned char *data, int length)
> @@ -207,6 +208,8 @@
>  		return (LIBUSB20_ERROR_NO_MEM);
>
>  	pdev = dev->os_priv;
> -	return (libusb20_dev_req_string_simple_sync(pdev, desc_index,
> -	    data, length));
> +	if (libusb20_dev_req_string_simple_sync(pdev, desc_index,
> +	    data, length) == 0)
> +		return (length);
> +	return (LIBUSB_ERROR_OTHER);
>  }

I think the correct here is to return strlen(data) in the successful case, 
because it is quite common that the software will pass in a fixed size 
buffer, while the actual string will be shorter.

In other words you will get a short terminated control request on the USB.

--HPS




More information about the p4-projects mailing list