1. 11 12月, 2009 1 次提交
    • A
      usbdevfs: move compat_ioctl handling to devio.c · 637e8a60
      Arnd Bergmann 提交于
      Half the compat_ioctl handling is in devio.c, the other
      half is in fs/compat_ioctl.c. This moves everything into
      one place for consistency.
      
      As a positive side-effect, push down the BKL into the
      ioctl methods.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Alon Bar-Lev <alon.barlev@gmail.com>
      Cc: David Vrabel <david.vrabel@csr.com>
      Cc: linux-usb@vger.kernel.org
      637e8a60
  2. 23 9月, 2009 4 次提交
    • A
      USB: usbfs: add USBDEVFS_URB_BULK_CONTINUATION flag · 01c6460f
      Alan Stern 提交于
      This patch (as1283) adds a new flag, USBDEVFS_URB_BULK_CONTINUATION,
      to usbfs.  It is intended for userspace libraries such as libusb and
      openusb.  When they have to break up a single usbfs bulk transfer into
      multiple URBs, they will set the flag on all but the first URB of the
      series.
      
      If an error other than an unlink occurs, the kernel will automatically
      cancel all the following URBs for the same endpoint and refuse to
      accept new submissions, until an URB is encountered that is not marked
      as a BULK_CONTINUATION.  Such an URB would indicate the start of a new
      transfer or the presence of an older library, so the kernel returns to
      normal operation.
      
      This enables libraries to delimit bulk transfers correctly, even in
      the presence of early termination as indicated by short packets.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      
      01c6460f
    • M
      USB: increase usbdevfs max isoc buffer size · 5971897f
      Markus Rechberger 提交于
      The current limit only allows isochronous transfers up to 32kbyte/urb,
      updating this to 192 kbyte/urb improves the reliability of the
      transfer. USB 2.0 transfer is possible with 32kbyte but increases the
      chance of corrupted/incomplete data when the system is performing some
      other tasks in the background.
      
      http://www.spinics.net/lists/linux-usb/msg19955.htmlSigned-off-by: NMarkus Rechberger <mrechberger@gmail.com>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5971897f
    • A
      USB: make the "usbfs_snoop" log more pertinent · 4c6e8971
      Alan Stern 提交于
      This patch (as1261) reduces the amount of detailed URB information
      logged by usbfs when the usbfs_snoop parameter is enabled.
      
      Currently we don't display the final status value for a completed URB.
      But we do display the entire data buffer twice: both before submission
      and after completion.  The after-completion display doesn't limit
      itself to the actual_length value.  But since usbmon is readily
      available in virtually all distributions, there's no reason for usbfs
      to print out any buffer contents at all!
      
      So this patch restricts the information to: userspace buffer pointer,
      endpoint number, type, and direction, length or actual_length, and
      timeout value or status.  Now everything fits neatly into a single
      line.
      
      Along with those changes, the patch also fixes the snoop output for
      the REAPURBNDELAY and REAPURBNDELAY32 ioctls.  The current version
      omits the 'N' from the names.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4c6e8971
    • A
      USB: add API for userspace drivers to "claim" ports · 7cbe5dca
      Alan Stern 提交于
      This patch (as1258) implements a feature that users have been asking
      for: It gives programs the ability to "claim" a port on a hub, via a
      new usbfs ioctl.  A device plugged into a "claimed" port will not be
      touched by the kernel beyond the immediate necessities of
      initialization and enumeration.
      
      In particular, when a device is plugged into a "claimed" port, the
      kernel will not select and install a configuration.  And when a config
      is installed by usbfs or sysfs, the kernel will not probe any drivers
      for any of the interfaces.  (However the kernel will fetch various
      string descriptors during enumeration.  One could argue that this
      isn't really necessary, but the strings are exported in sysfs.)
      
      The patch does not guarantee exclusive access to these devices; it is
      still possible for more than one program to open the device file
      concurrently.  Programs are responsible for coordinating access among
      themselves.
      
      A demonstration program showing how to use the new interface can be 
      found in an attachment to
      
      	http://marc.info/?l=linux-usb&m=124345857431452&w=2
      
      The patch also makes a small simplification to the hub driver,
      replacing a bunch of more-or-less useless variants of "out of memory"
      with a single message.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7cbe5dca
  3. 08 8月, 2009 2 次提交
  4. 13 7月, 2009 3 次提交
    • A
      USB: handle zero-length usbfs submissions correctly · 9180135b
      Alan Stern 提交于
      This patch (as1262) fixes a bug in usbfs: It refuses to accept
      zero-length transfers, and it insists that the buffer pointer be valid
      even if there is no data being transferred.
      
      The patch also consolidates a bunch of repetitive access_ok() checks
      into a single check, which incidentally fixes the lack of such a check
      for Isochronous URBs.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9180135b
    • O
      USB: fix race leading to a write after kfree in usbfs · 516a1a07
      Oliver Neukum 提交于
      this fixes a race between async_completed() and proc_reapurbnonblock().
      
      CPU A                   CPU B
      
      spin_lock(&ps->lock);
      list_move_tail(&as->asynclist, &ps->async_completed);
      spin_unlock(&ps->lock);
      
                                      if (!(as = async_getcompleted(ps)))
                                              return -EAGAIN;
                                      return processcompl(as, (void __user * __user *)arg);
      
      processcompl() calls free_async() which calls kfree(as)
      
      as->status = urb->status;
      if (as->signr) {
              sinfo.si_signo = as->signr;
              sinfo.si_errno = as->status;
              sinfo.si_code = SI_ASYNCIO;
              sinfo.si_addr = as->userurb;
              kill_pid_info_as_uid(as->signr, &sinfo, as->pid, as->uid,
                                    as->euid, as->secid);
      }
      snoop(&urb->dev->dev, "urb complete\n");
      snoop_urb(urb, as->userurb);
      
      write after kfree
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      516a1a07
    • O
      USB: fix memleak in usbfs · d794a021
      Oliver Neukum 提交于
      This patch fixes a memory leak in devio.c::processcompl
      
      If writing to user space fails the packet must be discarded, as it
      already has been removed from the queue of completed packets.
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d794a021
  5. 18 4月, 2009 1 次提交
    • D
      USB: add reset endpoint operations · 3444b26a
      David Vrabel 提交于
      Wireless USB endpoint state has a sequence number and a current
      window and not just a single toggle bit.  So allow HCDs to provide a
      endpoint_reset method and call this or clear the software toggles as
      required (after a clear halt, set configuration etc.).
      
      usb_settoggle() and friends are then HCD internal and are moved into
      core/hcd.h and all device drivers call usb_reset_endpoint() instead.
      
      If the device endpoint state has been reset (with a clear halt) but
      the host endpoint state has not then subsequent data transfers will
      not complete. The device will only work again after it is reset or
      disconnected.
      Signed-off-by: NDavid Vrabel <david.vrabel@csr.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3444b26a
  6. 25 3月, 2009 3 次提交
  7. 18 3月, 2009 1 次提交
    • A
      USB: usbfs: keep async URBs until the device file is closed · 6ff10464
      Alan Stern 提交于
      The usbfs driver manages a list of completed asynchronous URBs.  But
      it is too eager to free the entries on this list: destroy_async() gets
      called whenever an interface is unbound or a device is removed, and it
      deallocates the outstanding struct async entries for all URBs on that
      interface or device.  This is wrong; the user program should be able
      to reap an URB any time after it has completed, regardless of whether
      or not the interface is still bound or the device is still present.
      
      This patch (as1222) moves the code for deallocating the completed list
      entries from destroy_async() to usbdev_release().  The outstanding
      entries won't be freed until the user program has closed the device
      file, thereby eliminating any possibility that the remaining URBs
      might still be reaped.
      
      This fixes a bug in which a program can hang in the USBDEVFS_REAPURB
      ioctl when the device is unplugged.
      Reported-and-tested-by: NMartin Poupe <martin.poupe@upek.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6ff10464
  8. 28 1月, 2009 1 次提交
    • A
      USB: fix char-device disconnect handling · 501950d8
      Alan Stern 提交于
      This patch (as1198) fixes a conceptual bug: Somewhere along the line
      we managed to confuse USB class devices with USB char devices.  As a
      result, the code to send a disconnect signal to userspace would not be
      built if both CONFIG_USB_DEVICE_CLASS and CONFIG_USB_DEVICEFS were
      disabled.
      
      The usb_fs_classdev_common_remove() routine has been renamed to
      usbdev_remove() and it is now called whenever any USB device is
      removed, not just when a class device is unregistered.  The notifier
      registration and unregistration calls are no longer conditionally
      compiled.  And since the common removal code will always be called as
      part of the char device interface, there's no need to call it again as
      part of the usbfs interface; thus the invocation of
      usb_fs_classdev_common_remove() has been taken out of
      usbfs_remove_device().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Tested-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Cc: stable <stable@kernel.org>
      
      501950d8
  9. 08 1月, 2009 2 次提交
    • M
      USB: fix minor nit in usbfs checking · ed0c7720
      Mark Lord 提交于
      One minor nit did show up, though.  The patch below
      seems to make more sense than the code does without it.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ed0c7720
    • P
      USB: Remove restrictions on signal numbers in devio.c · ff8973d9
      Phil Endecott 提交于
      Just over a year ago (!) I had this brief exchange with Alan Stern:
      
      >> It seems that the signal that can be used with USBDEVFS_DISCSIGNAL and 
      >> in usbdevfs_urb.signr is limited to the real-time signals SIGRTMIN to 
      >> SIGRTMAX. What's the rationale for this restriction? I believe that a 
      >> process can kill() itself with any signal number, can't it? I was 
      >> planning to use SIGIO for usbdevfs_urb.signr and SIGTERM (uncaught) for 
      >> USBDEVFS_DISCSIGNAL. I don't think I'll have a problem with using 
      >> SIGRTMIN+n instead, but I'm curious to know if there's some subtle 
      >> problem with the non-real-time signals that I should be aware of.
      >
      > I don't know of any reason for this restriction.
      
      Since no-one else could think of a reason either, I offer the following 
      patch which allows any signal to be used with USBDEVFS_DISCSIGNAL and 
      usbdevfs_urb.signr.
      Signed-off-by: NPhil Endecott <usbpatch@chezphil.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ff8973d9
  10. 14 11月, 2008 2 次提交
  11. 18 10月, 2008 3 次提交
  12. 17 10月, 2008 1 次提交
  13. 22 7月, 2008 10 次提交
    • G
      device create: usb: convert device_create to device_create_drvdata · bc00bc92
      Greg Kroah-Hartman 提交于
      device_create() is race-prone, so use the race-free
      device_create_drvdata() instead as device_create() is going away.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bc00bc92
    • D
      sysfs: add /sys/dev/{char,block} to lookup sysfs path by major:minor · e105b8bf
      Dan Williams 提交于
      Why?:
      There are occasions where userspace would like to access sysfs
      attributes for a device but it may not know how sysfs has named the
      device or the path.  For example what is the sysfs path for
      /dev/disk/by-id/ata-ST3160827AS_5MT004CK?  With this change a call to
      stat(2) returns the major:minor then userspace can see that
      /sys/dev/block/8:32 links to /sys/block/sdc.
      
      What are the alternatives?:
      1/ Add an ioctl to return the path: Doable, but sysfs is meant to reduce
         the need to proliferate ioctl interfaces into the kernel, so this
         seems counter productive.
      
      2/ Use udev to create these symlinks: Also doable, but it adds a
         udev dependency to utilities that might be running in a limited
         environment like an initramfs.
      
      3/ Do a full-tree search of sysfs.
      
      [kay.sievers@vrfy.org: fix duplicate registrations]
      [kay.sievers@vrfy.org: cleanup suggestions]
      
      Cc: Neil Brown <neilb@suse.de>
      Cc: Tejun Heo <htejun@gmail.com>
      Acked-by: NKay Sievers <kay.sievers@vrfy.org>
      Reviewed-by: NSL Baur <steve@xemacs.org>
      Acked-by: NKay Sievers <kay.sievers@vrfy.org>
      Acked-by: NMark Lord <lkml@rtr.ca>
      Acked-by: NH. Peter Anvin <hpa@zytor.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e105b8bf
    • D
      USB: Fix pointer/int cast in USB devio code · a80d5ff0
      David Howells 提交于
      Fix pointer/int cast in USB devio code, and thus avoid a compiler warning.
      
      A void* data argument passed to bus_find_device() and thence to match_devt()
      is used to carry a 32-bit datum.  However, casting directly between a u32 and
      a pointer is not permitted - there must be an intermediate cast via (unsigned)
      long.
      
      This was introduced by the following patch:
      
      	commit 94b1c9fa060ece2c8f080583beb6cc6008e41413
      	Author: Alan Stern <stern@rowland.harvard.edu>
      	Date:   Tue Jun 24 14:47:12 2008 -0400
      
      	    usbfs: simplify the lookup-by-minor routines
      
      	    This patch (as1105) simplifies the lookup-by-minor-number code in
      	    usbfs.  Instead of passing the minor number to the callback, which
      	    must then reconstruct the entire dev_t value, the patch passes the
      	    dev_t value directly.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a80d5ff0
    • A
      usbfs: don't store bad pointers in registration · e04199b2
      Alan Stern 提交于
      This patch (as1107) fixes a small bug in the usbfs registration and
      unregistration code.  It avoids leaving an error value stored in the
      device's usb_classdev field and it avoids trying to unregister a NULL
      pointer.  (It also fixes a rather extreme overuse of whitespace.)
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e04199b2
    • A
      usbfs: fix race between open and unregister · d64aac36
      Alan Stern 提交于
      This patch (as1106) fixes a race between opening and unregistering
      device files in usbfs.  The current code drops its reference to the
      device and then reacquires it, ignoring the possibility that the
      device structure might have been removed in the meantime.  It also
      doesn't check whether the device is already in the NOTATTACHED state
      when the file is opened.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d64aac36
    • A
      usbfs: simplify the lookup-by-minor routines · 61ad04a8
      Alan Stern 提交于
      This patch (as1105) simplifies the lookup-by-minor-number code in
      usbfs.  Instead of passing the minor number to the callback, which
      must then reconstruct the entire dev_t value, the patch passes the
      dev_t value directly.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      61ad04a8
    • A
      usbfs: send disconnect signals when device is unregistered · cd9f0375
      Alan Stern 提交于
      USB device files are accessible in two ways: as files in usbfs and as
      character device nodes.  The two paths are supposed to behave
      identically, but they don't.  When the underlying USB device is
      unplugged, disconnect signals are sent to processes with open usbfs
      files (if they requested these signals) but not to processes with open
      device node files.
      
      This patch (as1104) fixes the bug by moving the disconnect-signalling
      code into a common subroutine which is called from both paths.
      Putting this subroutine in devio.c removes the only out-of-file
      reference to struct dev_state, and so the structure's declaration can
      be moved from usb.h into devio.c.
      
      Finally, the new subroutine performs one extra action: It kills all
      the outstanding async URBs.  (I'd kill the outstanding synchronous
      URBs too, if there was any way to do it.)  In the past this hasn't
      mattered much, because devices were unregistered from usbfs only
      when they were disconnected.  But now the unregistration can also
      occur whenever devices are unbound from the usb_generic driver.  At
      any rate, killing URBs when a device is unregistered from usbfs seems
      like a good thing to do.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cd9f0375
    • M
      USB: fix usb_reset_device and usb_reset_composite_device(take 3) · 742120c6
      Ming Lei 提交于
      This patch renames the existing usb_reset_device in hub.c to
      usb_reset_and_verify_device and renames the existing
      usb_reset_composite_device to usb_reset_device. Also the new
      usb_reset_and_verify_device does't need to be EXPORTED .
      
      The idea of the patch is that external interface driver
      should warn the other interfaces' driver of the same
      device before and after reseting the usb device. One interface
      driver shoud call _old_ usb_reset_composite_device instead of
      _old_ usb_reset_device since it can't assume the device contains
      only one interface. The _old_ usb_reset_composite_device
      is safe for single interface device also. we rename the two
      functions to make the change easily.
      
      This patch is under guideline from Alan Stern.
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      742120c6
    • M
      USB: remove interface parameter of usb_reset_composite_device · 625f6949
      Ming Lei 提交于
      From the current implementation of usb_reset_composite_device
      function, the iface parameter is no longer useful. This function
      doesn't do something special for the iface usb_interface,compared
      with other interfaces in the usb_device. So remove the parameter
      and fix the related caller.
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      625f6949
    • A
      USB: remove CVS keywords · ea05af61
      Adrian Bunk 提交于
      This patch removes CVS keywords that weren't updated for a long time
      from comments.
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ea05af61
  14. 21 6月, 2008 1 次提交
  15. 25 4月, 2008 3 次提交
  16. 02 2月, 2008 2 次提交