From 7488ca92eb8d4b568f07ff45f1b96bcda0d783ca Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 24 Nov 2020 22:08:40 -0800 Subject: [PATCH 1/2] libusb-compat: import from base Signed-off-by: Rosen Penev --- libs/libusb-compat/Makefile | 54 +++++ .../patches/001-fix-musl-stdint.patch | 185 ++++++++++++++++++ 2 files changed, 239 insertions(+) create mode 100644 libs/libusb-compat/Makefile create mode 100644 libs/libusb-compat/patches/001-fix-musl-stdint.patch diff --git a/libs/libusb-compat/Makefile b/libs/libusb-compat/Makefile new file mode 100644 index 000000000..5f9b2385c --- /dev/null +++ b/libs/libusb-compat/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libusb-compat +PKG_VERSION:=0.1.5 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/libusb +PKG_HASH:=404ef4b6b324be79ac1bfb3d839eac860fbc929e6acb1ef88793a6ea328bc55a + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 +PKG_LICENSE:=LGPL-2.1 + +PKG_MAINTAINER := Felix Fietkau + +include $(INCLUDE_DIR)/package.mk + +define Package/libusb-compat + SECTION:=libs + CATEGORY:=Libraries + TITLE:=libusb-0.1 compatibility library + DEPENDS:=+libusb-1.0 + URL:=http://libusb.wiki.sourceforge.net/ + ABI_VERSION:=4 +endef + +define Package/libusb-compat/description + libusb is a C library that gives applications easy access to USB devices on + many different operating systems. +endef + +TARGET_CFLAGS += $(FPIC) + +define Build/InstallDev + $(INSTALL_DIR) $(1) + $(CP) $(PKG_INSTALL_DIR)/* $(1)/ + $(INSTALL_DIR) $(2)/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/libusb-config $(2)/bin/ +endef + +define Package/libusb-compat/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb-0.1.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libusb-compat)) diff --git a/libs/libusb-compat/patches/001-fix-musl-stdint.patch b/libs/libusb-compat/patches/001-fix-musl-stdint.patch new file mode 100644 index 000000000..333bc090c --- /dev/null +++ b/libs/libusb-compat/patches/001-fix-musl-stdint.patch @@ -0,0 +1,185 @@ +--- a/libusb/usb.h ++++ b/libusb/usb.h +@@ -27,6 +27,7 @@ + + #include + #include ++#include + #include + + #include +@@ -78,40 +79,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 +130,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 +156,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 +173,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 +255,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 +267,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; + }; From 2b27e0619abaa904e832443792bd9acbe8d37c05 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 24 Nov 2020 22:24:42 -0800 Subject: [PATCH 2/2] libusb-compat: update to 0.1.7 Upstream moved to GitHub. Adjust accordingly. Cleaned up Makefile for consistency between packages. Made InstallDev section more explicit. Used ABI_VERSION in install section. Signed-off-by: Rosen Penev --- libs/libusb-compat/Makefile | 29 +-- .../patches/001-fix-musl-stdint.patch | 185 ------------------ 2 files changed, 17 insertions(+), 197 deletions(-) delete mode 100644 libs/libusb-compat/patches/001-fix-musl-stdint.patch diff --git a/libs/libusb-compat/Makefile b/libs/libusb-compat/Makefile index 5f9b2385c..0868f6eab 100644 --- a/libs/libusb-compat/Makefile +++ b/libs/libusb-compat/Makefile @@ -8,18 +8,19 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libusb-compat -PKG_VERSION:=0.1.5 -PKG_RELEASE:=2 +PKG_VERSION:=0.1.7 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=@SF/libusb -PKG_HASH:=404ef4b6b324be79ac1bfb3d839eac860fbc929e6acb1ef88793a6ea328bc55a +PKG_SOURCE_URL:=https://github.com/libusb/libusb-compat-0.1/releases/download/v$(PKG_VERSION) +PKG_HASH:=8259f8d5b084fe43c47823a939e955e0ba21942b8d112266c39d228cc14764d6 + +PKG_MAINTAINER:= Felix Fietkau +PKG_LICENSE:=LGPL-2.1-or-later +PKG_LICENSE_FILES:=COPYING PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 -PKG_LICENSE:=LGPL-2.1 - -PKG_MAINTAINER := Felix Fietkau include $(INCLUDE_DIR)/package.mk @@ -40,15 +41,19 @@ endef TARGET_CFLAGS += $(FPIC) define Build/InstallDev - $(INSTALL_DIR) $(1) - $(CP) $(PKG_INSTALL_DIR)/* $(1)/ - $(INSTALL_DIR) $(2)/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/libusb-config $(2)/bin/ + $(INSTALL_DIR) $(2)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/libusb-config $(2)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/usb.h $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libusb.pc $(1)/usr/lib/pkgconfig/ endef define Package/libusb-compat/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb-0.1.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb-0.1.so.$(ABI_VERSION)* $(1)/usr/lib/ endef $(eval $(call BuildPackage,libusb-compat)) diff --git a/libs/libusb-compat/patches/001-fix-musl-stdint.patch b/libs/libusb-compat/patches/001-fix-musl-stdint.patch deleted file mode 100644 index 333bc090c..000000000 --- a/libs/libusb-compat/patches/001-fix-musl-stdint.patch +++ /dev/null @@ -1,185 +0,0 @@ ---- a/libusb/usb.h -+++ b/libusb/usb.h -@@ -27,6 +27,7 @@ - - #include - #include -+#include - #include - - #include -@@ -78,40 +79,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 +130,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 +156,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 +173,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 +255,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 +267,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; - };