[PATCH v4 09/12] libusbg: Initialize gadget attributes and strings while gadget creation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix gadget_create_gadget function to initialize gadget attributes
and strings with default values provided by kernel.

Change-Id: I8086c575fae0a122d3ff7053defa592dba5369ea
Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
 src/usbg.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/usbg.c b/src/usbg.c
index baeb86f..0df2f7d 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -520,8 +520,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) {
@@ -533,6 +531,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))
-- 
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux