summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINSUN PYO <insun.pyo@samsung.com>2020-02-21 11:04:08 (GMT)
committerINSUN PYO <insun.pyo@samsung.com>2020-03-03 00:28:32 (GMT)
commitc25a5cb3051a61f5266ebb27a52a85ca2a933e5a (patch)
tree39b33c24e75a12840bfe257e03faef74db58edd2
parent8e69d4788634bd1a0fe1e6f873217ed6627eda0d (diff)
downloadlibdevice-node-c25a5cb3051a61f5266ebb27a52a85ca2a933e5a.zip
libdevice-node-c25a5cb3051a61f5266ebb27a52a85ca2a933e5a.tar.gz
libdevice-node-c25a5cb3051a61f5266ebb27a52a85ca2a933e5a.tar.bz2
usb mode supported ///////////////////////////////////////////////////////////////////////////////////////////////////////// {SET_USB_DEFAULT, USB_FUNCTION_MTP | USB_FUNCTION_ACM} {SET_USB_SDB, USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB} {SET_USB_NONE, USB_FUNCTION_NONE} {SET_USB_RNDIS, USB_FUNCTION_RNDIS} {SET_USB_RNDIS_DIAG, USB_FUNCTION_RNDIS | USB_FUNCTION_DIAG} {SET_USB_DIAG_RMNET, USB_FUNCTION_DIAG | USB_FUNCTION_RMNET} {SET_USB_ACM_SDB_DM, USB_FUNCTION_ACM | USB_FUNCTION_SDB | USB_FUNCTION_DM} {SET_USB_SDB_DIAG, USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB | USB_FUNCTION_DIAG} {SET_USB_DIAG_SDB, USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB | USB_FUNCTION_DIAG} {SET_USB_RNDIS_SDB, USB_FUNCTION_ACM | USB_FUNCTION_SDB | USB_FUNCTION_RNDIS} {SET_USB_RNDIS_TETHERING, USB_FUNCTION_ACM | USB_FUNCTION_SDB | USB_FUNCTION_RNDIS} {SET_USB_RNDIS_SDB_ACM, USB_FUNCTION_ACM | USB_FUNCTION_SDB | USB_FUNCTION_RNDIS} ///////////////////////////////////////////////////////////////////////////////////////////////////////// Change-Id: Ibec4c14fcde3e55d1b17cec1ba4e76884ddeaf6a (cherry picked from commit 6bbeb2c29ca623f148a3aefe5181580891183fec)
-rw-r--r--hw/usb_gadget_common.c57
1 files changed, 6 insertions, 51 deletions
diff --git a/hw/usb_gadget_common.c b/hw/usb_gadget_common.c
index fb6a986..a061084 100644
--- a/hw/usb_gadget_common.c
+++ b/hw/usb_gadget_common.c
@@ -211,14 +211,13 @@ static inline struct usb_function *find_func(struct usb_gadget *gadget,
static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
struct usb_gadget **_gadget)
{
- struct usb_gadget *gadget;
- int n_configs = 0;
- /* zero terminates */
- int functions[2][sizeof(gadget_id->function_mask)*8];
+ int ret;
+ int idx, i, j;
int n_functions;
+ int n_configs = 0;
+ struct usb_gadget *gadget;
struct usb_function **funcs;
- int idx, i, j;
- int ret;
+ int functions[2][sizeof(gadget_id->function_mask)*8]; /* zero terminates */
if (!gadget_id || !_gadget)
return -EINVAL;
@@ -235,27 +234,6 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
* so in this switch we sort our functions in a correct order
*/
switch (gadget_id->function_mask) {
- case USB_FUNCTION_MTP:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_MTP;
- functions[0][1] = 0;
- gadget->attrs.idProduct = 0x6860;
- break;
-
- case USB_FUNCTION_ACM:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_ACM;
- functions[0][1] = 0;
- gadget->attrs.idProduct = 0x6860;
- break;
-
- case USB_FUNCTION_SDB:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_SDB;
- functions[0][1] = 0;
- gadget->attrs.idProduct = 0x685d;
- break;
-
/* MTP, ACM, SDB */
case USB_FUNCTION_MTP | USB_FUNCTION_ACM:
n_configs = 1;
@@ -265,22 +243,6 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
gadget->attrs.idProduct = 0x6860;
break;
- case USB_FUNCTION_ACM | USB_FUNCTION_SDB:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_ACM;
- functions[0][1] = USB_FUNCTION_SDB;
- functions[0][2] = 0;
- gadget->attrs.idProduct = 0x6860;
- break;
-
- case USB_FUNCTION_MTP | USB_FUNCTION_SDB:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_MTP;
- functions[0][1] = USB_FUNCTION_SDB;
- functions[0][2] = 0;
- gadget->attrs.idProduct = 0x6860;
- break;
-
case USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB:
n_configs = 1;
functions[0][0] = USB_FUNCTION_MTP;
@@ -309,14 +271,6 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
gadget->attrs.idProduct = 0x6863;
break;
- case USB_FUNCTION_SDB | USB_FUNCTION_RNDIS:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_SDB;
- functions[0][1] = USB_FUNCTION_RNDIS;
- functions[0][2] = 0;
- gadget->attrs.idProduct = 0x6864;
- break;
-
case USB_FUNCTION_RNDIS | USB_FUNCTION_DIAG:
n_configs = 1;
functions[0][0] = USB_FUNCTION_RNDIS;
@@ -405,6 +359,7 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
*_gadget = gadget;
return 0;
+
free_configs:
free_functions:
free_gadget: