summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Szewczyk <p.szewczyk@samsung.com>2018-03-15 18:51:51 +0100
committerPaweł Szewczyk <p.szewczyk@samsung.com>2018-04-09 14:23:55 +0200
commit935068a130dae941bb5abed0249fbe7e033f8d99 (patch)
treeecf620ff310a90c0a1a7034839a88c28ab9fd00c
parent1624d9ddfd5efc5b298b38630a6cb40456158994 (diff)
downloaddevice-manager-plugin-artik-935068a130dae941bb5abed0249fbe7e033f8d99.tar.gz
device-manager-plugin-artik-935068a130dae941bb5abed0249fbe7e033f8d99.tar.bz2
device-manager-plugin-artik-935068a130dae941bb5abed0249fbe7e033f8d99.zip
usb: Assign new functions to legacy gadget
Change-Id: I86df0d0db29813781c8b49dc111f726b24b82041 Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
-rw-r--r--hw/usb_client/usb_client.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/usb_client/usb_client.c b/hw/usb_client/usb_client.c
index 824e562..0f1effe 100644
--- a/hw/usb_client/usb_client.c
+++ b/hw/usb_client/usb_client.c
@@ -278,6 +278,7 @@ static int legacy_read_config(struct usb_gadget *gadget,
char *sep = LEGACY_FUNC_SEP;
int i, f_cnt;
int f_idx;
+ int g_f_idx;
int ret;
ret = sys_get_str(cpath, buf, sizeof(buf));
@@ -301,6 +302,8 @@ static int legacy_read_config(struct usb_gadget *gadget,
if (ret)
return ret;
+ for (g_f_idx = 0; gadget->funcs[g_f_idx]; ++g_f_idx);
+
f_idx = 0;
for (fname = strsep(&begin, sep); fname; fname = strsep(&begin, sep)) {
struct usb_function *func;
@@ -311,6 +314,8 @@ static int legacy_read_config(struct usb_gadget *gadget,
ret = legacy_alloc_new_func(gadget, fname, &func);
if (ret)
goto free_config;
+
+ gadget->funcs[g_f_idx++] = func;
}
config->funcs[f_idx++] = func;