diff options
Diffstat (limited to 'drivers/usb/misc/iowarrior.c')
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index dce20301e367..70ec29681526 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -2,14 +2,15 @@ /* * Native support for the I/O-Warrior USB devices * - * Copyright (c) 2003-2005 Code Mercenaries GmbH - * written by Christian Lucht <lucht@codemercs.com> + * Copyright (c) 2003-2005, 2020 Code Mercenaries GmbH + * written by Christian Lucht <lucht@codemercs.com> and + * Christoph Jung <jung@codemercs.com> * * based on * usb-skeleton.c by Greg Kroah-Hartman <greg@kroah.com> * brlvger.c by Stephane Dalton <sdalton@videotron.ca> - * and St�hane Doyon <s.doyon@videotron.ca> + * and Stephane Doyon <s.doyon@videotron.ca> * * Released under the GPLv2. */ @@ -244,7 +245,7 @@ static void iowarrior_write_callback(struct urb *urb) wake_up_interruptible(&dev->write_wait); } -/** +/* * iowarrior_delete */ static inline void iowarrior_delete(struct iowarrior *dev) @@ -271,7 +272,7 @@ static int read_index(struct iowarrior *dev) return (read_idx == intr_idx ? -1 : read_idx); } -/** +/* * iowarrior_read */ static ssize_t iowarrior_read(struct file *file, char __user *buffer, @@ -475,7 +476,7 @@ exit: return retval; } -/** +/* * iowarrior_ioctl */ static long iowarrior_ioctl(struct file *file, unsigned int cmd, @@ -592,7 +593,7 @@ error_out: return retval; } -/** +/* * iowarrior_open */ static int iowarrior_open(struct inode *inode, struct file *file) @@ -640,7 +641,7 @@ out: return retval; } -/** +/* * iowarrior_release */ static int iowarrior_release(struct inode *inode, struct file *file) @@ -742,7 +743,7 @@ static struct usb_class_driver iowarrior_class = { /*---------------------------------*/ /* probe and disconnect functions */ /*---------------------------------*/ -/** +/* * iowarrior_probe * * Called by the usb core when a new device is connected that it thinks @@ -802,14 +803,28 @@ static int iowarrior_probe(struct usb_interface *interface, /* we have to check the report_size often, so remember it in the endianness suitable for our machine */ dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint); - if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) && - ((dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) || - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56AM) || - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW28) || - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW28L) || - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW100))) - /* IOWarrior56 has wMaxPacketSize different from report size */ - dev->report_size = 7; + + /* + * Some devices need the report size to be different than the + * endpoint size. + */ + if (dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) { + switch (dev->product_id) { + case USB_DEVICE_ID_CODEMERCS_IOW56: + case USB_DEVICE_ID_CODEMERCS_IOW56AM: + dev->report_size = 7; + break; + + case USB_DEVICE_ID_CODEMERCS_IOW28: + case USB_DEVICE_ID_CODEMERCS_IOW28L: + dev->report_size = 4; + break; + + case USB_DEVICE_ID_CODEMERCS_IOW100: + dev->report_size = 13; + break; + } + } /* create the urb and buffer for reading */ dev->int_in_urb = usb_alloc_urb(0, GFP_KERNEL); @@ -870,7 +885,7 @@ error: return retval; } -/** +/* * iowarrior_disconnect * * Called by the usb core when the device is removed from the system. |