From 018408bf2086f0d1d9504082dca0fcc2ddc74f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Voltz?= Date: Sun, 10 Mar 2013 15:30:15 +0100 Subject: [PATCH] white space cleanup --- include/sane/sanei_usb.h | 44 +++++++++++++++++++------------------- sanei/sanei_usb.c | 46 ++++++++++++++++++++-------------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/include/sane/sanei_usb.h b/include/sane/sanei_usb.h index a1bd74709..c8fff97a4 100644 --- a/include/sane/sanei_usb.h +++ b/include/sane/sanei_usb.h @@ -42,20 +42,20 @@ */ /** @file sanei_usb.h - * This file provides a generic USB interface. + * This file provides a generic USB interface. * * Currently, two access methods to USB devices are provided: * - Access to device * files as used by the Linux kernel USB scanner driver is supported. FreeBSD - * and OpenBSD with their uscanner drivers also work this way. However, + * and OpenBSD with their uscanner drivers also work this way. However, * detection and control messages aren't supported on these platforms. - * - Access using libusb (where available). + * - Access using libusb (where available). * * A general remark: Do not mix sanei_usb functions with "normal" file-related * libc functions like open() or close. The device numbers used in sanei_usb * are not file descriptors. * - * @sa sanei_lm983x.h, sanei_pa4s2.h, sanei_pio.h, sanei_scsi.h, and man sane-usb(5) * for user-oriented documentation */ @@ -197,7 +197,7 @@ extern void sanei_usb_scan_devices (void); /** Get the vendor and product ids by device name. * - * @param devname + * @param devname * @param vendor vendor id * @param product product id * @@ -213,15 +213,15 @@ sanei_usb_get_vendor_product_byname (SANE_String_Const devname, /** Get the vendor and product ids. * - * Currently, only libusb devices and scanners supported by the Linux USB + * Currently, only libusb devices and scanners supported by the Linux USB * scanner module can be found. For the latter method, the Linux version - * must be 2.4.8 or higher. + * must be 2.4.8 or higher. * * @param dn device number of an already sanei_usb_opened device * @param vendor vendor id * @param product product id * - * @return + * @return * - SANE_STATUS_GOOD - if the ids could be determined * - SANE_STATUS_UNSUPPORTED - if the OS doesn't support detection of ids */ @@ -247,7 +247,7 @@ sanei_usb_find_devices (SANE_Int vendor, SANE_Int product, /** Open a USB device. * * The device is opened by its name devname and the device number is - * returned in dn on success. + * returned in dn on success. * * Device names can be either device file names for direct access over * kernel drivers (like /dev/usb/scanner) or libusb names. The libusb format @@ -294,13 +294,13 @@ extern void sanei_usb_set_endpoint (SANE_Int dn, SANE_Int ep_type, SANE_Int ep); extern SANE_Int sanei_usb_get_endpoint (SANE_Int dn, SANE_Int ep_type); /** Close a USB device. - * + * * @param dn device number */ extern void sanei_usb_close (SANE_Int dn); /** Set the libusb timeout for bulk and interrupt reads. - * + * * @param timeout the new timeout in ms */ extern void sanei_usb_set_timeout (SANE_Int timeout); @@ -310,7 +310,7 @@ extern void sanei_usb_set_timeout (SANE_Int timeout); #define HAVE_SANEI_USB_SET_TIMEOUT /** Clear halt condition on bulk endpoints - * + * * @param dn device number */ extern SANE_Status sanei_usb_clear_halt (SANE_Int dn); @@ -320,7 +320,7 @@ extern SANE_Status sanei_usb_clear_halt (SANE_Int dn); #define HAVE_SANEI_USB_CLEAR_HALT /** Reset device - * + * * @param dn device number */ extern SANE_Status sanei_usb_reset (SANE_Int dn); @@ -334,7 +334,7 @@ extern SANE_Status sanei_usb_reset (SANE_Int dn); * @param buffer buffer to store read data in * @param size size of the data * - * @return + * @return * - SANE_STATUS_GOOD - on succes * - SANE_STATUS_EOF - if zero bytes have been read * - SANE_STATUS_IO_ERROR - if an error occured during the read @@ -353,7 +353,7 @@ sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size); * @param buffer buffer to write to device * @param size size of the data * - * @return + * @return * - SANE_STATUS_GOOD - on succes * - SANE_STATUS_IO_ERROR - if an error occured during the write * - SANE_STATUS_INVAL - on every other error @@ -368,7 +368,7 @@ sanei_usb_write_bulk (SANE_Int dn, const SANE_Byte * buffer, size_t * size); * For a detailed explanation of the parameters, have a look at the USB * specification at the * www.usb.org developers information page. - * + * * @param dn device number * @param rtype specifies the characteristics of the request (e.g. data * direction) @@ -399,7 +399,7 @@ sanei_usb_control_msg (SANE_Int dn, SANE_Int rtype, SANE_Int req, * @param buffer buffer to store read data in * @param size size of the data * - * @return + * @return * - SANE_STATUS_GOOD - on succes * - SANE_STATUS_EOF - if zero bytes have been read * - SANE_STATUS_IO_ERROR - if an error occured during the read @@ -437,7 +437,7 @@ sanei_usb_attach_matching_devices (const char *name, * @param dn device number * @param configuration, configuration nummber * - * @return + * @return * - SANE_STATUS_GOOD - on succes * - SANE_STATUS_EOF - if zero bytes have been read * - SANE_STATUS_IO_ERROR - if an error occured during the read @@ -455,7 +455,7 @@ sanei_usb_set_configuration (SANE_Int dn, SANE_Int configuration); * @param dn device number * @param interface_number interface number * - * @return + * @return * - SANE_STATUS_GOOD - on succes * - SANE_STATUS_EOF - if zero bytes have been read * - SANE_STATUS_IO_ERROR - if an error occured during the read @@ -473,7 +473,7 @@ sanei_usb_claim_interface (SANE_Int dn, SANE_Int interface_number); * @param dn device number * @param interface_number interface number * - * @return + * @return * - SANE_STATUS_GOOD - on succes * - SANE_STATUS_EOF - if zero bytes have been read * - SANE_STATUS_IO_ERROR - if an error occured during the read @@ -491,7 +491,7 @@ sanei_usb_release_interface (SANE_Int dn, SANE_Int interface_number); * @param dn device number * @param alternate, alternate nummber * - * @return + * @return * - SANE_STATUS_GOOD - on succes * - SANE_STATUS_EOF - if zero bytes have been read * - SANE_STATUS_IO_ERROR - if an error occured during the read @@ -510,7 +510,7 @@ sanei_usb_set_altinterface (SANE_Int dn, SANE_Int alternate); * @param dn device number * @param desc where to put the information to * - * @return + * @return * - SANE_STATUS_GOOD - on succes * - SANE_STATUS_UNSUPPORTED - if the feature is not supported by the OS or * SANE. diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c index 3e5779e68..b6971478e 100644 --- a/sanei/sanei_usb.c +++ b/sanei/sanei_usb.c @@ -129,7 +129,7 @@ GetNextDescriptor( struct usb_descriptor_header *currHead, UCHAR *lastBytePtr) typedef enum { - sanei_usb_method_scanner_driver = 0, /* kernel scanner driver + sanei_usb_method_scanner_driver = 0, /* kernel scanner driver (Linux, BSD) */ sanei_usb_method_libusb, @@ -166,11 +166,11 @@ typedef struct } device_list_type; -/** +/** * total number of devices that can be found at the same time */ #define MAX_DEVICES 100 -/** +/** * per-device information, using the functions' parameters dn as index */ static device_list_type devices[MAX_DEVICES]; @@ -301,26 +301,26 @@ kernel_get_vendor_product (int fd, const char *name, int *vendorID, int *product int ctrl_fd; char buf[40]; int dev; - + for (controller = 0; ; controller++ ) { snprintf (buf, sizeof (buf) - 1, "/dev/usb%d", controller); ctrl_fd = open (buf, O_RDWR); - + /* If we can not open the usb controller device, treat it as the end of controller devices */ if (ctrl_fd < 0) break; - + /* Search for the scanner device on this bus */ for (dev = 1; dev < USB_MAX_DEVICES; dev++) - { + { struct usb_device_info devInfo; devInfo.udi_addr = dev; - + if (ioctl (ctrl_fd, USB_DEVICEINFO, &devInfo) == -1) break; /* Treat this as the end of devices for this controller */ - + snprintf (buf, sizeof (buf), "/dev/%s", devInfo.udi_devnames[0]); if (strncmp (buf, name, sizeof (buf)) == 0) { @@ -350,7 +350,7 @@ store_device (device_list_type device) int i = 0; int pos = -1; - /* if there are already some devices present, check against + /* if there are already some devices present, check against * them and leave if an equal one is found */ for (i = 0; i < device_number; i++) { @@ -359,7 +359,7 @@ store_device (device_list_type device) && devices[i].vendor == device.vendor && devices[i].product == device.product) { - /* + /* * Need to update the LibUSB device pointer, since it might * have changed after the latest USB scan. */ @@ -693,7 +693,7 @@ static void kernel_scan_devices(void) /* skip standard dir entries */ if (strcmp (dir_entry->d_name, ".") == 0 || strcmp (dir_entry->d_name, "..") == 0) continue; - + if (strncmp (base_name, dir_entry->d_name, strlen (base_name)) == 0) { if (strlen (dir_name) + strlen (dir_entry->d_name) + 1 > @@ -785,7 +785,7 @@ static void libusb_scan_devices(void) found = SANE_TRUE; break; case USB_CLASS_PER_INTERFACE: - if (dev->config[0].interface[interface].num_altsetting == 0 || + if (dev->config[0].interface[interface].num_altsetting == 0 || !dev->config[0].interface[interface].altsetting) { DBG (1, "%s: device 0x%04x/0x%04x doesn't " @@ -813,7 +813,7 @@ static void libusb_scan_devices(void) "scanner (%d/%d)\n", __func__, dev->descriptor.idVendor, dev->descriptor.idProduct, interface, dev->descriptor.bDeviceClass, - dev->config[0].interface[interface].altsetting != 0 + dev->config[0].interface[interface].altsetting != 0 ? dev->config[0].interface[interface].altsetting[0]. bInterfaceClass : -1); } @@ -1972,8 +1972,8 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn) DBG (5, "USBCalls device number to open = %d\n",devices[devcount].fd); DBG (5, "USBCalls Vendor/Product to open = 0x%04x/0x%04x\n", devices[devcount].vendor,devices[devcount].product); - - rc = UsbOpen (&dh, + + rc = UsbOpen (&dh, devices[devcount].vendor, devices[devcount].product, USB_ANY_PRODUCTVERSION, @@ -2000,7 +2000,7 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn) { DBG (3, "sanei_usb_open: more than one " "configuration (%d), choosing first config (%d)\n", - pDevDesc->bNumConfigurations, + pDevDesc->bNumConfigurations, pCfgDesc->bConfigurationValue); } DBG (5, "UsbDeviceSetConfiguration parameters: dh = %p, bConfigurationValue = %d\n", @@ -2014,9 +2014,9 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn) UsbClose (dh); return SANE_STATUS_ACCESS_DENIED; } - + /* Now we look for usable endpoints */ - + for (pDescHead = (struct usb_descriptor_header *) (pCurPtr+pCfgDesc->bLength); pDescHead;pDescHead = GetNextDescriptor(pDescHead,pEndPtr) ) { @@ -2252,7 +2252,7 @@ sanei_usb_reset (SANE_Int dn) DBG (1, "sanei_usb_reset: ret=%d\n", ret); return SANE_STATUS_INVAL; } - + #else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */ DBG (1, "sanei_usb_reset: libusb support missing\n"); #endif /* HAVE_LIBUSB || HAVE_LIBUSB_1_0 */ @@ -2609,7 +2609,7 @@ sanei_usb_control_msg (SANE_Int dn, SANE_Int rtype, SANE_Int req, } if ((rtype & 0x80) && debug_level > 10) print_buffer (data, len); - + return SANE_STATUS_GOOD; #else /* not __linux__ */ DBG (5, "sanei_usb_control_msg: not supported on this OS\n"); @@ -2663,7 +2663,7 @@ sanei_usb_control_msg (SANE_Int dn, SANE_Int rtype, SANE_Int req, int result; result = UsbCtrlMessage (dh, rtype, req, - value, index, len, (char *) data, + value, index, len, (char *) data, usbcalls_timeout); DBG (5, "rc of usb_control_msg = %d\n",result); if (result < 0) @@ -2775,7 +2775,7 @@ sanei_usb_read_int (SANE_Int dn, SANE_Byte * buffer, size_t * size) { #ifdef HAVE_USBCALLS int rc; - USHORT usNumBytes=*size; + USHORT usNumBytes=*size; DBG (5, "Entered usbcalls UsbIrqStart with dn = %d\n",dn); DBG (5, "Entered usbcalls UsbIrqStart with dh = %p\n",dh); DBG (5, "Entered usbcalls UsbIrqStart with int_in_ep = 0x%02x\n",devices[dn].int_in_ep);