mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-15 08:10:07 +02:00
65 lines
2.1 KiB
Plaintext
65 lines
2.1 KiB
Plaintext
From b8b9f6edc122afe05cb6b1095c396a8913498bf6 Mon Sep 17 00:00:00 2001
|
|
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
|
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
|
|
|