From 62735eec55c5fbe5609d3f0d2217e941d49277be Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 17 Jul 2014 07:53:09 +0200 Subject: USB: gadget: specify vendor/product id with device parameters This introduces the device parameters: usbgadget.product usbgadget.vendor usbgadget.manufacturer usbgadget.productname These variables are used to configure the USB vendor id, product id, manufacturer name and product name. Previously these were configured with arguments to the usbserial and dfu command. The parameters are device static, so it's nice to configure it somewhere in the environment instead of when calling dfu/usbserial. Also when other gadget drivers are added we do not have to duplicate the option parsing further. Signed-off-by: Sascha Hauer --- commands/usbserial.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'commands/usbserial.c') diff --git a/commands/usbserial.c b/commands/usbserial.c index 7e82112df0..e80b315250 100644 --- a/commands/usbserial.c +++ b/commands/usbserial.c @@ -31,25 +31,10 @@ static int do_usbserial(int argc, char *argv[]) { int opt; struct usb_serial_pdata pdata; - char *manufacturer = "barebox"; - const char *productname = barebox_get_model(); - u16 idVendor = 0, idProduct = 0; int acm = 1; - while ((opt = getopt(argc, argv, "m:p:V:P:asd")) > 0) { + while ((opt = getopt(argc, argv, "asd")) > 0) { switch (opt) { - case 'm': - manufacturer = optarg; - break; - case 'p': - productname = optarg; - break; - case 'V': - idVendor = simple_strtoul(optarg, NULL, 0); - break; - case 'P': - idProduct = simple_strtoul(optarg, NULL, 0); - break; case 'a': acm = 1; break; @@ -62,10 +47,6 @@ static int do_usbserial(int argc, char *argv[]) } } - pdata.manufacturer = manufacturer; - pdata.productname = productname; - pdata.idVendor = idVendor; - pdata.idProduct = idProduct; pdata.acm = acm; return usb_serial_register(&pdata); @@ -75,10 +56,6 @@ BAREBOX_CMD_HELP_START(usbserial) BAREBOX_CMD_HELP_TEXT("Enable / disable a serial gadget on the USB device interface.") BAREBOX_CMD_HELP_TEXT("") BAREBOX_CMD_HELP_TEXT("Options:") -BAREBOX_CMD_HELP_OPT ("-m STR", "Manufacturer string (barebox)") -BAREBOX_CMD_HELP_OPT ("-p STR", "product string") -BAREBOX_CMD_HELP_OPT ("-V ID", "vendor id") -BAREBOX_CMD_HELP_OPT ("-P ID", "product id") BAREBOX_CMD_HELP_OPT ("-a", "CDC ACM (default)") BAREBOX_CMD_HELP_OPT ("-s", "Generic Serial") BAREBOX_CMD_HELP_OPT ("-d", "Disable the serial gadget") @@ -87,7 +64,7 @@ BAREBOX_CMD_HELP_END BAREBOX_CMD_START(usbserial) .cmd = do_usbserial, BAREBOX_CMD_DESC("serial gadget enable/disable") - BAREBOX_CMD_OPTS("[-mpVPasd] ") + BAREBOX_CMD_OPTS("[-asd] ") BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP) BAREBOX_CMD_HELP(cmd_usbserial_help) BAREBOX_CMD_END -- cgit v1.2.3