From 300daee50fa105a37ce58fde2e0ce653efd756be Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 14 Jul 2017 14:52:20 +0200 Subject: [PATCH] libusb: fix a crash with picolcd driver. The implementation of libusb is not complete, and the missing functions can lead to crashes. At least stub out this one, which is enough to get the picolcd working. --- dev-libs/libusb/libusb-1.0.21.recipe | 3 +- .../libusb/patches/libusb-1.0.21.patchset | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 dev-libs/libusb/patches/libusb-1.0.21.patchset diff --git a/dev-libs/libusb/libusb-1.0.21.recipe b/dev-libs/libusb/libusb-1.0.21.recipe index b529194da..f451e5924 100644 --- a/dev-libs/libusb/libusb-1.0.21.recipe +++ b/dev-libs/libusb/libusb-1.0.21.recipe @@ -20,9 +20,10 @@ COPYRIGHT="2001 Johannes Erdfelt 2012-2013 Toby Gray 2013-2015 Chris Dickens" LICENSE="GNU LGPL v2.1" -REVISION="2" +REVISION="3" SOURCE_URI="https://github.com/libusb/libusb/archive/v$portVersion.tar.gz" SOURCE_FILENAME="libusb-$portVersion.tar.gz" +PATCHES="libusb-$portVersion.patchset" CHECKSUM_SHA256="1a5b08c05bc5e38c81c2d59c29954d5916646f4ff46f51381b3f624384e4ac01" ARCHITECTURES="x86 x86_64 x86_gcc2" SECONDARY_ARCHITECTURES="x86_gcc2 x86" diff --git a/dev-libs/libusb/patches/libusb-1.0.21.patchset b/dev-libs/libusb/patches/libusb-1.0.21.patchset new file mode 100644 index 000000000..5f93bfdb3 --- /dev/null +++ b/dev-libs/libusb/patches/libusb-1.0.21.patchset @@ -0,0 +1,37 @@ +From 6272b5474073c90978488ec441270ed3511c09b4 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 77adbd1..44bf4c3 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 + } + + 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) + { + USBDeviceHandle *handle = *((USBDeviceHandle **)dev_handle->os_priv); +@@ -216,7 +223,7 @@ const struct usbi_os_backend haiku_usb_raw_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.7.0 +