Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303939
b: refs/heads/master
c: e6bbcef
h: refs/heads/master
i:
  303937: 8217d45
  303935: 9a32d3d
v: v3
  • Loading branch information
Bjørn Mork authored and Greg Kroah-Hartman committed May 14, 2012
1 parent a92b4a9 commit c66b93e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 581791f5c7a480b2cc3431af9a6e799ffd51eb5e
refs/heads/master: e6bbcef0211ed75db1ca3017551a584aed4e00be
15 changes: 15 additions & 0 deletions trunk/Documentation/ABI/testing/sysfs-bus-usb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ Description:
for the device and attempt to bind to it. For example:
# echo "8086 10f5" > /sys/bus/usb/drivers/foo/new_id

Reading from this file will list all dynamically added
device IDs in the same format, with one entry per
line. For example:
# cat /sys/bus/usb/drivers/foo/new_id
8086 10f5
dead beef 06
f00d cafe

The list will be truncated at PAGE_SIZE bytes due to
sysfs restrictions.

What: /sys/bus/usb-serial/drivers/.../new_id
Date: October 2011
Contact: linux-usb@vger.kernel.org
Expand All @@ -157,6 +168,10 @@ Description:
match the driver to the device. For example:
# echo "046d c315" > /sys/bus/usb/drivers/foo/remove_id

Reading from this file will list the dynamically added
device IDs, exactly like reading from the entry
"/sys/bus/usb/drivers/.../new_id"

What: /sys/bus/usb/device/.../avoid_reset_quirk
Date: December 2009
Contact: Oliver Neukum <oliver@neukum.org>
Expand Down
21 changes: 19 additions & 2 deletions trunk/drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,31 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
}
EXPORT_SYMBOL_GPL(usb_store_new_id);

static ssize_t show_dynids(struct device_driver *driver, char *buf)
{
struct usb_dynid *dynid;
struct usb_driver *usb_drv = to_usb_driver(driver);
size_t count = 0;

list_for_each_entry(dynid, &usb_drv->dynids.list, node)
if (dynid->id.bInterfaceClass != 0)
count += scnprintf(&buf[count], PAGE_SIZE - count, "%04x %04x %02x\n",
dynid->id.idVendor, dynid->id.idProduct,
dynid->id.bInterfaceClass);
else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%04x %04x\n",
dynid->id.idVendor, dynid->id.idProduct);
return count;
}

static ssize_t store_new_id(struct device_driver *driver,
const char *buf, size_t count)
{
struct usb_driver *usb_drv = to_usb_driver(driver);

return usb_store_new_id(&usb_drv->dynids, driver, buf, count);
}
static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
static DRIVER_ATTR(new_id, S_IRUGO | S_IWUSR, show_dynids, store_new_id);

/**
* store_remove_id - remove a USB device ID from this driver
Expand Down Expand Up @@ -127,7 +144,7 @@ store_remove_id(struct device_driver *driver, const char *buf, size_t count)
return retval;
return count;
}
static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id);
static DRIVER_ATTR(remove_id, S_IRUGO | S_IWUSR, show_dynids, store_remove_id);

static int usb_create_newid_files(struct usb_driver *usb_drv)
{
Expand Down

0 comments on commit c66b93e

Please sign in to comment.