API of library has been changed, so it is necessary
to update examples of library usage.

Signed-off-by: Krzysztof Opasiak <k.opas...@samsung.com>
---
 examples/gadget-acm-ecm.c |   30 ++++++++++++++++++++++++------
 examples/show-gadgets.c   |    4 ++--
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/examples/gadget-acm-ecm.c b/examples/gadget-acm-ecm.c
index 93e0c06..b3c776d 100644
--- a/examples/gadget-acm-ecm.c
+++ b/examples/gadget-acm-ecm.c
@@ -36,20 +36,38 @@ int main(void)
        usbg_function *f_acm0, *f_acm1, *f_ecm;
        int ret = -EINVAL;
 
+       usbg_gadget_attrs g_attrs = {
+                       0x0200, /* bcdUSB */
+                       0x00, /* Defined at interface level */
+                       0x00, /* subclass */
+                       0x00, /* device protocol */
+                       0x0040, /* Max allowed packet size */
+                       VENDOR,
+                       PRODUCT,
+                       0x0001, /* Verson of device */
+       };
+
+       usbg_gadget_strs g_strs = {
+                       "0123456789", /* Serial number */
+                       "Foo Inc.", /* Manufacturer */
+                       "Bar Gadget" /* Product string */
+       };
+
+       usbg_config_strs c_strs = {
+                       "CDC 2xACM+ECM"
+       };
+
        s = usbg_init("/sys/kernel/config");
        if (!s) {
                fprintf(stderr, "Error on USB gadget init\n");
                goto out1;
        }
 
-       g = usbg_create_gadget_vid_pid(s, "g1", VENDOR, PRODUCT);
+       g = usbg_create_gadget(s, "g1", &g_attrs, &g_strs);
        if (!g) {
                fprintf(stderr, "Error on create gadget\n");
                goto out2;
        }
-       usbg_set_gadget_serial_number(g, LANG_US_ENG, "0123456789");
-       usbg_set_gadget_manufacturer(g, LANG_US_ENG, "Foo Inc.");
-       usbg_set_gadget_product(g, LANG_US_ENG, "Bar Gadget");
 
        f_acm0 = usbg_create_function(g, F_ACM, "usb0", NULL);
        if (!f_acm0) {
@@ -69,12 +87,12 @@ int main(void)
                goto out2;
        }
 
-       c = usbg_create_config(g, "c.1", NULL, NULL);
+       c = usbg_create_config(g, "c.1", NULL /* use defaults */, &c_strs);
        if (!c) {
                fprintf(stderr, "Error creating config\n");
                goto out2;
        }
-       usbg_set_config_string(c, LANG_US_ENG, "CDC 2xACM+ECM");
+
        usbg_add_config_function(c, "acm.GS0", f_acm0);
        usbg_add_config_function(c, "acm.GS1", f_acm1);
        usbg_add_config_function(c, "ecm.usb0", f_ecm);
diff --git a/examples/show-gadgets.c b/examples/show-gadgets.c
index 9814039..61d1eca 100644
--- a/examples/show-gadgets.c
+++ b/examples/show-gadgets.c
@@ -79,9 +79,9 @@ void show_function(usbg_function *f)
        case F_EEM:
        case F_RNDIS:
                fprintf(stdout, "    dev_addr\t\t%s\n",
-                               ether_ntoa(&f_attrs.net.dev_addr));
+                       ether_ntoa(&f_attrs.net.dev_addr));
                fprintf(stdout, "    host_addr\t\t%s\n",
-                               ether_ntoa(&f_attrs.net.host_addr));
+                       ether_ntoa(&f_attrs.net.host_addr));
                fprintf(stdout, "    ifname\t\t%s\n", f_attrs.net.ifname);
                fprintf(stdout, "    qmult\t\t%d\n", f_attrs.net.qmult);
                break;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to