PERFORCE change 161423 for review
Sylvestre Gallon
syl at FreeBSD.org
Fri May 1 09:21:24 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=161423
Change 161423 by syl at syl_atuin on 2009/05/01 09:20:58
Fix libusb_get_string_descriptor_ascii return.
Add extra handling to libusb_get_config_descriptor.
Affected files ...
.. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_desc.c#5 edit
Differences ...
==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_desc.c#5 (text+ko) ====
@@ -78,9 +78,6 @@
return (libusb_get_config_descriptor(dev, idx, config));
}
-/*
- * Need to handle extra field.
- */
int
libusb_get_config_descriptor(libusb_device * dev, uint8_t config_index,
struct libusb_config_descriptor **config)
@@ -124,6 +121,9 @@
(*config)->iConfiguration = pconf->desc.iConfiguration;
(*config)->bmAttributes = pconf->desc.bmAttributes;
(*config)->MaxPower = pconf->desc.bMaxPower;
+ (*config)->extra_length = pconf->extra.len;
+ if ((*config)->extra_length != 0)
+ ifd->extra = pconf->extra.ptr;
for ( i = 0 ; i < nif ; i++) {
pinf = &pconf->interface[i];
@@ -138,6 +138,9 @@
ifd->bInterfaceSubClass = pinf->desc.bInterfaceSubClass;
ifd->bInterfaceProtocol = pinf->desc.bInterfaceProtocol;
ifd->iInterface = pinf->desc.iInterface;
+ ifd->extra_length = pinf->extra.len;
+ if (ifd->extra_length != 0)
+ ifd->extra = pinf->extra.ptr;
for (j = 0 ; j < pinf->num_endpoints ; j++) {
pend = &pconf->interface[i].endpoints[j];
@@ -150,6 +153,9 @@
endd->bInterval = pend->desc.bInterval;
endd->bRefresh = pend->desc.bRefresh;
endd->bSynchAddress = pend->desc.bSynchAddress;
+ endd->extra_length = pend->extra.len;
+ if (endd->extra_length != 0)
+ endd->extra = pend->extra.ptr;
}
}
@@ -191,11 +197,6 @@
free(config);
}
-/*
- * Perhaps need a fix, because this function need to return
- * the size of string on success and not 0
- */
-
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);
}
More information about the p4-projects
mailing list