usb: gadget: f_rndis: handle the packet filter class request

This patch handles the class specific control request
"USB_CDC_SET_ETHERNET_PACKET_FILTER" for rndis. Actually,
the cdc_filter is not rndis specific, so we don't really
set the cdc_filter to the wValue of setup request for
rndis, and just return value 0 for the setup request to
avoid usb controllers stall ep0.

Change-Id: I42f9835a9812b8dfa640562b8555bc5f9b022256
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
William Wu
2020-08-26 11:02:21 +08:00
committed by Tao Huang
parent ac1ed698c3
commit adc23c13ff

View File

@@ -512,6 +512,20 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
}
break;
case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8)
| USB_CDC_SET_ETHERNET_PACKET_FILTER:
/*
* see 6.2.30: no data, wIndex = interface, wValue = packet
* filter bitmap. However, we don't really set cdc_filter to
* wValue for rndis, because cdc_filter is not RNDIS-specific.
* Return value 0 to avoid usb controllers stall ep0.
*/
if (w_length != 0 || w_index != rndis->ctrl_id)
goto invalid;
DBG(cdev, "packet filter %02x\n", w_value);
value = 0;
break;
default:
invalid:
VDBG(cdev, "invalid control req%02x.%02x v%04x i%04x l%d\n",