diff options
author | Oliver Neukum <oliver@neukum.org> | 2010-01-15 19:33:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:53:23 -0500 |
commit | ef955341f692475236f0fbe6853f49337dff77a5 (patch) | |
tree | 782c8677ba375ada558578fefe5321c84c5b4dff /drivers | |
parent | 5d3987796c7a747e5ed3ded1eb64a9632d52a1a4 (diff) |
USB: Export QUIRK_RESET_MORPHS through sysfs
Some devices which use mode switching revert to their
primary mode as they are reset. They must not be reset for
error handling. As user spaces makes the switch it also
has to tell the kernel that a device is quirky.
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/sysfs.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 5f3908f6e2dc..b1725abf6c7b 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -191,6 +191,36 @@ show_quirks(struct device *dev, struct device_attribute *attr, char *buf) | |||
191 | static DEVICE_ATTR(quirks, S_IRUGO, show_quirks, NULL); | 191 | static DEVICE_ATTR(quirks, S_IRUGO, show_quirks, NULL); |
192 | 192 | ||
193 | static ssize_t | 193 | static ssize_t |
194 | show_avoid_reset_quirk(struct device *dev, struct device_attribute *attr, char *buf) | ||
195 | { | ||
196 | struct usb_device *udev; | ||
197 | |||
198 | udev = to_usb_device(dev); | ||
199 | return sprintf(buf, "%d\n", !!(udev->quirks & USB_QUIRK_RESET_MORPHS)); | ||
200 | } | ||
201 | |||
202 | static ssize_t | ||
203 | set_avoid_reset_quirk(struct device *dev, struct device_attribute *attr, | ||
204 | const char *buf, size_t count) | ||
205 | { | ||
206 | struct usb_device *udev = to_usb_device(dev); | ||
207 | int config; | ||
208 | |||
209 | if (sscanf(buf, "%d", &config) != 1 || config < 0 || config > 1) | ||
210 | return -EINVAL; | ||
211 | usb_lock_device(udev); | ||
212 | if (config) | ||
213 | udev->quirks |= USB_QUIRK_RESET_MORPHS; | ||
214 | else | ||
215 | udev->quirks &= ~USB_QUIRK_RESET_MORPHS; | ||
216 | usb_unlock_device(udev); | ||
217 | return count; | ||
218 | } | ||
219 | |||
220 | static DEVICE_ATTR(avoid_reset_quirk, S_IRUGO | S_IWUSR, | ||
221 | show_avoid_reset_quirk, set_avoid_reset_quirk); | ||
222 | |||
223 | static ssize_t | ||
194 | show_urbnum(struct device *dev, struct device_attribute *attr, char *buf) | 224 | show_urbnum(struct device *dev, struct device_attribute *attr, char *buf) |
195 | { | 225 | { |
196 | struct usb_device *udev; | 226 | struct usb_device *udev; |
@@ -558,6 +588,7 @@ static struct attribute *dev_attrs[] = { | |||
558 | &dev_attr_version.attr, | 588 | &dev_attr_version.attr, |
559 | &dev_attr_maxchild.attr, | 589 | &dev_attr_maxchild.attr, |
560 | &dev_attr_quirks.attr, | 590 | &dev_attr_quirks.attr, |
591 | &dev_attr_avoid_reset_quirk.attr, | ||
561 | &dev_attr_authorized.attr, | 592 | &dev_attr_authorized.attr, |
562 | &dev_attr_remove.attr, | 593 | &dev_attr_remove.attr, |
563 | NULL, | 594 | NULL, |