usb: gadget: audio: queue wLength-sized requests
authorFelipe Balbi <balbi@ti.com>
Mon, 29 Aug 2011 08:54:08 +0000 (11:54 +0300)
committerFelipe Balbi <balbi@ti.com>
Fri, 9 Sep 2011 10:06:06 +0000 (13:06 +0300)
On Audio class, the wLength field of the Setup
packet, contains the data payload size of the
following Data phase. Instead of harcoding values,
use wLength.

This also fixes a bug where Gadget driver had to
receive 3 bytes, but it was queueing a ZLP.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/f_audio.c

index ddeaa45cd886fa056daff623baae1d4f0f0ecdc4..ec7ffcd0d0cd7e9a0a42bb1b859b9f71b5c96212 100644 (file)
@@ -460,7 +460,7 @@ static int audio_set_endpoint_req(struct usb_function *f,
 
        switch (ctrl->bRequest) {
        case UAC_SET_CUR:
-               value = 0;
+               value = len;
                break;
 
        case UAC_SET_MIN:
@@ -499,7 +499,7 @@ static int audio_get_endpoint_req(struct usb_function *f,
        case UAC_GET_MIN:
        case UAC_GET_MAX:
        case UAC_GET_RES:
-               value = 3;
+               value = len;
                break;
        case UAC_GET_MEM:
                break;