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-03-22 11:19:10 +0100
commit30ba310824bf3467ffb92f6a13df2c6cf7d0b6ed (patch)
treeb2873fa38c7706c85ab0761bcfe53da6ab64cfc3
parent3dc49fa3e33e731e9f56b83e65b99ac7a894577b (diff)
downloaddevice-manager-plugin-odroid-30ba310824bf3467ffb92f6a13df2c6cf7d0b6ed.tar.gz
device-manager-plugin-odroid-30ba310824bf3467ffb92f6a13df2c6cf7d0b6ed.tar.bz2
device-manager-plugin-odroid-30ba310824bf3467ffb92f6a13df2c6cf7d0b6ed.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;