API of library has been changed, so it is necessary to update examples of library usage. Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx> --- examples/gadget-acm-ecm.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 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); -- 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