aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2012-05-13 12:34:59 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-14 09:30:40 -0700
commite6bbcef0211ed75db1ca3017551a584aed4e00be (patch)
tree67143d849f6338e2398fad06b2ca9a97534608da /drivers/usb/core
parentFunctionFS: enable multiple functions (diff)
downloadlinux-dev-e6bbcef0211ed75db1ca3017551a584aed4e00be.tar.xz
linux-dev-e6bbcef0211ed75db1ca3017551a584aed4e00be.zip
USB: let both new_id and remove_id show dynamic id list
This enables the current list of dynamic IDs to be read out through either new_id or remove_id. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/driver.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 112a7ae5095c..69919b257775 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -79,6 +79,23 @@ 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)
{
@@ -86,7 +103,7 @@ static ssize_t store_new_id(struct device_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
@@ -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)
{