Commit c8933c3f authored by Daniel Mack's avatar Daniel Mack Committed by Felipe Balbi

USB: gadget: f_midi: allow a dynamic number of input and output ports

The code in the MIDI gadget was already sort of prepared for multi-port
configuration, so the streaming logic itself didn't need much tweaking.
However, the descriptors change when the number of ports do, and so some
rework of the the preparation algorithms were necessary.

Successfully tested on Linux and Max OS X hosts for both input and
output streams.
Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 2672eea5
This diff is collapsed.
...@@ -66,6 +66,14 @@ static unsigned int qlen = 32; ...@@ -66,6 +66,14 @@ static unsigned int qlen = 32;
module_param(qlen, uint, S_IRUGO); module_param(qlen, uint, S_IRUGO);
MODULE_PARM_DESC(qlen, "USB read request queue length"); MODULE_PARM_DESC(qlen, "USB read request queue length");
static unsigned int in_ports = 1;
module_param(in_ports, uint, S_IRUGO);
MODULE_PARM_DESC(in_ports, "Number of MIDI input ports");
static unsigned int out_ports = 1;
module_param(out_ports, uint, S_IRUGO);
MODULE_PARM_DESC(out_ports, "Number of MIDI output ports");
/* Thanks to Grey Innovation for donating this product ID. /* Thanks to Grey Innovation for donating this product ID.
* *
* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
...@@ -124,7 +132,9 @@ static struct usb_configuration midi_config = { ...@@ -124,7 +132,9 @@ static struct usb_configuration midi_config = {
static int __init midi_bind_config(struct usb_configuration *c) static int __init midi_bind_config(struct usb_configuration *c)
{ {
return f_midi_bind_config(c, index, id, buflen, qlen); return f_midi_bind_config(c, index, id,
in_ports, out_ports,
buflen, qlen);
} }
static int __init midi_bind(struct usb_composite_dev *cdev) static int __init midi_bind(struct usb_composite_dev *cdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment