From: "Felipe F. Tonello" <eu@felipetonello.com>
To: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Felipe Balbi <balbi@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Robert Baldyga <r.baldyga@samsung.com>
Subject: [PATCH] usb: gadget: gmidi: remove bus powered requirement on bmAttributes
Date: Fri, 15 Jan 2016 12:50:49 +0000 [thread overview]
Message-ID: <1452862249-29853-1-git-send-email-eu@felipetonello.com> (raw)
This gadget uses a bmAttributes and MaxPower that requires the USB bus to be
powered from the host, which is not correct because this configuration is device
specific, not a USB-MIDI requirement.
This patch adds two modules parameters, bmAttributes and MaxPower, that allows
the user to set those flags. The default values are what the gadget used to use
for backward compatibility.
Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
drivers/usb/gadget/legacy/gmidi.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/legacy/gmidi.c b/drivers/usb/gadget/legacy/gmidi.c
index fc2ac150f5ff..0553435cc360 100644
--- a/drivers/usb/gadget/legacy/gmidi.c
+++ b/drivers/usb/gadget/legacy/gmidi.c
@@ -63,6 +63,14 @@ static unsigned int out_ports = 1;
module_param(out_ports, uint, S_IRUGO);
MODULE_PARM_DESC(out_ports, "Number of MIDI output ports");
+static unsigned int bmAttributes = USB_CONFIG_ATT_ONE;
+module_param(bmAttributes, uint, S_IRUGO);
+MODULE_PARM_DESC(bmAttributes, "Configuration Descriptor's bmAttributes parameter");
+
+static unsigned int MaxPower = CONFIG_USB_GADGET_VBUS_DRAW;
+module_param(MaxPower, uint, S_IRUGO);
+MODULE_PARM_DESC(MaxPower, "Used to calculate Configuration Descriptor's bMaxPower parameter");
+
/* Thanks to Grey Innovation for donating this product ID.
*
* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
@@ -119,8 +127,8 @@ static struct usb_configuration midi_config = {
.label = "MIDI Gadget",
.bConfigurationValue = 1,
/* .iConfiguration = DYNAMIC */
- .bmAttributes = USB_CONFIG_ATT_ONE,
- .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW,
+ /* .bmAttributes = DYNAMIC */
+ /* .MaxPower = DYNAMIC */
};
static int midi_bind_config(struct usb_configuration *c)
@@ -163,6 +171,8 @@ static int midi_bind(struct usb_composite_dev *cdev)
device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id;
device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
midi_config.iConfiguration = strings_dev[STRING_DESCRIPTION_IDX].id;
+ midi_config.bmAttributes = bmAttributes;
+ midi_config.MaxPower = MaxPower;
status = usb_add_config(cdev, &midi_config, midi_bind_config);
if (status < 0)
--
2.7.0
reply other threads:[~2016-01-15 12:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452862249-29853-1-git-send-email-eu@felipetonello.com \
--to=eu@felipetonello.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=r.baldyga@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®