summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Mądrzak <amadrzak@onplick.com>2020-10-29 11:29:30 +0100
committerArtur Mądrzak <amadrzak@onplick.com>2020-10-29 11:33:41 +0100
commita11a355a06ec9dc5fee7decd4d1c746abd3cef6d (patch)
tree910af370d0a7c0c57bc97fee88d76da290990f32
parented81ec89d3e10c8c341ea2230370a80118f56c92 (diff)
downloadlibmtp-a11a355a06ec9dc5fee7decd4d1c746abd3cef6d.tar.gz
Fix USB interface addressing for control packet
Async events doesn't work for composite devices, when MTP interface is not located as the first one in the descriptors. Control transfers, by default are addressed to interface 0 but should be addressed to actual interface. For this purpose wIndex field should contain address of target interface. Signed-off-by: Artur Mądrzak <amadrzak@onplick.com>
-rw-r--r--src/libusb1-glue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libusb1-glue.c b/src/libusb1-glue.c
index 9cc4781..ffffa01 100644
--- a/src/libusb1-glue.c
+++ b/src/libusb1-glue.c
@@ -1848,7 +1848,7 @@ ptp_usb_control_cancel_request (PTPParams *params, uint32_t transactionid) {
htod32a(&buffer[2],transactionid);
ret = libusb_control_transfer(ptp_usb->handle,
LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE,
- 0x64, 0x0000, 0x0000,
+ 0x64, 0x0000, ptp_usb->interface,
buffer,
sizeof(buffer),
ptp_usb->timeout);
@@ -1870,7 +1870,7 @@ ptp_usb_control_device_status_request (PTPParams *params) {
ret = libusb_control_transfer(ptp_usb->handle,
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE,
- 0x67, 0x0000, 0x0000,
+ 0x67, 0x0000, ptp_usb->interface,
buffer,
sizeof(buffer),
ptp_usb->timeout);