1. 28 1月, 2009 2 次提交
    • 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
    • A
      USB: fix toggle mismatch in disable_endpoint paths · ddeac4e7
      Alan Stern 提交于
      This patch (as1200) finishes some fixes that were left incomplete by
      an earlier patch.
      
      Although nobody has addressed this issue in the past, it turns out
      that we need to distinguish between two different modes of disabling
      and enabling endpoints.  In one mode only the data structures in
      usbcore are affected, and in the other mode the host controller and
      device hardware states are affected as well.
      
      The earlier patch added an extra argument to the routines in the
      enable_endpoint pathways to reflect this difference.  This patch adds
      corresponding arguments to the disable_endpoint pathways.  Without
      this change, the endpoint toggle state can get out of sync between
      the host and the device.  The exact mechanism depends on the details
      of the host controller (whether or not it stores its own copy of the
      toggle values).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NDan Streetman <ddstreet@ieee.org>
      Tested-by: NDan Streetman <ddstreet@ieee.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ddeac4e7
  2. 08 1月, 2009 4 次提交
    • A
      USB: re-enable interface after driver unbinds · 2caf7fcd
      Alan Stern 提交于
      This patch (as1197) fixes an error introduced recently.  Since a
      significant number of devices can't handle Set-Interface requests, we
      no longer call usb_set_interface() when a driver unbinds from an
      interface, provided the interface is already in altsetting 0.  However
      the interface still does get disabled, and the call to
      usb_set_interface() was the only thing re-enabling it.  Since the
      interface doesn't get re-enabled, further attempts to use it fail.
      
      So the patch adds a call to usb_enable_interface() when a driver
      unbinds and the interface is in altsetting 0.  For this to work
      right, the interface's endpoints have to be re-enabled but their
      toggles have to be left alone.  Therefore an additional argument is
      added to usb_enable_endpoint() and usb_enable_interface(), a flag
      indicating whether or not the endpoint toggles should be reset.
      
      This is a forward-ported version of a patch which fixes Bugzilla
      #12301.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NDavid Roka <roka@dawid.hu>
      Reported-by: NErik Ekman <erik@kryo.se>
      Tested-by: NErik Ekman <erik@kryo.se>
      Tested-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2caf7fcd
    • A
      USB: utilize the bus notifiers · 3b23dd6f
      Alan Stern 提交于
      This patch (as1185) makes usbcore take advantage of the bus
      notifications sent out by the driver core.  Now we can create all our
      device and interface attribute files before the device or interface
      uevent is broadcast.
      
      A side effect is that we no longer create the endpoint "pseudo"
      devices at the same time as a device or interface is registered -- it
      seems like a bad idea to try registering an endpoint before the
      registration of its parent is complete.  So the routines for creating
      and removing endpoint devices have been split out and renamed, and
      they are called explicitly when needed.  A new bitflag is used for
      keeping track of whether or not the interface's endpoint devices have
      been created, since (just as with the interface attributes) they vary
      with the altsetting and hence can be changed at random times.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3b23dd6f
    • A
      USB: Enhance usage of pm_message_t · 65bfd296
      Alan Stern 提交于
      This patch (as1177) modifies the USB core suspend and resume
      routines.  The resume functions now will take a pm_message_t argument,
      so they will know what sort of resume is occurring.  The new argument
      is also passed to the port suspend/resume and bus suspend/resume
      routines (although they don't use it for anything but debugging).
      
      In addition, special pm_message_t values are used for user-initiated,
      device-initiated (i.e., remote wakeup), and automatic suspend/resume.
      By testing these values, drivers can tell whether or not a particular
      suspend was an autosuspend.  Unfortunately, they can't do the same for
      resumes -- not until the pm_message_t argument is also passed to the
      drivers' resume methods.  That will require a bigger change.
      
      IMO, the whole Power Management framework should have been set up this
      way in the first place.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      65bfd296
    • A
      USB: add asynchronous autosuspend/autoresume support · 9ac39f28
      Alan Stern 提交于
      This patch (as1160b) adds support routines for asynchronous autosuspend
      and autoresume, with accompanying documentation updates.  There
      already are several potential users of this interface, and others are
      likely to arise as autosuspend support becomes more widespread.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9ac39f28
  3. 22 8月, 2008 1 次提交
    • A
      USB: Add new PM callback methods for USB · f2189c47
      Alan Stern 提交于
      This patch (as1129) adds support for the new PM callbacks to usbcore.
      The new callbacks merely invoke the same old USB power management
      routines as the old ones did.
      
      A minor improvement is that the callbacks are present only in the
      "USB-device" device_type structure, rather than in the bus_type
      structure.  This way they will be invoked only for USB devices, not
      for USB interfaces.  The core USB PM routines automatically handle
      suspending and resuming interfaces along with their devices.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f2189c47
  4. 22 7月, 2008 2 次提交
    • 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
    • A
      USB: Force unbinding of drivers lacking reset_resume or other methods · 78d9a487
      Alan Stern 提交于
      This patch (as1024) takes care of a FIXME issue: Drivers that don't
      have the necessary suspend, resume, reset_resume, pre_reset, or
      post_reset methods will be unbound and their interface reprobed when
      one of the unsupported events occurs.
      
      This is made slightly more difficult by the fact that bind operations
      won't work during a system sleep transition.  So instead the code has
      to defer the operation until the transition ends.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      78d9a487
  5. 15 5月, 2008 1 次提交
    • A
      USB: create attributes before sending uevent · 2e5f10e4
      Alan Stern 提交于
      This patch (as1087d) fixes a long-standing problem in usbcore: Device,
      interface, and endpoint attributes aren't added until _after_ the
      creation uevent has already been broadcast.
      
      Unfortunately there are a few attributes which cannot be created that
      early.  The "descriptors" attribute is binary and so must be created
      separately.  The power-management attributes can't be created until
      the dev/power/ group exists.  And the interface string can vary from
      one altsetting to another, so it has to be created dynamically.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2e5f10e4
  6. 25 4月, 2008 1 次提交
  7. 02 2月, 2008 1 次提交
  8. 13 10月, 2007 3 次提交
    • G
      USB: rename choose_configuration · b5ea060f
      Greg Kroah-Hartman 提交于
      As it is global, give it a usb specific name in the global namespace.
      
      Cc: Inaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b5ea060f
    • I
      usb: introduce usb_authorize/deauthorize() · 93993a0a
      Inaky Perez-Gonzalez 提交于
      These USB API functions will do the full authorization/deauthorization
      to be used for a device. When authorized we effectively allow a
      configuration to be set. Reverse that when deauthorized.
      
      Effectively this means that we have to clean all the configuration
      descriptors on deauthorize and reload them when we authorized. We could
      do without throwing them out for wired devices, but for wireless, we can
      read them only after authenticating, and thus, when authorizing an
      authenticated device we would need to read them. So to simplify, always
      release them on deauthorize(), re-read them on authorize().
      
      Also fix leak reported by Ragner Magalhaes; in usb_deauthorize_device(),
      bNumConfigurations was being set to zero before the for loop, and thus
      the different raw descriptors where never being freed.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      93993a0a
    • A
      USB: add ep->enable · bdd016ba
      Alan Stern 提交于
      This patch (as944) adds an explicit "enabled" field to the
      usb_host_endpoint structure and uses it in place of the current
      mechanism.  This is merely a time-space tradeoff; it makes checking
      whether URBs may be submitted to an endpoint simpler.  The existing
      mechanism is efficient when converting urb->pipe to an endpoint
      pointer, but it's not so efficient when urb->ep is used instead.
      
      As a side effect, the procedure for enabling an endpoint is now a
      little more complicated.  The ad-hoc inline code in usb.c and hub.c
      for enabling ep0 is now replaced with calls to usb_enable_endpoint,
      which is no longer static.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bdd016ba
  9. 13 7月, 2007 4 次提交
    • A
      USB: unify reset_resume and normal resume · 54515fe5
      Alan Stern 提交于
      This patch (as919) unifies the code paths used for normal resume and
      for reset-resume.  Earlier I had failed to note a section in the USB
      spec which requires the host to resume a suspended port before
      resetting it if the attached device is enabled for remote wakeup.
      Since the port has to be resumed anyway, we might as well reuse the
      existing code.
      
      The main changes are:
      
      	usb_reset_suspended_device() is eliminated.
      
      	usb_root_hub_lost_power() is moved down next to the
      	hub_reset_resume() routine, to which it is logically
      	related.
      
      	finish_port_resume() does a port reset() if the device's
      	reset_resume flag is set.
      
      	usb_port_resume() doesn't check whether the port is initially
      	enabled if this is a USB-Persist sort of resume.
      
      	Code to perform the port reset is added to the resume pathway
      	for the non-CONFIG_USB_SUSPEND case.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      54515fe5
    • A
      USB: remove __usb_port_suspend · 4956eccd
      Alan Stern 提交于
      This patch (as915b) combines the public routine usb_port_suspend() and
      the private routine __usb_port_suspend() into a single function.
      
      By removing the explicit mention of otg_port in the call to
      __usb_port_suspend(), we prevent a possible error in which the system
      tries to perform HNP on the wrong port when a non-targeted device is
      plugged into a non-OTG port.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4956eccd
    • A
      USB: add USB-Persist facility · 0458d5b4
      Alan Stern 提交于
      This patch (as886) adds the controversial USB-persist facility,
      allowing USB devices to persist across a power loss during system
      suspend.
      
      The facility is controlled by a new Kconfig option (with appropriate
      warnings about the potential dangers); when the option is off the
      behavior will remain the same as it is now.  But when the option is
      on, people will be able to use suspend-to-disk and keep their USB
      filesystems intact -- something particularly valuable for small
      machines where the root filesystem is on a USB device!
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0458d5b4
    • A
      USB: interface PM state · 784a6e1c
      Alan Stern 提交于
      This patch (as880) strives to keep the PM core's idea of a USB
      interface's power state in synch with usbcore's own idea.  In the end
      this doesn't really matter, but it's better to be consistent.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      784a6e1c
  10. 28 4月, 2007 3 次提交
    • K
      USB: make usbdevices export their device nodes instead of using a separate class · 9f8b17e6
      Kay Sievers 提交于
      o The "real" usb-devices export now a device node which can
        populate /dev/bus/usb.
      
      o The usb_device class is optional now and can be disabled in the
        kernel config. Major/minor of the "real" devices and class devices
        are the same.
      
      o The environment of the usb-device event contains DEVNUM and BUSNUM to
        help udev and get rid of the ugly udev rule we need for the class
        devices.
      
      o The usb-devices and usb-interfaces share the same bus, so I used
        the new "struct device_type" to let these devices identify
        themselves. This also removes the current logic of using a magic
        platform-pointer.
        The name of the device_type is also added to the environment
        which makes it easier to distinguish the different kinds of devices
        on the same subsystem.
      
        It looks like this:
          add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1
          ACTION=add
          DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-1
          SUBSYSTEM=usb
          SEQNUM=1533
          MAJOR=189
          MINOR=131
          DEVTYPE=usb_device
          PRODUCT=46d/c03e/2000
          TYPE=0/0/0
          BUSNUM=002
          DEVNUM=004
      
      This udev rule works as a replacement for usb_device class devices:
        SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \
          NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644"
      
      Updated patch, which needs the device_type patches in Greg's tree.
      
      I also got a bugzilla assigned for this. :)
        https://bugzilla.novell.com/show_bug.cgi?id=250659Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      9f8b17e6
    • A
      USB: separate autosuspend from external suspend · 6b157c9b
      Alan Stern 提交于
      This patch (as866) adds new entry points for external USB device
      suspend and resume requests, as opposed to internally-generated
      autosuspend or autoresume.  It also changes the existing
      remote-wakeup code paths to use the new routines, since remote wakeup
      is not the same as autoresume.
      
      As part of the change, it turns out to be necessary to do remote
      wakeup of root hubs from a workqueue.  We had been using khubd, but it
      does autoresume rather than an external resume.  Using the
      ksuspend_usb_wq workqueue for this purpose seemed a logical choice.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6b157c9b
    • A
      usbcore: move usb_autosuspend_work · 718efa64
      Alan Stern 提交于
      This patch (as864) moves the work routine for USB autosuspend from one
      source file to another.  This permits the removal of one whole global
      symbol (!) and should smooth the way for more changes in the future.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      718efa64
  11. 24 2月, 2007 4 次提交
  12. 02 12月, 2006 1 次提交
  13. 02 10月, 2006 1 次提交
  14. 29 9月, 2006 2 次提交
  15. 28 9月, 2006 10 次提交