From patchwork Sun Oct 11 08:48:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwenhael Goavec-Merou X-Patchwork-Id: 528717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id CFA8D1402A8 for ; Sun, 11 Oct 2015 19:46:07 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2A7A633305; Sun, 11 Oct 2015 08:46:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IpA9Ti8qFp9A; Sun, 11 Oct 2015 08:46:02 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 63A5B25F14; Sun, 11 Oct 2015 08:46:02 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 377A61C1103 for ; Sun, 11 Oct 2015 08:46:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2FAA5893A2 for ; Sun, 11 Oct 2015 08:46:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UV3+1MPvX+hW for ; Sun, 11 Oct 2015 08:45:59 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3]) by whitealder.osuosl.org (Postfix) with ESMTPS id C0C868939A for ; Sun, 11 Oct 2015 08:45:59 +0000 (UTC) Received: from x230.trabucayre.com (unknown [78.252.129.8]) by smtp3-g21.free.fr (Postfix) with ESMTP id 4F14CA6220; Sun, 11 Oct 2015 10:45:55 +0200 (CEST) From: Gwenhael Goavec-Merou To: buildroot@busybox.net Date: Sun, 11 Oct 2015 10:48:30 +0200 Message-Id: <1444553310-26549-1-git-send-email-gwenj@trabucayre.com> X-Mailer: git-send-email 2.4.9 Cc: Gwenhael Goavec-Merou Subject: [Buildroot] [PATCH 1/1] libusb-compat: backport C99 std use patch X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Gwenhael Goavec-Merou fix : http://autobuild.buildroot.net/results/e63/e6360386a0a99900b83494924494ec40552d8dbe/ Signed-off-by: Gwenhael Goavec-Merou --- ...andard-fixed-width-integer-types-in-usb.h.patch | 233 +++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 package/libusb-compat/0001-Use-C99-standard-fixed-width-integer-types-in-usb.h.patch diff --git a/package/libusb-compat/0001-Use-C99-standard-fixed-width-integer-types-in-usb.h.patch b/package/libusb-compat/0001-Use-C99-standard-fixed-width-integer-types-in-usb.h.patch new file mode 100644 index 0000000..7da8595 --- /dev/null +++ b/package/libusb-compat/0001-Use-C99-standard-fixed-width-integer-types-in-usb.h.patch @@ -0,0 +1,233 @@ +From 2e9b6bbebb7cf1ef0095516ec6d5203deb3822e8 Mon Sep 17 00:00:00 2001 +From: Nathan Hjelm +Date: Fri, 9 Oct 2015 15:03:10 -0600 +Subject: [PATCH 1/1] Use C99 standard fixed width integer types in usb.h + +This patch modifies the integer types in usb.h of the form u_int* to the +C99 standard uint* types. + +Based on patch from Gwenhael Goavec-Merou. + +Signed-off-by: Gwenhael Goavec-Merou +Signed-off-by: Nathan Hjelm +--- + libusb/usb.h | 130 ++++++++++++++++++++++++++++++++--------------------------- + 1 file changed, 70 insertions(+), 60 deletions(-) + +diff --git a/libusb/usb.h b/libusb/usb.h +index 84e730f..d2c30aa 100644 +--- a/libusb/usb.h ++++ b/libusb/usb.h +@@ -2,6 +2,7 @@ + * Prototypes, structure definitions and macros. + * + * Copyright (c) 2000-2003 Johannes Erdfelt ++ * Copyright (c) 2015 Nathan Hjelm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -22,8 +23,8 @@ + * distribution for details. + */ + +-#ifndef __USB_H__ +-#define __USB_H__ ++#ifndef USB_H ++#define USB_H + + #include + #include +@@ -31,6 +32,15 @@ + + #include + ++/* stdint.h is not available on older MSVC */ ++#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H)) ++typedef unsigned __int8 uint8_t; ++typedef unsigned __int16 uint16_t; ++typedef unsigned __int32 uint32_t; ++#else ++#include ++#endif ++ + /* + * USB spec information + * +@@ -78,40 +88,40 @@ + + /* All standard descriptors have these 2 fields in common */ + struct usb_descriptor_header { +- u_int8_t bLength; +- u_int8_t bDescriptorType; ++ uint8_t bLength; ++ uint8_t bDescriptorType; + }; + + /* String descriptor */ + struct usb_string_descriptor { +- u_int8_t bLength; +- u_int8_t bDescriptorType; +- u_int16_t wData[1]; ++ uint8_t bLength; ++ uint8_t bDescriptorType; ++ uint16_t wData[1]; + }; + + /* HID descriptor */ + struct usb_hid_descriptor { +- u_int8_t bLength; +- u_int8_t bDescriptorType; +- u_int16_t bcdHID; +- u_int8_t bCountryCode; +- u_int8_t bNumDescriptors; +- /* u_int8_t bReportDescriptorType; */ +- /* u_int16_t wDescriptorLength; */ ++ uint8_t bLength; ++ uint8_t bDescriptorType; ++ uint16_t bcdHID; ++ uint8_t bCountryCode; ++ uint8_t bNumDescriptors; ++ /* uint8_t bReportDescriptorType; */ ++ /* uint16_t wDescriptorLength; */ + /* ... */ + }; + + /* Endpoint descriptor */ + #define USB_MAXENDPOINTS 32 + struct usb_endpoint_descriptor { +- u_int8_t bLength; +- u_int8_t bDescriptorType; +- u_int8_t bEndpointAddress; +- u_int8_t bmAttributes; +- u_int16_t wMaxPacketSize; +- u_int8_t bInterval; +- u_int8_t bRefresh; +- u_int8_t bSynchAddress; ++ uint8_t bLength; ++ uint8_t bDescriptorType; ++ uint8_t bEndpointAddress; ++ uint8_t bmAttributes; ++ uint16_t wMaxPacketSize; ++ uint8_t bInterval; ++ uint8_t bRefresh; ++ uint8_t bSynchAddress; + + unsigned char *extra; /* Extra descriptors */ + int extralen; +@@ -129,15 +139,15 @@ struct usb_endpoint_descriptor { + /* Interface descriptor */ + #define USB_MAXINTERFACES 32 + struct usb_interface_descriptor { +- u_int8_t bLength; +- u_int8_t bDescriptorType; +- u_int8_t bInterfaceNumber; +- u_int8_t bAlternateSetting; +- u_int8_t bNumEndpoints; +- u_int8_t bInterfaceClass; +- u_int8_t bInterfaceSubClass; +- u_int8_t bInterfaceProtocol; +- u_int8_t iInterface; ++ uint8_t bLength; ++ uint8_t bDescriptorType; ++ uint8_t bInterfaceNumber; ++ uint8_t bAlternateSetting; ++ uint8_t bNumEndpoints; ++ uint8_t bInterfaceClass; ++ uint8_t bInterfaceSubClass; ++ uint8_t bInterfaceProtocol; ++ uint8_t iInterface; + + struct usb_endpoint_descriptor *endpoint; + +@@ -155,14 +165,14 @@ struct usb_interface { + /* Configuration descriptor information.. */ + #define USB_MAXCONFIG 8 + struct usb_config_descriptor { +- u_int8_t bLength; +- u_int8_t bDescriptorType; +- u_int16_t wTotalLength; +- u_int8_t bNumInterfaces; +- u_int8_t bConfigurationValue; +- u_int8_t iConfiguration; +- u_int8_t bmAttributes; +- u_int8_t MaxPower; ++ uint8_t bLength; ++ uint8_t bDescriptorType; ++ uint16_t wTotalLength; ++ uint8_t bNumInterfaces; ++ uint8_t bConfigurationValue; ++ uint8_t iConfiguration; ++ uint8_t bmAttributes; ++ uint8_t MaxPower; + + struct usb_interface *interface; + +@@ -172,28 +182,28 @@ struct usb_config_descriptor { + + /* Device descriptor */ + struct usb_device_descriptor { +- u_int8_t bLength; +- u_int8_t bDescriptorType; +- u_int16_t bcdUSB; +- u_int8_t bDeviceClass; +- u_int8_t bDeviceSubClass; +- u_int8_t bDeviceProtocol; +- u_int8_t bMaxPacketSize0; +- u_int16_t idVendor; +- u_int16_t idProduct; +- u_int16_t bcdDevice; +- u_int8_t iManufacturer; +- u_int8_t iProduct; +- u_int8_t iSerialNumber; +- u_int8_t bNumConfigurations; ++ uint8_t bLength; ++ uint8_t bDescriptorType; ++ uint16_t bcdUSB; ++ uint8_t bDeviceClass; ++ uint8_t bDeviceSubClass; ++ uint8_t bDeviceProtocol; ++ uint8_t bMaxPacketSize0; ++ uint16_t idVendor; ++ uint16_t idProduct; ++ uint16_t bcdDevice; ++ uint8_t iManufacturer; ++ uint8_t iProduct; ++ uint8_t iSerialNumber; ++ uint8_t bNumConfigurations; + }; + + struct usb_ctrl_setup { +- u_int8_t bRequestType; +- u_int8_t bRequest; +- u_int16_t wValue; +- u_int16_t wIndex; +- u_int16_t wLength; ++ uint8_t bRequestType; ++ uint8_t bRequest; ++ uint16_t wValue; ++ uint16_t wIndex; ++ uint16_t wLength; + }; + + /* +@@ -254,7 +264,7 @@ struct usb_device { + + void *dev; /* Darwin support */ + +- u_int8_t devnum; ++ uint8_t devnum; + + unsigned char num_children; + struct usb_device **children; +@@ -266,7 +276,7 @@ struct usb_bus { + char dirname[PATH_MAX + 1]; + + struct usb_device *devices; +- u_int32_t location; ++ uint32_t location; + + struct usb_device *root_dev; + }; +-- +2.4.9 +