From: Krzysztof Opasiak Date: Mon, 16 Dec 2013 10:00:26 +0000 (+0100) Subject: libusbgx: Initialize gadget attributes and strings while gadget creation. X-Git-Tag: libusbgx-v0.1.0~262 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=301666cb3c31fdf267bda5f1390f37ca06ffe069;p=platform%2Fupstream%2Flibusbg.git libusbgx: Initialize gadget attributes and strings while gadget creation. Fix gadget_create_gadget function to initialize gadget attributes and strings with default values provided by kernel. Signed-off-by: Krzysztof Opasiak [Port from libusbg and update description] Signed-off-by: Krzysztof Opasiak --- diff --git a/src/usbg.c b/src/usbg.c index 11a9abf..9ee3d35 100644 --- a/src/usbg.c +++ b/src/usbg.c @@ -526,8 +526,6 @@ struct gadget *usbg_create_gadget(struct state *s, char *name, strcpy(g->name, name); sprintf(g->path, "%s", s->path); g->parent = s; - g->vendor = vendor; - g->product = product; ret = mkdir(gpath, S_IRWXU|S_IRWXG|S_IRWXO); if (ret < 0) { @@ -539,6 +537,9 @@ struct gadget *usbg_create_gadget(struct state *s, char *name, usbg_write_hex16(s->path, name, "idVendor", vendor); usbg_write_hex16(s->path, name, "idProduct", product); + usbg_parse_attrs(s->path, g); + usbg_parse_strings(s->path, g); + /* Insert in string order */ if (TAILQ_EMPTY(&s->gadgets) || (strcmp(name, TAILQ_FIRST(&s->gadgets)->name) < 0))