From owner-p4-projects@FreeBSD.ORG Fri May 1 09:21:22 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 18BDC1065679; Fri, 1 May 2009 09:21:22 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDE011065670 for ; Fri, 1 May 2009 09:21:21 +0000 (UTC) (envelope-from syl@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 912BF8FC25 for ; Fri, 1 May 2009 09:21:21 +0000 (UTC) (envelope-from syl@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n419LLLB097780 for ; Fri, 1 May 2009 09:21:21 GMT (envelope-from syl@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n419LL8L097778 for perforce@freebsd.org; Fri, 1 May 2009 09:21:21 GMT (envelope-from syl@FreeBSD.org) Date: Fri, 1 May 2009 09:21:21 GMT Message-Id: <200905010921.n419LL8L097778@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to syl@FreeBSD.org using -f From: Sylvestre Gallon To: Perforce Change Reviews Cc: Subject: PERFORCE change 161423 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2009 09:21:24 -0000 http://perforce.freebsd.org/chv.cgi?CH=161423 Change 161423 by syl@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); }