summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/usb.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-10-27 15:20:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 11:55:18 -0800
commit253e05724f9230910344357b1142ad8642ff9f5a (patch)
treeff29ac01c681b183db2ad4b18b95b6c3dbe0ca0b /drivers/usb/core/usb.h
parentd697cdda43939a80432863e2e26df6701ce72b63 (diff)
downloadlinux-253e05724f9230910344357b1142ad8642ff9f5a.tar.gz
linux-253e05724f9230910344357b1142ad8642ff9f5a.tar.bz2
linux-253e05724f9230910344357b1142ad8642ff9f5a.zip
USB: add a "remove hardware" sysfs attribute
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: Alan Stern <stern@rowland.harvard.edu> Cc: David Zeuthen <davidz@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/usb.h')
-rw-r--r--drivers/usb/core/usb.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 9a8b15e6377a..4c36c7f512a0 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -24,6 +24,7 @@ extern void usb_disable_device(struct usb_device *dev, int skip_ep0);
extern int usb_deauthorize_device(struct usb_device *);
extern int usb_authorize_device(struct usb_device *);
extern void usb_detect_quirks(struct usb_device *udev);
+extern int usb_remove_device(struct usb_device *udev);
extern int usb_get_device_descriptor(struct usb_device *dev,
unsigned int size);