From 1c1a7317e48ce30964dfc8a152789e3795fc9f67 Mon Sep 17 00:00:00 2001 From: kenmays Date: Sun, 10 May 2020 13:06:11 -0700 Subject: [PATCH] libusb: add libusb-1.0.23 (#4953) --- ...usb-1.0.22.recipe => libusb-1.0.23.recipe} | 6 +- .../libusb/patches/libusb-1.0.22.patchset | 220 ------------------ .../libusb/patches/libusb-1.0.23.patchset | 64 +++++ 3 files changed, 67 insertions(+), 223 deletions(-) rename dev-libs/libusb/{libusb-1.0.22.recipe => libusb-1.0.23.recipe} (94%) delete mode 100644 dev-libs/libusb/patches/libusb-1.0.22.patchset create mode 100644 dev-libs/libusb/patches/libusb-1.0.23.patchset diff --git a/dev-libs/libusb/libusb-1.0.22.recipe b/dev-libs/libusb/libusb-1.0.23.recipe similarity index 94% rename from dev-libs/libusb/libusb-1.0.22.recipe rename to dev-libs/libusb/libusb-1.0.23.recipe index e9cd3e6f3..5eeb97e32 100644 --- a/dev-libs/libusb/libusb-1.0.22.recipe +++ b/dev-libs/libusb/libusb-1.0.23.recipe @@ -20,16 +20,16 @@ COPYRIGHT="2001 Johannes Erdfelt 2012-2013 Toby Gray 2013-2018 Chris Dickens" LICENSE="GNU LGPL v2.1" -REVISION="4" +REVISION="1" SOURCE_URI="https://github.com/libusb/libusb/archive/v$portVersion.tar.gz" -CHECKSUM_SHA256="3500f7b182750cd9ccf9be8b1df998f83df56a39ab264976bdb3307773e16f48" +CHECKSUM_SHA256="02620708c4eea7e736240a623b0b156650c39bfa93a14bcfa5f3e05270313eba" SOURCE_FILENAME="libusb-$portVersion.tar.gz" PATCHES="libusb-$portVersion.patchset" ARCHITECTURES="x86 x86_64 x86_gcc2" SECONDARY_ARCHITECTURES="x86_gcc2 x86" -libVersion="0.1.0" +libVersion="0.2.0" libVersionCompat="$libVersion compat >= ${libVersion%%.*}" portVers="${portVersion%.*}" diff --git a/dev-libs/libusb/patches/libusb-1.0.22.patchset b/dev-libs/libusb/patches/libusb-1.0.22.patchset deleted file mode 100644 index 00adc7149..000000000 --- a/dev-libs/libusb/patches/libusb-1.0.22.patchset +++ /dev/null @@ -1,220 +0,0 @@ -From f4267b4e34668722beb8cefc6487fb980be4faa6 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Fri, 14 Jul 2017 14:51:19 +0200 -Subject: Add a stub for clear_halt. - -Fixes a crash in picolcd driver. - -diff --git a/libusb/os/haiku_usb_raw.cpp b/libusb/os/haiku_usb_raw.cpp -index c701e34..c81658f 100644 ---- a/libusb/os/haiku_usb_raw.cpp -+++ b/libusb/os/haiku_usb_raw.cpp -@@ -128,6 +128,13 @@ haiku_set_altsetting(struct libusb_device_handle *dev_handle, int interface_numb - return handle->SetAltSetting(interface_number, altsetting); - } - -+static int -+haiku_clear_halt(libusb_device_handle*, unsigned char) -+{ -+ /* TODO */ -+ return 0; -+} -+ - static int - haiku_release_interface(struct libusb_device_handle *dev_handle, int interface_number) - { -@@ -218,7 +225,7 @@ const struct usbi_os_backend usbi_backend = { - /*.release_interface =*/ haiku_release_interface, - - /*.set_interface_altsetting =*/ haiku_set_altsetting, -- /*.clear_halt =*/ NULL, -+ /*.clear_halt =*/ haiku_clear_halt, - /*.reset_device =*/ NULL, - - /*.alloc_streams =*/ NULL, --- -2.16.4 - - -From 5338068972352f26c70b98142e8f94832cba52f5 Mon Sep 17 00:00:00 2001 -From: fbrosson -Date: Tue, 27 Mar 2018 11:17:19 +0000 -Subject: Use the default alignment when compiling with gcc2. - - -diff --git a/libusb/libusbi.h b/libusb/libusbi.h -index 31d6ce9..221d2c2 100644 ---- a/libusb/libusbi.h -+++ b/libusb/libusbi.h -@@ -47,7 +47,7 @@ - #else - #define PTR_ALIGNED __declspec(align(4)) - #endif --#elif defined(__GNUC__) -+#elif defined(__GNUC__) && (__GNUC__ >= 3) - #define PTR_ALIGNED __attribute__((aligned(sizeof(void *)))) - #else - #define PTR_ALIGNED --- -2.16.4 - - -From cfe2018ebb07ccb12bacc30a9450d240e05f060a Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Wed, 15 Aug 2018 10:03:17 +0200 -Subject: Use new GET_CONFIGURATION_DESCRIPTOR_ETC ioctl -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fixes the problem I was getting, at least for usb2 ports. Time to dig in -the xhci driver now… - -diff --git a/libusb/os/haiku_usb_backend.cpp b/libusb/os/haiku_usb_backend.cpp -index d3de8cc..bac8297 100644 ---- a/libusb/os/haiku_usb_backend.cpp -+++ b/libusb/os/haiku_usb_backend.cpp -@@ -432,6 +432,7 @@ USBDevice::EndpointToInterface(uint8 address) const - int - USBDevice::Initialise() //Do we need more error checking, etc? How to report? - { -+ usbi_dbg("Haiku init dev %s", fPath); - int fRawFD = open(fPath, O_RDWR | O_CLOEXEC); - if (fRawFD < 0) - return B_ERROR; -@@ -458,15 +459,13 @@ USBDevice::Initialise() //Do we need more error checking, etc? How to report? - } - fConfigToIndex[tmp_config.configuration_value] = i; - fConfigurationDescriptors[i] = new(std::nothrow) unsigned char[tmp_config.total_length]; -- command.control.request_type = 128; -- command.control.request = 6; -- command.control.value = (2 << 8) | i; -- command.control.index = 0; -- command.control.length = tmp_config.total_length; -- command.control.data = fConfigurationDescriptors[i]; -- if (ioctl(fRawFD, B_USB_RAW_COMMAND_CONTROL_TRANSFER, &command, sizeof(command)) || -- command.control.status!=B_USB_RAW_STATUS_SUCCESS) { -- usbi_err(NULL, "failed retrieving full configuration descriptor"); -+ -+ command.config_etc.descriptor = (usb_configuration_descriptor*)fConfigurationDescriptors[i]; -+ command.config_etc.length = tmp_config.total_length; -+ command.config_etc.config_index = i; -+ if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC, &command, sizeof(command)) || -+ command.config_etc.status != B_USB_RAW_STATUS_SUCCESS) { -+ usbi_err(NULL, "failed retrieving configuration descriptor"); - close(fRawFD); - return B_ERROR; - } -diff --git a/libusb/os/haiku_usb_raw.h b/libusb/os/haiku_usb_raw.h -index 5baf53d..d371f01 100644 ---- a/libusb/os/haiku_usb_raw.h -+++ b/libusb/os/haiku_usb_raw.h -@@ -25,6 +25,7 @@ typedef enum { - B_USB_RAW_COMMAND_GET_INTERFACE_DESCRIPTOR_ETC, - B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR_ETC, - B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR_ETC, -+ B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC, - - B_USB_RAW_COMMAND_SET_CONFIGURATION = 0x3000, - B_USB_RAW_COMMAND_SET_FEATURE, -@@ -74,6 +75,13 @@ typedef union { - uint32 config_index; - } config; - -+ struct { -+ status_t status; -+ usb_configuration_descriptor *descriptor; -+ uint32 config_index; -+ size_t length; -+ } config_etc; -+ - struct { - status_t status; - uint32 alternate_info; --- -2.16.4 - - -From 3732447bc4ba8841312096a804a3d882abe887d3 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Sat, 18 Aug 2018 11:08:16 +0200 -Subject: implement clear_halt and provide reset_device - -Fix crashes in ec2drv. - -diff --git a/libusb/os/haiku_usb.h b/libusb/os/haiku_usb.h -index d51ae9e..1e4e863 100644 ---- a/libusb/os/haiku_usb.h -+++ b/libusb/os/haiku_usb.h -@@ -69,6 +69,7 @@ public: - int ReleaseInterface(int); - int SetConfiguration(int); - int SetAltSetting(int, int); -+ int ClearHalt(int endpoint); - status_t SubmitTransfer(struct usbi_transfer *); - status_t CancelTransfer(USBTransfer *); - bool InitCheck(); -diff --git a/libusb/os/haiku_usb_backend.cpp b/libusb/os/haiku_usb_backend.cpp -index bac8297..765a0d7 100644 ---- a/libusb/os/haiku_usb_backend.cpp -+++ b/libusb/os/haiku_usb_backend.cpp -@@ -310,6 +310,23 @@ USBDeviceHandle::SetAltSetting(int inumber, int alt) - } - - -+int -+USBDeviceHandle::ClearHalt(int endpoint) -+{ -+ usb_raw_command command; -+ command.control.request_type = USB_REQTYPE_ENDPOINT_OUT; -+ command.control.request = USB_REQUEST_CLEAR_FEATURE; -+ command.control.value = USB_FEATURE_ENDPOINT_HALT; -+ command.control.index = endpoint; -+ command.control.length = 0; -+ -+ if (ioctl(fRawFD, B_USB_RAW_COMMAND_CONTROL_TRANSFER, &command, sizeof(command)) || -+ command.control.status != B_USB_RAW_STATUS_SUCCESS) { -+ return _errno_to_libusb(command.config.status); -+ } -+} -+ -+ - USBDevice::USBDevice(const char *path) - : - fPath(NULL), -diff --git a/libusb/os/haiku_usb_raw.cpp b/libusb/os/haiku_usb_raw.cpp -index c81658f..e46ce5e 100644 ---- a/libusb/os/haiku_usb_raw.cpp -+++ b/libusb/os/haiku_usb_raw.cpp -@@ -129,10 +129,17 @@ haiku_set_altsetting(struct libusb_device_handle *dev_handle, int interface_numb - } - - static int --haiku_clear_halt(libusb_device_handle*, unsigned char) -+haiku_clear_halt(libusb_device_handle* dev_handle, unsigned char endpoint) -+{ -+ USBDeviceHandle *handle = *((USBDeviceHandle **)dev_handle->os_priv); -+ return handle->ClearHalt(endpoint); -+} -+ -+static int -+haiku_reset_device(libusb_device_handle*) - { - /* TODO */ -- return 0; -+ return LIBUSB_ERROR_NOT_SUPPORTED; - } - - static int -@@ -226,7 +233,7 @@ const struct usbi_os_backend usbi_backend = { - - /*.set_interface_altsetting =*/ haiku_set_altsetting, - /*.clear_halt =*/ haiku_clear_halt, -- /*.reset_device =*/ NULL, -+ /*.reset_device =*/ haiku_reset_device, - - /*.alloc_streams =*/ NULL, - /*.free_streams =*/ NULL, --- -2.16.4 - diff --git a/dev-libs/libusb/patches/libusb-1.0.23.patchset b/dev-libs/libusb/patches/libusb-1.0.23.patchset new file mode 100644 index 000000000..267e3a585 --- /dev/null +++ b/dev-libs/libusb/patches/libusb-1.0.23.patchset @@ -0,0 +1,64 @@ +From b8b9f6edc122afe05cb6b1095c396a8913498bf6 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Wed, 15 Aug 2018 10:03:17 +0200 +Subject: implement clear_halt and provide reset_device + +Fix crashes in ec2drv. + +diff --git a/libusb/os/haiku_usb_backend.cpp b/libusb/os/haiku_usb_backend.cpp +index 539a996..16d7528 100644 +--- a/libusb/os/haiku_usb_backend.cpp ++++ b/libusb/os/haiku_usb_backend.cpp +@@ -309,7 +309,7 @@ USBDeviceHandle::SetAltSetting(int inumber, int alt) + return LIBUSB_SUCCESS; + } + +- ++/* + int + USBDevice::ClearHalt(int endpoint) + { +@@ -325,6 +325,23 @@ USBDevice::ClearHalt(int endpoint) + return _errno_to_libusb(command.control.status); + } + } ++*/ ++ ++int ++USBDeviceHandle::ClearHalt(int endpoint) ++{ ++ usb_raw_command command; ++ command.control.request_type = USB_REQTYPE_ENDPOINT_OUT; ++ command.control.request = USB_REQUEST_CLEAR_FEATURE; ++ command.control.value = USB_FEATURE_ENDPOINT_HALT; ++ command.control.index = endpoint; ++ command.control.length = 0; ++ ++ if (ioctl(fRawFD, B_USB_RAW_COMMAND_CONTROL_TRANSFER, &command, sizeof(command)) || ++ command.control.status != B_USB_RAW_STATUS_SUCCESS) { ++ return _errno_to_libusb(command.config.status); ++ } ++} + + + USBDevice::USBDevice(const char *path) +@@ -449,6 +466,7 @@ USBDevice::EndpointToInterface(uint8 address) const + int + USBDevice::Initialise() //Do we need more error checking, etc? How to report? + { ++ usbi_dbg("Haiku init dev %s", fPath); + int fRawFD = open(fPath, O_RDWR | O_CLOEXEC); + if (fRawFD < 0) + return B_ERROR; +@@ -479,7 +497,7 @@ USBDevice::Initialise() //Do we need more error checking, etc? How to report? + command.config_etc.descriptor = (usb_configuration_descriptor*)fConfigurationDescriptors[i]; + command.config_etc.length = tmp_config.total_length; + command.config_etc.config_index = i; +- if (ioctl(fRawFD, B_USB_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC, &command, sizeof(command)) || ++ if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC, &command, sizeof(command)) || + command.config_etc.status != B_USB_RAW_STATUS_SUCCESS) { + usbi_err(NULL, "failed retrieving full configuration descriptor"); + close(fRawFD); +-- +2.26.0 +