Whitespace cleanup
diff --git a/examples/dpfp.c b/examples/dpfp.c
index bd9702a..1970f10 100644
--- a/examples/dpfp.c
+++ b/examples/dpfp.c
@@ -169,7 +169,7 @@
if (!buf)
return -ENOMEM;
-
+
transfer = libusb_alloc_transfer(0);
if (!transfer) {
free(buf);
@@ -208,7 +208,7 @@
}
static int sync_intr(unsigned char type)
-{
+{
int r;
unsigned char data[INTR_LENGTH];
@@ -396,7 +396,7 @@
img_transfer = libusb_alloc_transfer(0);
if (!img_transfer)
return -ENOMEM;
-
+
irq_transfer = libusb_alloc_transfer(0);
if (!irq_transfer)
return -ENOMEM;
@@ -411,7 +411,7 @@
static void sighandler(int signum)
{
- do_exit = 1;
+ do_exit = 1;
}
int main(void)
@@ -470,7 +470,7 @@
}
printf("shutting down...\n");
-
+
if (irq_transfer) {
r = libusb_cancel_transfer(irq_transfer);
if (r < 0)
@@ -482,11 +482,11 @@
if (r < 0)
goto out_deinit;
}
-
+
while (irq_transfer || img_transfer)
if (libusb_handle_events(NULL) < 0)
break;
-
+
if (do_exit == 1)
r = 0;
else
diff --git a/libusb/io.c b/libusb/io.c
index ce661ad..f627bcf 100644
--- a/libusb/io.c
+++ b/libusb/io.c
@@ -120,7 +120,7 @@
*
* For details on how to use the synchronous API, see the
* \ref syncio "synchronous I/O API documentation" pages.
- *
+ *
* \section async The asynchronous interface
*
* Asynchronous I/O is the most significant new feature in libusb-1.0.
@@ -241,7 +241,7 @@
* -# <b>Completion handling</b>: examine transfer results in the
* libusb_transfer structure
* -# <b>Deallocation</b>: clean up resources
- *
+ *
*
* \subsection asyncalloc Allocation
*
@@ -394,7 +394,7 @@
* request was not supported.
*
* \section asyncintr Considerations for interrupt transfers
- *
+ *
* All interrupt transfers are performed using the polling interval presented
* by the bInterval value of the endpoint descriptor.
*
@@ -512,12 +512,12 @@
* -# Repeatedly call libusb_handle_events() in blocking mode from a dedicated
* thread.
*
- * The first option is plainly not very nice, and will cause unnecessary
+ * The first option is plainly not very nice, and will cause unnecessary
* CPU wakeups leading to increased power usage and decreased battery life.
* The second option is not very nice either, but may be the nicest option
* available to you if the "proper" approach can not be applied to your
* application (read on...).
- *
+ *
* The recommended option is to integrate libusb with your application main
* event loop. libusb exposes a set of file descriptors which allow you to do
* this. Your main loop is probably already calling poll() or select() or a
@@ -757,7 +757,7 @@
* the loop, <em>up to 120 seconds later.</em> Clearly a two-minute delay is
* undesirable, and don't even think about using short timeouts to circumvent
* this issue!
- *
+ *
* The solution here is to ensure that no two threads are ever polling the
* file descriptors at the same time. A naive implementation of this would
* impact the capabilities of the library, so libusb offers the scheme
@@ -765,7 +765,7 @@
*
* Before we go any further, it is worth mentioning that all libusb-wrapped
* event handling procedures fully adhere to the scheme documented below.
- * This includes libusb_handle_events() and all the synchronous I/O functions -
+ * This includes libusb_handle_events() and all the synchronous I/O functions -
* libusb hides this headache from you. You do not need to worry about any
* of these issues if you stick to that level.
*
@@ -853,7 +853,7 @@
libusb_unlock_event_waiters(ctx);
goto retry;
}
-
+
libusb_wait_for_event(ctx);
}
libusb_unlock_event_waiters(ctx);
@@ -1461,7 +1461,7 @@
if (r)
return 1;
- ctx->event_handler_active = 1;
+ ctx->event_handler_active = 1;
return 0;
}
@@ -1727,7 +1727,7 @@
(cur_tv->tv_sec == systime.tv_sec &&
cur_tv->tv_usec > systime.tv_usec))
return 0;
-
+
/* otherwise, we've got an expired timeout to handle */
handle_timeout(transfer);
}
@@ -2058,7 +2058,7 @@
* need to use this function if you are calling poll() or select() or similar
* on libusb's file descriptors yourself - you do not need to use it if you
* are calling libusb_handle_events() or a variant directly.
- *
+ *
* You should call this function in your main loop in order to determine how
* long to wait for select() or poll() to return results. libusb needs to be
* called into at this timeout, so you should use it as an upper bound on
@@ -2275,7 +2275,7 @@
/* terminate all pending transfers with the LIBUSB_TRANSFER_NO_DEVICE
* status code.
- *
+ *
* this is a bit tricky because:
* 1. we can't do transfer completion while holding flying_transfers_lock
* 2. the transfers list can change underneath us - if we were to build a
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index 740e249..9dcca2f 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -39,10 +39,10 @@
struct list_head *prev, *next;
};
-/* Get an entry from the list
- * ptr - the address of this list_head element in "type"
+/* Get an entry from the list
+ * ptr - the address of this list_head element in "type"
* type - the data type that contains "member"
- * member - the list_head element in "type"
+ * member - the list_head element in "type"
*/
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr) - (unsigned long)(&((type *)0L)->member)))
@@ -160,7 +160,7 @@
struct list_head open_devs;
usbi_mutex_t open_devs_lock;
- /* this is a list of in-flight transfer handles, sorted by timeout
+ /* this is a list of in-flight transfer handles, sorted by timeout
* expiration. URBs to timeout the soonest are placed at the beginning of
* the list, URBs that will time out later are placed after, and urbs with
* infinite timeout are always placed at the very end. */
@@ -663,7 +663,7 @@
*/
int (*kernel_driver_active)(struct libusb_device_handle *handle,
int interface);
-
+
/* Detach a kernel driver from an interface. Optional.
*
* After detaching a kernel driver, the interface should be available
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index 517b77d..0e65385 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -140,7 +140,7 @@
/* No pipe found with the correct endpoint address */
usbi_warn (HANDLE_CTX(dev_handle), "no pipeRef found with endpoint address 0x%02x.", ep);
-
+
return -1;
}
@@ -178,7 +178,7 @@
(*plugInInterface)->Stop(plugInInterface);
IODestroyPlugInInterface (plugInInterface);
-
+
(*(device))->GetLocationID(device, locationp);
return device;
@@ -211,7 +211,7 @@
-static void darwin_devices_detached (void *ptr, io_iterator_t rem_devices) {
+static void darwin_devices_detached (void *ptr, io_iterator_t rem_devices) {
struct libusb_context *ctx = (struct libusb_context *)ptr;
struct libusb_device_handle *handle;
struct darwin_device_priv *dpriv;
@@ -279,7 +279,7 @@
IOServiceMatching(kIOUSBDeviceClassName),
(IOServiceMatchingCallback)darwin_devices_detached,
(void *)ctx, &libusb_rem_device_iterator);
-
+
if (kresult != kIOReturnSuccess) {
usbi_err (ctx, "could not add hotplug event source: %s", darwin_error_str (kresult));
@@ -437,7 +437,7 @@
static int process_new_device (struct libusb_context *ctx, usb_device_t **device, UInt32 locationID, struct discovered_devs **_discdevs) {
struct darwin_device_priv *priv;
- struct libusb_device *dev;
+ struct libusb_device *dev;
struct discovered_devs *discdevs;
UInt16 address, idVendor, idProduct;
UInt8 bDeviceClass, bDeviceSubClass;
@@ -467,7 +467,7 @@
req.wIndex = 0;
req.wLength = sizeof(IOUSBDeviceDescriptor);
req.pData = &(priv->dev_descriptor);
-
+
(*(device))->GetDeviceAddress (device, (USBDeviceAddress *)&address);
(*(device))->GetDeviceProduct (device, &idProduct);
(*(device))->GetDeviceVendor (device, &idVendor);
@@ -511,7 +511,7 @@
}
/**** end: retrieve device descriptors ****/
-
+
/* catch buggy hubs (which appear to be virtual). Apple's own USB prober has problems with these devices. */
if (libusb_le16_to_cpu (priv->dev_descriptor.idProduct) != idProduct) {
/* not a valid device */
@@ -538,9 +538,9 @@
ret = LIBUSB_ERROR_NO_MEM;
break;
}
-
+
*_discdevs = discdevs;
-
+
usbi_info (ctx, "found device with address %d at %s", dev->device_address, priv->sys_path);
} while (0);
@@ -558,7 +558,7 @@
if (!libusb_darwin_mp)
return LIBUSB_ERROR_INVALID_PARAM;
-
+
kresult = usb_setup_device_iterator (&deviceIterator);
if (kresult != kIOReturnSuccess)
return darwin_to_libusb (kresult);
@@ -670,7 +670,7 @@
usbi_err (HANDLE_CTX (dev_handle), "USBDeviceClose: %s", darwin_error_str(kresult));
}
}
-
+
kresult = (*(dpriv->device))->Release(dpriv->device);
if (kresult) {
/* Log the fact that we had a problem closing the file, however failing a
@@ -733,7 +733,7 @@
io_iterator_t interface_iterator;
*usbInterfacep = IO_OBJECT_NULL;
-
+
/* Setup the Interface Request */
request.bInterfaceClass = kIOUSBFindInterfaceDontCare;
request.bInterfaceSubClass = kIOUSBFindInterfaceDontCare;
@@ -746,10 +746,10 @@
for ( current_interface = 0 ; current_interface <= ifc ; current_interface++ )
*usbInterfacep = IOIteratorNext(interface_iterator);
-
+
/* done with the interface iterator */
IOObjectRelease(interface_iterator);
-
+
return 0;
}
@@ -767,7 +767,7 @@
int i;
usbi_info (HANDLE_CTX (dev_handle), "building table of endpoints.");
-
+
/* retrieve the total number of endpoints on this interface */
kresult = (*(cInterface->interface))->GetNumEndpoints(cInterface->interface, &numep);
if (kresult) {
@@ -792,7 +792,7 @@
}
cInterface->num_endpoints = numep;
-
+
return 0;
}
@@ -827,7 +827,7 @@
usbi_err (HANDLE_CTX (dev_handle), "GetNumberOfConfigurations: %s", darwin_error_str(kresult));
return darwin_to_libusb(kresult);
}
-
+
if (nConfig < 1) {
usbi_err (HANDLE_CTX (dev_handle), "GetNumberOfConfigurations: no configurations");
return LIBUSB_ERROR_OTHER;
@@ -866,7 +866,7 @@
usbi_err (HANDLE_CTX (dev_handle), "interface not found");
return LIBUSB_ERROR_NOT_FOUND;
}
-
+
/* get an interface to the device's interface */
kresult = IOCreatePlugInInterfaceForService (usbInterface, kIOUSBInterfaceUserClientTypeID,
kIOCFPlugInInterfaceID, &plugInInterface, &score);
@@ -882,7 +882,7 @@
/* ignore release error */
(void)IOObjectRelease (usbInterface);
-
+
/* Do the actual claim */
kresult = (*plugInInterface)->QueryInterface(plugInInterface,
CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID),
@@ -891,7 +891,7 @@
usbi_err (HANDLE_CTX (dev_handle), "QueryInterface: %s", darwin_error_str(kresult));
return darwin_to_libusb (kresult);
}
-
+
/* We no longer need the intermediate plug-in */
(*plugInInterface)->Release(plugInInterface);
@@ -945,7 +945,7 @@
/* clean up endpoint data */
cInterface->num_endpoints = 0;
-
+
/* delete the interface's async event source */
if (cInterface->cfSource) {
CFRunLoopRemoveSource (libusb_darwin_acfl, cInterface->cfSource, kCFRunLoopDefaultMode);
@@ -1043,7 +1043,7 @@
return darwin_to_libusb (kresult);
}
-
+
driver = IORegistryEntryCreateCFProperty (usbInterface, kIOBundleIdentifierKey, kCFAllocatorDefault, 0);
IOObjectRelease (usbInterface);
@@ -1084,7 +1084,7 @@
/* are we reading or writing? */
is_read = transfer->endpoint & LIBUSB_ENDPOINT_IN;
-
+
if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface) != 0) {
usbi_err (TRANSFER_CTX (transfer), "endpoint not found on any open interface");
@@ -1095,7 +1095,7 @@
(*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
&transferType, &maxPacketSize, &interval);
-
+
/* submit the request */
/* timeouts are unavailable on interrupt endpoints */
if (transferType == kUSBInterrupt) {
@@ -1139,7 +1139,7 @@
/* are we reading or writing? */
is_read = transfer->endpoint & LIBUSB_ENDPOINT_IN;
-
+
/* construct an array of IOUSBIsocFrames */
tpriv->isoc_framelist = (IOUSBIsocFrame*) calloc (transfer->num_iso_packets, sizeof(IOUSBIsocFrame));
if (!tpriv->isoc_framelist)
@@ -1170,7 +1170,7 @@
/* schedule for a frame a little in the future */
frame += 2;
-
+
/* submit the request */
if (is_read)
kresult = (*(cInterface->interface))->ReadIsochPipeAsync(cInterface->interface, pipeRef, transfer->buffer, frame,
@@ -1191,7 +1191,7 @@
return darwin_to_libusb (kresult);
}
-static int submit_control_transfer(struct usbi_transfer *itransfer) {
+static int submit_control_transfer(struct usbi_transfer *itransfer) {
struct libusb_transfer *transfer = __USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct libusb_control_setup *setup = (struct libusb_control_setup *) transfer->buffer;
struct darwin_device_priv *dpriv = (struct darwin_device_priv *)transfer->dev_handle->dev->os_priv;
@@ -1218,7 +1218,7 @@
if (kresult != kIOReturnSuccess)
usbi_err (TRANSFER_CTX (transfer), "control request failed: %s", darwin_error_str(kresult));
-
+
return darwin_to_libusb (kresult);
}
@@ -1270,7 +1270,7 @@
/* abort transactions */
(*(cInterface->interface))->AbortPipe (cInterface->interface, pipeRef);
-
+
usbi_info (ITRANSFER_CTX (itransfer), "calling clear pipe stall to clear the data toggle bit");
/* clear the data toggle bit */
@@ -1426,7 +1426,7 @@
usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->fds[0]);
usbi_handle_disconnect(handle);
-
+
/* done with this device */
continue;
case MESSAGE_ASYNC_IO_COMPLETE:
diff --git a/libusb/sync.c b/libusb/sync.c
index bd4d970..a978b47 100644
--- a/libusb/sync.c
+++ b/libusb/sync.c
@@ -80,7 +80,7 @@
if (!transfer)
return LIBUSB_ERROR_NO_MEM;
-
+
buffer = malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
if (!buffer) {
libusb_free_transfer(transfer);