diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-17 07:53:09 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-22 08:09:28 +0200 |
commit | 62735eec55c5fbe5609d3f0d2217e941d49277be (patch) | |
tree | 18adf87dcfd056128e69df56ff4a030b624b9422 /commands/usbserial.c | |
parent | 32f4bd130c9c46ad7404a3e600dcea8d05008d32 (diff) | |
download | barebox-62735eec55c5fbe5609d3f0d2217e941d49277be.tar.gz barebox-62735eec55c5fbe5609d3f0d2217e941d49277be.tar.xz |
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/usbserial.c')
-rw-r--r-- | commands/usbserial.c | 27 |
1 files changed, 2 insertions, 25 deletions
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] <description>") + BAREBOX_CMD_OPTS("[-asd] <description>") BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP) BAREBOX_CMD_HELP(cmd_usbserial_help) BAREBOX_CMD_END |