Gadget attributes and strings are logically independent, so they should be initialized in separate functions. Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx> --- src/usbg.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/usbg.c b/src/usbg.c index 341af61..baeb86f 100644 --- a/src/usbg.c +++ b/src/usbg.c @@ -313,9 +313,6 @@ static int usbg_parse_configs(char *path, struct gadget *g) static void usbg_parse_attrs(char *path, struct gadget *g) { - /* UDC bound to, if any */ - usbg_read_string(path, g->name, "UDC", g->udc); - /* Actual attributes */ g->dclass = usbg_read_hex(path, g->name, "bDeviceClass"); g->dsubclass = usbg_read_hex(path, g->name, "bDeviceSubClass"); @@ -325,7 +322,10 @@ static void usbg_parse_attrs(char *path, struct gadget *g) g->bcdusb = usbg_read_hex(path, g->name, "bcdUSB"); g->vendor = usbg_read_hex(path, g->name, "idVendor"); g->product = usbg_read_hex(path, g->name, "idProduct"); +} +static void usbg_parse_strings(char *path, struct gadget *g) +{ /* Strings - hardcoded to U.S. English only for now */ usbg_read_string(path, g->name, "strings/0x409/serialnumber", g->str_ser); usbg_read_string(path, g->name, "strings/0x409/manufacturer", g->str_mnf); @@ -346,7 +346,10 @@ static int usbg_parse_gadgets(char *path, struct state *s) strcpy(g->name, dent[i]->d_name); strcpy(g->path, s->path); g->parent = s; - usbg_parse_attrs(path, g); + /* UDC bound to, if any */ + usbg_read_string(path, g->name, "UDC", g->udc); + usbg_parse_configs(path, g); + usbg_parse_strings(path, g); usbg_parse_functions(path, g); usbg_parse_configs(path, g); TAILQ_INSERT_TAIL(&s->gadgets, g, gnode); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html