diff options
author | Mayank Rana <mrana@codeaurora.org> | 2016-03-10 18:54:45 -0800 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:23:38 -0700 |
commit | 8a5f10b62532431e642abe556b7ea937803e1978 (patch) | |
tree | 63000aa5629203d61104e5313ac5b04ce3e9a223 /drivers/usb | |
parent | 28fabd5ee2b10fb07e2dae96492af2afe25ff466 (diff) |
usb: gadget: qdss: Add attribute to allow debug interface
This change adds attribute with USB QDSS instance to allow
enable/disable debug interface.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/function/f_qdss.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_qdss.c b/drivers/usb/gadget/function/f_qdss.c index 5f557fd445f1..8e04d9451b67 100644 --- a/drivers/usb/gadget/function/f_qdss.c +++ b/drivers/usb/gadget/function/f_qdss.c @@ -918,7 +918,41 @@ static struct configfs_item_operations qdss_item_ops = { .release = qdss_attr_release, }; +static ssize_t qdss_enable_debug_inface_show(struct config_item *item, + char *page) +{ + return snprintf(page, PAGE_SIZE, "%s\n", + (to_f_qdss_opts(item)->usb_qdss->debug_inface_enabled == 1) ? + "Enabled" : "Disabled"); +} + +static ssize_t qdss_enable_debug_inface_store(struct config_item *item, + const char *page, size_t len) +{ + struct f_qdss *qdss = to_f_qdss_opts(item)->usb_qdss; + unsigned long flags; + u8 stats; + + if (page == NULL) { + pr_err("Invalid buffer"); + return len; + } + + if (kstrtou8(page, 0, &stats) != 0 && (stats != 0 || stats != 1)) { + pr_err("(%u)Wrong value. enter 0 to disable or 1 to enable.\n", + stats); + return len; + } + + spin_lock_irqsave(&qdss->lock, flags); + qdss->debug_inface_enabled = (stats == 1 ? "true" : "false"); + spin_unlock_irqrestore(&qdss->lock, flags); + return len; +} + +CONFIGFS_ATTR(qdss_, enable_debug_inface); static struct configfs_attribute *qdss_attrs[] = { + &qdss_attr_enable_debug_inface, NULL, }; |