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.
This commit is contained in:
Adrien Destugues
2017-07-14 14:52:20 +02:00
parent 74b6f08c23
commit 300daee50f
2 changed files with 39 additions and 1 deletions

View File

@@ -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"

View File

@@ -0,0 +1,37 @@
From 6272b5474073c90978488ec441270ed3511c09b4 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
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