[PATCH 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.

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

diff --git a/src/gadget.c b/src/gadget.c
index 04fe46b..050bea5 100644
--- a/src/gadget.c
+++ b/src/gadget.c
@@ -521,8 +521,6 @@ struct gadget *gadget_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) {
@@ -534,6 +532,9 @@ struct gadget *gadget_create_gadget(struct state *s, char *name,
 	gadget_write_hex16(s->path, name, "idVendor", vendor);
 	gadget_write_hex16(s->path, name, "idProduct", product);
 
+	gadget_parse_attrs(s->path, g);
+	gadget_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