Externals: Update libusb to 1.0.23-rc1

Now has support for isochronous transfers in the WinUSB backend,
which may or may not work better than the UsbDk backend.
This commit is contained in:
Léo Lam committed 2019-05-27 20:09:55 +02:00
1 parent 42de5b9a10
commit 1b9617c85c
163 files changed
+19633 -7732

No files matched your search

+27 -25
View File
@@ -62,7 +62,7 @@ int usbi_parse_descriptor(const unsigned char *source, const char *descriptor,
if (host_endian) {
memcpy(dp, sp, 2);
} else {
w = (sp[1] << 8) | sp[0];
w = (uint16_t)((sp[1] << 8) | sp[0]);
*((uint16_t *)dp) = w;
}
sp += 2;
@@ -74,8 +74,8 @@ int usbi_parse_descriptor(const unsigned char *source, const char *descriptor,
if (host_endian) {
memcpy(dp, sp, 4);
} else {
d = (sp[3] << 24) | (sp[2] << 16) |
(sp[1] << 8) | sp[0];
d = (uint32_t)((sp[3] << 24) | (sp[2] << 16) |
(sp[1] << 8) | sp[0]);
*((uint32_t *)dp) = d;
}
sp += 4;
@@ -168,13 +168,13 @@ static int parse_endpoint(struct libusb_context *ctx,
/* Copy any unknown descriptors into a storage area for drivers */
/* to later parse */
len = (int)(buffer - begin);
if (!len) {
if (len <= 0) {
endpoint->extra = NULL;
endpoint->extra_length = 0;
return parsed;
}
extra = malloc(len);
extra = malloc((size_t)len);
endpoint->extra = extra;
if (!extra) {
endpoint->extra_length = 0;
@@ -230,7 +230,7 @@ static int parse_interface(libusb_context *ctx,
(struct libusb_interface_descriptor *) usb_interface->altsetting;
altsetting = usbi_reallocf(altsetting,
sizeof(struct libusb_interface_descriptor) *
(usb_interface->num_altsetting + 1));
((size_t)usb_interface->num_altsetting + 1));
if (!altsetting) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
@@ -307,8 +307,8 @@ static int parse_interface(libusb_context *ctx,
/* Copy any unknown descriptors into a storage area for */
/* drivers to later parse */
len = (int)(buffer - begin);
if (len) {
ifp->extra = malloc(len);
if (len > 0) {
ifp->extra = malloc((size_t)len);
if (!ifp->extra) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
@@ -333,7 +333,7 @@ static int parse_interface(libusb_context *ctx,
goto err;
if (r == 0) {
ifp->bNumEndpoints = (uint8_t)i;
break;;
break;
}
buffer += r;
@@ -453,10 +453,10 @@ static int parse_configuration(struct libusb_context *ctx,
/* Copy any unknown descriptors into a storage area for */
/* drivers to later parse */
len = (int)(buffer - begin);
if (len) {
if (len > 0) {
/* FIXME: We should realloc and append here */
if (!config->extra_length) {
config->extra = malloc(len);
config->extra = malloc((size_t)len);
if (!config->extra) {
r = LIBUSB_ERROR_NO_MEM;
goto err;
@@ -492,7 +492,7 @@ static int raw_desc_to_config(struct libusb_context *ctx,
{
struct libusb_config_descriptor *_config = malloc(sizeof(*_config));
int r;
if (!_config)
return LIBUSB_ERROR_NO_MEM;
@@ -504,7 +504,7 @@ static int raw_desc_to_config(struct libusb_context *ctx,
} else if (r > 0) {
usbi_warn(ctx, "still %d bytes of descriptor data left", r);
}
*config = _config;
return LIBUSB_SUCCESS;
}
@@ -513,7 +513,7 @@ int usbi_device_cache_descriptor(libusb_device *dev)
{
int r, host_endian = 0;
r = usbi_backend->get_device_descriptor(dev, (unsigned char *) &dev->device_descriptor,
r = usbi_backend.get_device_descriptor(dev, (unsigned char *) &dev->device_descriptor,
&host_endian);
if (r < 0)
return r;
@@ -572,7 +572,7 @@ int API_EXPORTED libusb_get_active_config_descriptor(libusb_device *dev,
int host_endian = 0;
int r;
r = usbi_backend->get_active_config_descriptor(dev, tmp,
r = usbi_backend.get_active_config_descriptor(dev, tmp,
LIBUSB_DT_CONFIG_SIZE, &host_endian);
if (r < 0)
return r;
@@ -587,7 +587,7 @@ int API_EXPORTED libusb_get_active_config_descriptor(libusb_device *dev,
if (!buf)
return LIBUSB_ERROR_NO_MEM;
r = usbi_backend->get_active_config_descriptor(dev, buf,
r = usbi_backend.get_active_config_descriptor(dev, buf,
_config.wTotalLength, &host_endian);
if (r >= 0)
r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
@@ -625,7 +625,7 @@ int API_EXPORTED libusb_get_config_descriptor(libusb_device *dev,
if (config_index >= dev->num_configurations)
return LIBUSB_ERROR_NOT_FOUND;
r = usbi_backend->get_config_descriptor(dev, config_index, tmp,
r = usbi_backend.get_config_descriptor(dev, config_index, tmp,
LIBUSB_DT_CONFIG_SIZE, &host_endian);
if (r < 0)
return r;
@@ -640,7 +640,7 @@ int API_EXPORTED libusb_get_config_descriptor(libusb_device *dev,
if (!buf)
return LIBUSB_ERROR_NO_MEM;
r = usbi_backend->get_config_descriptor(dev, config_index, buf,
r = usbi_backend.get_config_descriptor(dev, config_index, buf,
_config.wTotalLength, &host_endian);
if (r >= 0)
r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
@@ -663,7 +663,7 @@ int usbi_get_config_index_by_value(struct libusb_device *dev,
for (i = 0; i < dev->num_configurations; i++) {
unsigned char tmp[6];
int host_endian;
int r = usbi_backend->get_config_descriptor(dev, i, tmp, sizeof(tmp),
int r = usbi_backend.get_config_descriptor(dev, i, tmp, sizeof(tmp),
&host_endian);
if (r < 0) {
*idx = -1;
@@ -702,8 +702,8 @@ int API_EXPORTED libusb_get_config_descriptor_by_value(libusb_device *dev,
int r, idx, host_endian;
unsigned char *buf = NULL;
if (usbi_backend->get_config_descriptor_by_value) {
r = usbi_backend->get_config_descriptor_by_value(dev,
if (usbi_backend.get_config_descriptor_by_value) {
r = usbi_backend.get_config_descriptor_by_value(dev,
bConfigurationValue, &buf, &host_endian);
if (r < 0)
return r;
@@ -1060,7 +1060,8 @@ int API_EXPORTED libusb_get_ss_usb_device_capability_descriptor(
* It is safe to call this function with a NULL ss_usb_device_cap
* parameter, in which case the function simply returns.
*
* \param ss_usb_device_cap the USB 2.0 Extension descriptor to free
* \param ss_usb_device_cap the SuperSpeed USB Device Capability descriptor
* to free
*/
void API_EXPORTED libusb_free_ss_usb_device_capability_descriptor(
struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap)
@@ -1117,7 +1118,7 @@ int API_EXPORTED libusb_get_container_id_descriptor(struct libusb_context *ctx,
* It is safe to call this function with a NULL container_id parameter,
* in which case the function simply returns.
*
* \param container_id the USB 2.0 Extension descriptor to free
* \param container_id the Container ID descriptor to free
*/
void API_EXPORTED libusb_free_container_id_descriptor(
struct libusb_container_id_descriptor *container_id)
@@ -1163,7 +1164,7 @@ int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev_ha
if (r < 4)
return LIBUSB_ERROR_IO;
langid = tbuf[2] | (tbuf[3] << 8);
langid = (uint16_t)(tbuf[2] | (tbuf[3] << 8));
r = libusb_get_string_descriptor(dev_handle, desc_index, langid, tbuf,
sizeof(tbuf));
@@ -1176,7 +1177,8 @@ int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev_ha
if (tbuf[0] > r)
return LIBUSB_ERROR_IO;
for (di = 0, si = 2; si < tbuf[0]; si += 2) {
di = 0;
for (si = 2; si < tbuf[0]; si += 2) {
if (di >= (length - 1))
break;