From c8933c3f79568263c90a46f06cf80419e6c63c97 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 28 Sep 2011 16:41:34 +0200 Subject: 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: Daniel Mack Cc: Greg Kroah-Hartman Signed-off-by: Felipe Balbi --- drivers/usb/gadget/gmidi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'drivers/usb/gadget/gmidi.c') diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c index e7c8c3907133..8fcde37aa6d4 100644 --- a/drivers/usb/gadget/gmidi.c +++ b/drivers/usb/gadget/gmidi.c @@ -66,6 +66,14 @@ static unsigned int qlen = 32; module_param(qlen, uint, S_IRUGO); 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. * * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! @@ -124,7 +132,9 @@ static struct usb_configuration midi_config = { 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) -- cgit v1.2.3