summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorGravatar Hector Martin2009-09-20 19:18:15 +0200
committerGravatar Hector Martin2009-10-03 17:16:24 +0200
commit8ea6dc804457d3ad02b5bc2017007f965359d8c5 (patch)
treefb08beb66949691bc6fddb56c2de1a0d0d377f74 /daemon
parente619fc9e4d90c9e86d1e05fe37ad6fbf284d6de8 (diff)
downloadusbmuxd-8ea6dc804457d3ad02b5bc2017007f965359d8c5.tar.gz
usbmuxd-8ea6dc804457d3ad02b5bc2017007f965359d8c5.tar.bz2
Require libusb-1.0.3 and hardcode explicit ZLP logic
1.0.3 has the 0-byte transaction fix. The saga continues on the libusb trac. Whenever they add the ZLP flag we can get rid of the 0-byte logic and just set it.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/CMakeLists.txt19
-rw-r--r--daemon/usb-linux.c7
2 files changed, 0 insertions, 26 deletions
diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
index e5f9b11..8a5c417 100644
--- a/daemon/CMakeLists.txt
+++ b/daemon/CMakeLists.txt
@@ -6,25 +6,6 @@ include_directories (${CMAKE_SOURCE_DIR}/common)
6include_directories (${CMAKE_SOURCE_DIR}/daemon) 6include_directories (${CMAKE_SOURCE_DIR}/daemon)
7include_directories (${CMAKE_SOURCE_DIR}/libusbmuxd) 7include_directories (${CMAKE_SOURCE_DIR}/libusbmuxd)
8 8
9include(CheckConstantExists)
10set(CMAKE_REQUIRED_INCLUDES ${USB_INCLUDE_DIRS})
11check_constant_exists(LIBUSB_TRANSFER_ZERO_PACKET libusb.h HAVE_LIBUSB_ZLP)
12
13if(NOT HAVE_LIBUSB_ZLP)
14 message("
15================================================================================
16==================================== WARNING ===================================
17================================================================================
18Your libusb is missing proper Zero Length Packet support! If you are using a
19recent libusb Git, things may or may not work. If you are using libusb 1.0.2 or
20earlier, things will definitely not work properly.
21
22Please apply the patch in the contrib/ directory to your libusb 1.0 tree.
23================================================================================
24")
25 add_definitions(-DEXPLICIT_ZLP_TRANSACTION)
26endif(NOT HAVE_LIBUSB_ZLP)
27
28add_definitions(-Wall -O2 -g -DUSBMUXD_DAEMON -DUSBMUXD_VERSION="${USBMUXD_VERSION}") 9add_definitions(-Wall -O2 -g -DUSBMUXD_DAEMON -DUSBMUXD_VERSION="${USBMUXD_VERSION}")
29add_executable(usbmuxd main.c usb-linux.c log.c ../common/utils.c device.c client.c) 10add_executable(usbmuxd main.c usb-linux.c log.c ../common/utils.c device.c client.c)
30target_link_libraries(usbmuxd ${LIBS}) 11target_link_libraries(usbmuxd ${LIBS})
diff --git a/daemon/usb-linux.c b/daemon/usb-linux.c
index f1be612..0edc557 100644
--- a/daemon/usb-linux.c
+++ b/daemon/usb-linux.c
@@ -134,18 +134,12 @@ int usb_send(struct usb_device *dev, const unsigned char *buf, int length)
134 struct libusb_transfer *xfer = libusb_alloc_transfer(0); 134 struct libusb_transfer *xfer = libusb_alloc_transfer(0);
135 libusb_fill_bulk_transfer(xfer, dev->dev, BULK_OUT, (void*)buf, length, tx_callback, dev, 0); 135 libusb_fill_bulk_transfer(xfer, dev->dev, BULK_OUT, (void*)buf, length, tx_callback, dev, 0);
136 xfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK; 136 xfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK;
137#ifndef EXPLICIT_ZLP_TRANSACTION
138 if (length % dev->wMaxPacketSize == 0) {
139 xfer->flags |= LIBUSB_TRANSFER_ZERO_PACKET;
140 }
141#endif
142 if((res = libusb_submit_transfer(xfer)) < 0) { 137 if((res = libusb_submit_transfer(xfer)) < 0) {
143 usbmuxd_log(LL_ERROR, "Failed to submit TX transfer %p len %d to device %d-%d: %d", buf, length, dev->bus, dev->address, res); 138 usbmuxd_log(LL_ERROR, "Failed to submit TX transfer %p len %d to device %d-%d: %d", buf, length, dev->bus, dev->address, res);
144 libusb_free_transfer(xfer); 139 libusb_free_transfer(xfer);
145 return res; 140 return res;
146 } 141 }
147 collection_add(&dev->tx_xfers, xfer); 142 collection_add(&dev->tx_xfers, xfer);
148#ifdef EXPLICIT_ZLP_TRANSACTION
149 if (length % dev->wMaxPacketSize == 0) { 143 if (length % dev->wMaxPacketSize == 0) {
150 usbmuxd_log(LL_DEBUG, "Send ZLP"); 144 usbmuxd_log(LL_DEBUG, "Send ZLP");
151 // Send Zero Length Packet 145 // Send Zero Length Packet
@@ -160,7 +154,6 @@ int usb_send(struct usb_device *dev, const unsigned char *buf, int length)
160 } 154 }
161 collection_add(&dev->tx_xfers, xfer); 155 collection_add(&dev->tx_xfers, xfer);
162 } 156 }
163#endif
164 return 0; 157 return 0;
165} 158}
166 159