1. 02 Mar, 2010 1 commit
  2. 20 Jan, 2010 1 commit
  3. 23 Dec, 2009 1 commit
    • Alan Stern's avatar
      USB: fix bugs in usb_(de)authorize_device · da307123
      Alan Stern authored
      
      This patch (as1315) fixes some bugs in the USB core authorization
      code:
      
      	usb_deauthorize_device() should deallocate the device strings
      	instead of leaking them, and it should invoke
      	usb_destroy_configuration() (which does proper reference
      	counting) instead of freeing the config information directly.
      
      	usb_authorize_device() shouldn't change the device strings
      	until it knows that the authorization will succeed, and it should
      	autosuspend the device at the end (having autoresumed the
      	device at the start).
      
      	Because the device strings can be changed, the sysfs routines
      	to display the strings must protect the string pointers by
      	locking the device.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Inaky Perez-Gonzalez <inaky@linux.intel.com>
      Acked-by: default avatarDavid Vrabel <david.vrabel@csr.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      da307123
  4. 11 Dec, 2009 3 commits
    • Alan Stern's avatar
      USB: prepare for changover to Runtime PM framework · 8e4ceb38
      Alan Stern authored
      
      This patch (as1303) revises the USB Power Management infrastructure to
      make it compatible with the new driver-model Runtime PM framework:
      
      	Drivers are no longer allowed to access intf->pm_usage_cnt
      	directly; the PM framework manages its own usage counters.
      
      	usb_autopm_set_interface() is eliminated, because it directly
      	sets intf->pm_usage_cnt.
      
      	usb_autopm_enable() and usb_autopm_disable() are eliminated,
      	because they call usb_autopm_set_interface().
      
      	usb_autopm_get_interface_no_resume() and
      	usb_autopm_put_interface_no_suspend() are added.  They
      	correspond to pm_runtime_get_noresume() and
      	pm_runtime_put_noidle() in the PM framework.
      
      	The power/level attribute no longer accepts "suspend", only
      	"on" and "auto".  The PM framework doesn't allow devices to be
      	forced into a suspended mode.
      
      The hub driver contains the only code that violates the new
      guidelines.  It is updated to use the new interface routines instead.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8e4ceb38
    • Greg Kroah-Hartman's avatar
      USB: add devpath sysfs attribute · 9af23624
      Greg Kroah-Hartman authored
      
      This is not exported from the usb core, yet we rely on it to create
      paths to interfaces for this device in sysfs.  Export it to make
      userspace tools have an easier time to figure things out.
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9af23624
    • Alan Stern's avatar
      USB: add a "remove hardware" sysfs attribute · 253e0572
      Alan Stern authored
      
      This patch (as1297) adds a "remove" attribute to each USB device's
      directory in sysfs.  Writing to this attribute causes the device to be
      deconfigured (the same as writing 0 to the "bConfigurationValue"
      attribute) and then tells the hub driver to disable the device's
      upstream port.  The device remains locked during these activities so
      there is no possibility of it getting reconfigured in between.  The
      port will remain disabled until after the device is unplugged.
      
      The purpose of this is to provide a means for user programs to imitate
      the "Safely remove hardware" applet in Windows.  Some devices do
      expect their ports to be disabled before they are unplugged, and they
      provide visual feedback to users indicating when they can safely be
      unplugged.
      
      The security implications are minimal.  Writing to the "remove"
      attribute is no more dangerous than writing to the
      "bConfigurationValue" attribute.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: David Zeuthen <davidz@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      253e0572
  5. 15 Sep, 2009 1 commit
  6. 16 Jun, 2009 1 commit
  7. 24 Mar, 2009 1 commit
  8. 07 Jan, 2009 3 commits
    • Alan Stern's avatar
      USB: utilize the bus notifiers · 3b23dd6f
      Alan Stern authored
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3b23dd6f
    • Alan Stern's avatar
      USB: Enhance usage of pm_message_t · 65bfd296
      Alan Stern authored
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      65bfd296
    • Alan Stern's avatar
      USB: straighten out inline code in sysfs.c · 92b0da15
      Alan Stern authored
      
      This patch (as1156) straightens out some code in usbcore.  The
      usb_create_intf_ep_files() and usb_remove_intf_ep_files() routines
      don't need to be separate inlines; they should be moved bodily into
      the places where they get used.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      92b0da15
  9. 13 Nov, 2008 1 commit
    • Alan Stern's avatar
      USB: don't register endpoints for interfaces that are going away · 352d0263
      Alan Stern authored
      
      This patch (as1155) fixes a bug in usbcore.  When interfaces are
      deleted, either because the device was disconnected or because of a
      configuration change, the extra attribute files and child endpoint
      devices may get left behind.  This is because the core removes them
      before calling device_del().  But during device_del(), after the
      driver is unbound the core will reinstall altsetting 0 and recreate
      those extra attributes and children.
      
      The patch prevents this by adding a flag to record when the interface
      is in the midst of being unregistered.  When the flag is set, the
      attribute files and child devices will not be created.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org> [2.6.27, 2.6.26, 2.6.25]
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      352d0263
  10. 17 Oct, 2008 1 commit
  11. 29 May, 2008 1 commit
    • Alan Stern's avatar
      USB: add all configs to the "descriptors" attribute · 217a9081
      Alan Stern authored
      
      This patch (as1094) changes the output of the "descriptors" binary
      attribute.  Now it will contain the device descriptor followed by all
      the configuration descriptors, not just the descriptor for the current
      config.
      
      Userspace libraries want to have access to the kernel's cached
      descriptor information, so they can learn about device characteristics
      without having to wake up suspended devices.  So far the only user of
      this attribute is the new libusb-1.0 library; thus changing its
      contents shouldn't cause any problems.
      
      This should be considered for 2.6.26, if for no other reason than to
      minimize the range of releases in which the attribute contains only the
      current config descriptor.
      
      Also, it doesn't hurt that the patch removes the device locking --
      which was formerly needed in order to know for certain which config was
      indeed current.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      217a9081
  12. 14 May, 2008 1 commit
    • Alan Stern's avatar
      USB: create attributes before sending uevent · 2e5f10e4
      Alan Stern authored
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2e5f10e4
  13. 25 Apr, 2008 1 commit
  14. 01 Feb, 2008 2 commits
    • Greg Kroah-Hartman's avatar
      USB: fix codingstyle issues in drivers/usb/core/*.c · 2c044a48
      Greg Kroah-Hartman authored
      
      Fixes a number of coding style issues in the remaining .c files in
      drivers/usb/core/
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2c044a48
    • Sarah Sharp's avatar
      USB: Export suspend statistics · 15123006
      Sarah Sharp authored
      
      This patch exports two statistics to userspace:
      /sys/bus/usb/device/.../power/connected_duration
      /sys/bus/usb/device/.../power/active_duration
      
      connected_duration is the total time (in msec) that the device has
      been connected.  active_duration is the total time the device has not
      been suspended.  With these two statistics, tools like PowerTOP can
      calculate the percentage time that a device is active, i.e. not
      suspended or auto-suspended.
      
      Users can also use the active_duration to check if a device is actually
      autosuspended.  Currently, they can set power/level to auto and
      power/autosuspend to a positive timeout, but there's no way to know from
      userspace if a device was actually autosuspended without looking at the
      dmesg output.  These statistics will be useful in creating an automated
      userspace script to test autosuspend for USB devices.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      15123006
  15. 28 Nov, 2007 1 commit
  16. 12 Oct, 2007 2 commits
  17. 20 Jul, 2007 1 commit
    • Alan Stern's avatar
      USB: add "descriptors" binary sysfs attribute · 69d42a78
      Alan Stern authored
      
      This patch (as934) adds a new readonly binary sysfs attribute file
      called "descriptors" for each USB device.  The attribute contains the
      device descriptor followed by the raw descriptor entry (config plug
      subsidiary descriptors) for the current configuration.
      
      Having this information available in fixed-format binary makes life a
      lot easier for user programs by avoiding the need to open, read, and
      parse multiple sysfs text files.
      
      The information in this attribute file is much like that in usbfs's
      device file, but there are some significant differences:
      
      	The 2-byte fields in the device descriptor are left in
      	little-endian byte order, as they appear on the bus and
      	in the kernel.
      
      	Only one raw descriptor set is presented, that of the
      	current configuration.
      
      	Opening this file will not cause a suspended device to be
      	autoresumed.
      
      The last item in particular should be a big selling point for libusb,
      which currently forces all USB devices to be resumed as it scans the
      device tree.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: Dave Mielke <dave@mielke.cc>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      69d42a78
  18. 12 Jul, 2007 2 commits
    • Craig W. Nadler's avatar
      USB: add IAD support to usbfs and sysfs · 165fe97e
      Craig W. Nadler authored
      
      USB_IAD: Adds support for USB Interface Association Descriptors.
      
      This patch adds support to the USB host stack for parsing, storing, and
      displaying Interface Association Descriptors. In /proc/bus/usb/devices
      lines starting with A: show the fields in an IAD. In sysfs if an
      interface on a USB device is referenced by an IAD the following files
      will be added to the sysfs directory for that interface:
      iad_bFirstInterface, iad_bInterfaceCount, iad_bFunctionClass, and
      iad_bFunctionSubClass, iad_bFunctionProtocol
      Signed-off-by: default avatarCraig W. Nadler <craig@nadler.us>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      165fe97e
    • Alan Stern's avatar
      USB: add power/persist device attribute · b41a60ec
      Alan Stern authored
      
      This patch (as920) adds an extra level of protection to the
      USB-Persist facility.  Now it will apply by default only to hubs; for
      all other devices the user must enable it explicitly by setting the
      power/persist device attribute.
      
      The disconnect_all_children() routine in hub.c has been removed and
      its code placed inline.  This is the way it was originally as part of
      hub_pre_reset(); the revised usage in hub_reset_resume() is
      sufficiently different that the code can no longer be shared.
      Likewise, mark_children_for_reset() is now inline as part of
      hub_reset_resume().  The end result looks much cleaner than before.
      
      The sysfs interface is updated to add the new attribute file, and
      there are corresponding documentation updates.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b41a60ec
  19. 23 May, 2007 1 commit
  20. 27 Apr, 2007 3 commits
  21. 23 Feb, 2007 3 commits
  22. 16 Feb, 2007 1 commit
    • Alan Stern's avatar
      USB: unconfigure devices which have config 0 · 3f141e2a
      Alan Stern authored
      
      Some USB devices do have a configuration 0, in contravention of the
      USB spec.  Normally 0 is supposed to indicate that a device is
      unconfigured.
      
      While we can't change what the device is doing, we can change usbcore.
      This patch (as852) allows usb_set_configuration() to accept a config
      value of -1 as indicating that the device should be unconfigured.  The
      request actually sent to the device will still contain 0 as the value.
      But even if the device does have a configuration 0, dev->actconfig
      will be set to NULL and dev->state will be set to USB_STATE_ADDRESS.
      
      Without some sort of special-case handling like this, there is no way
      to unconfigure these non-compliant devices.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3f141e2a
  23. 07 Feb, 2007 1 commit
  24. 27 Sep, 2006 2 commits
  25. 30 Jun, 2006 1 commit
  26. 21 Jun, 2006 2 commits
  27. 17 Nov, 2005 1 commit