diff options
author | ryan_chu <ryan_chu@htc.com> | 2017-08-27 14:44:17 +0800 |
---|---|---|
committer | Thierry Strudel <tstrudel@google.com> | 2017-08-29 04:27:22 +0000 |
commit | 845c8307ee66169314faa4ac27870f58647e18e0 (patch) | |
tree | c1de57eb0b894b5173cb78a55f9256dc39ffe054 | |
parent | 6429d85034c52b9a539fb5a58204b4c95b79f9ca (diff) |
usb: gadget: Update default class subclass and protocol for rndisandroid-8.0.0_r0.21
BUG: 64469070
Change-Id: I503a5573af71eb1b004c68abb64bb04d7e06f9af
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
-rw-r--r-- | drivers/usb/gadget/function/f_gsi.c | 40 | ||||
-rw-r--r-- | drivers/usb/gadget/function/f_gsi.h | 13 |
2 files changed, 47 insertions, 6 deletions
diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index 7216fdd4245d..17e8970defe3 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -2501,6 +2501,16 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f) DEFAULT_PKT_ALIGNMENT_FACTOR); rndis_set_pkt_alignment_factor(gsi->params, DEFAULT_PKT_ALIGNMENT_FACTOR); + if(gsi->rndis_use_wceis) { + info.iad_desc->bFunctionClass = + USB_CLASS_WIRELESS_CONTROLLER; + info.iad_desc->bFunctionSubClass = 0x01; + info.iad_desc->bFunctionProtocol = 0x03; + info.ctrl_desc->bInterfaceClass = + USB_CLASS_WIRELESS_CONTROLLER; + info.ctrl_desc->bInterfaceSubClass = 0x1; + info.ctrl_desc->bInterfaceProtocol = 0x03; + } break; case IPA_USB_MBIM: info.string_defs = mbim_gsi_string_defs; @@ -2980,8 +2990,38 @@ static ssize_t gsi_info_show(struct config_item *item, char *page) CONFIGFS_ATTR_RO(gsi_, info); +static ssize_t gsi_rndis_wceis_show(struct config_item *item, char *page) +{ + int ret; + struct f_gsi *gsi = to_gsi_opts(item)->gsi; + + ret = sprintf(page, "%d\n",gsi->rndis_use_wceis); + return 0; +} + +static ssize_t gsi_rndis_wceis_store(struct config_item *item, + const char *page, size_t len) +{ + struct f_gsi *gsi = to_gsi_opts(item)->gsi; + u8 val = 0; + int ret; + + ret = kstrtou8(page, 0, &val); + if( ret !=0 || val > 1) { + pr_err("Wrong value written to wceis attr(%u)\n", val); + return len; + } + + gsi->rndis_use_wceis = val; + + return len; +} + +CONFIGFS_ATTR(gsi_, rndis_wceis); + static struct configfs_attribute *gsi_attrs[] = { &gsi_attr_info, + &gsi_attr_rndis_wceis, NULL, }; diff --git a/drivers/usb/gadget/function/f_gsi.h b/drivers/usb/gadget/function/f_gsi.h index 262a60e8a450..14490ab296c2 100644 --- a/drivers/usb/gadget/function/f_gsi.h +++ b/drivers/usb/gadget/function/f_gsi.h @@ -237,6 +237,7 @@ struct f_gsi { struct rndis_params *params; atomic_t connected; bool data_interface_up; + bool rndis_use_wceis; const struct usb_endpoint_descriptor *in_ep_desc_backup; const struct usb_endpoint_descriptor *out_ep_desc_backup; @@ -470,9 +471,9 @@ static struct usb_interface_descriptor rndis_gsi_control_intf = { /* .bInterfaceNumber = DYNAMIC */ /* status endpoint is optional; this could be patched later */ .bNumEndpoints = 1, - .bInterfaceClass = USB_CLASS_WIRELESS_CONTROLLER, - .bInterfaceSubClass = 0x01, - .bInterfaceProtocol = 0x03, + .bInterfaceClass = USB_CLASS_MISC, + .bInterfaceSubClass = 0x04, + .bInterfaceProtocol = 0x01, /* RNDIS over Ethernet */ /* .iInterface = DYNAMIC */ }; @@ -530,9 +531,9 @@ rndis_gsi_iad_descriptor = { .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, .bFirstInterface = 0, /* XXX, hardcoded */ .bInterfaceCount = 2, /* control + data */ - .bFunctionClass = USB_CLASS_WIRELESS_CONTROLLER, - .bFunctionSubClass = 0x01, - .bFunctionProtocol = 0x03, + .bFunctionClass = USB_CLASS_MISC, + .bFunctionSubClass = 0x04, + .bFunctionProtocol = 0x01, /* RNDIS over Ethernet */ /* .iFunction = DYNAMIC */ }; |