Commit 7f2a9268 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Felipe Balbi

usb: gadget: midi: make FS and HS available

This function works only on FS or HS. If the gadget is HS capable only
HS descriptors are assigned. If we plug it to an 1.1 host it won't work
because we have only 2.0 descriptors. This patch changes the behavior to
provide both sets.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent d185039f
...@@ -882,18 +882,24 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -882,18 +882,24 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f)
* both speeds * both speeds
*/ */
/* copy descriptors, and track endpoint copies */ /* copy descriptors, and track endpoint copies */
f->descriptors = usb_copy_descriptors(midi_function);
if (!f->descriptors)
goto fail_f_midi;
if (gadget_is_dualspeed(c->cdev->gadget)) { if (gadget_is_dualspeed(c->cdev->gadget)) {
bulk_in_desc.wMaxPacketSize = cpu_to_le16(512); bulk_in_desc.wMaxPacketSize = cpu_to_le16(512);
bulk_out_desc.wMaxPacketSize = cpu_to_le16(512); bulk_out_desc.wMaxPacketSize = cpu_to_le16(512);
f->hs_descriptors = usb_copy_descriptors(midi_function); f->hs_descriptors = usb_copy_descriptors(midi_function);
} else { if (!f->hs_descriptors)
f->descriptors = usb_copy_descriptors(midi_function); goto fail_f_midi;
} }
kfree(midi_function); kfree(midi_function);
return 0; return 0;
fail_f_midi:
kfree(midi_function);
usb_free_descriptors(f->hs_descriptors);
fail: fail:
/* we might as well release our claims on endpoints */ /* we might as well release our claims on endpoints */
if (midi->out_ep) if (midi->out_ep)
......
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