usbconfig.c (ae450e6de96b5ec65f425a52b08dc859576ab8d0) | usbconfig.c (cae1884d4791726f5acf5d64bba9a3583b63e38b) |
---|---|
1/* $FreeBSD$ */ 2/*- 3 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4 * 5 * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 51 unchanged lines hidden (view full) --- 60 uint16_t lo_rev; /* inclusive */ 61 uint16_t hi_rev; /* inclusive */ 62 uint8_t string_index; 63 uint8_t config_index; 64 uint8_t alt_index; 65 uint8_t got_list:1; 66 uint8_t got_bus:1; 67 uint8_t got_addr:1; | 1/* $FreeBSD$ */ 2/*- 3 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4 * 5 * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 51 unchanged lines hidden (view full) --- 60 uint16_t lo_rev; /* inclusive */ 61 uint16_t hi_rev; /* inclusive */ 62 uint8_t string_index; 63 uint8_t config_index; 64 uint8_t alt_index; 65 uint8_t got_list:1; 66 uint8_t got_bus:1; 67 uint8_t got_addr:1; |
68 uint8_t got_iface:1; | |
69 uint8_t got_set_config:1; 70 uint8_t got_set_alt:1; 71 uint8_t got_set_template:1; 72 uint8_t got_get_template:1; 73 uint8_t got_suspend:1; 74 uint8_t got_resume:1; 75 uint8_t got_reset:1; 76 uint8_t got_power_off:1; --- 190 unchanged lines hidden (view full) --- 267 exit(1); 268} 269 270static void 271usage(void) 272{ 273 fprintf(stderr, "" 274 "usbconfig - configure the USB subsystem" "\n" | 68 uint8_t got_set_config:1; 69 uint8_t got_set_alt:1; 70 uint8_t got_set_template:1; 71 uint8_t got_get_template:1; 72 uint8_t got_suspend:1; 73 uint8_t got_resume:1; 74 uint8_t got_reset:1; 75 uint8_t got_power_off:1; --- 190 unchanged lines hidden (view full) --- 266 exit(1); 267} 268 269static void 270usage(void) 271{ 272 fprintf(stderr, "" 273 "usbconfig - configure the USB subsystem" "\n" |
275 "usage: usbconfig -u <busnum> -a <devaddr> -i <ifaceindex> [cmds...]" "\n" 276 "usage: usbconfig -d [ugen]<busnum>.<devaddr> -i <ifaceindex> [cmds...]" "\n" | 274 "usage: usbconfig [-u <busnum>] [-a <devaddr>] [-i <ifaceindex>] [cmds...]" "\n" 275 "usage: usbconfig -d [ugen]<busnum>.<devaddr> [-i <ifaceindex>] [cmds...]" "\n" |
277 "commands:" "\n" 278 " set_config <cfg_index>" "\n" 279 " set_alt <alt_index>" "\n" 280 " set_template <template>" "\n" 281 " get_template" "\n" 282 " add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n" 283 " remove_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n" 284 " add_quirk <quirk>" "\n" --- 286 unchanged lines hidden (view full) --- 571 opt->addr = num_id(optarg, "addr"); 572 opt->got_addr = 1; 573 break; 574 575 case 'd': 576 if (strncmp(optarg, "ugen", strlen("ugen")) == 0) { 577 ptr = optarg + strlen("ugen"); 578 } else if (strncmp(optarg, "/dev/ugen", | 276 "commands:" "\n" 277 " set_config <cfg_index>" "\n" 278 " set_alt <alt_index>" "\n" 279 " set_template <template>" "\n" 280 " get_template" "\n" 281 " add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n" 282 " remove_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n" 283 " add_quirk <quirk>" "\n" --- 286 unchanged lines hidden (view full) --- 570 opt->addr = num_id(optarg, "addr"); 571 opt->got_addr = 1; 572 break; 573 574 case 'd': 575 if (strncmp(optarg, "ugen", strlen("ugen")) == 0) { 576 ptr = optarg + strlen("ugen"); 577 } else if (strncmp(optarg, "/dev/ugen", |
579 strlen("/dev/ugen")) == 0) { | 578 strlen("/dev/ugen")) == 0) { |
580 ptr = optarg + strlen("/dev/ugen"); 581 } else { 582 ptr = optarg; 583 } 584 if ((sscanf(ptr, "%d.%d", 585 &unit, &addr) != 2) || 586 (unit < 0) || (unit > 65535) || 587 (addr < 0) || (addr > 65535)) { 588 errx(1, "cannot " 589 "parse '%s'", optarg); 590 } 591 opt->bus = unit; 592 opt->addr = addr; 593 opt->got_bus = 1; 594 opt->got_addr = 1; 595 break; 596 597 case 'i': 598 opt->iface = num_id(optarg, "iface"); | 579 ptr = optarg + strlen("/dev/ugen"); 580 } else { 581 ptr = optarg; 582 } 583 if ((sscanf(ptr, "%d.%d", 584 &unit, &addr) != 2) || 585 (unit < 0) || (unit > 65535) || 586 (addr < 0) || (addr > 65535)) { 587 errx(1, "cannot " 588 "parse '%s'", optarg); 589 } 590 opt->bus = unit; 591 opt->addr = addr; 592 opt->got_bus = 1; 593 opt->got_addr = 1; 594 break; 595 596 case 'i': 597 opt->iface = num_id(optarg, "iface"); |
599 opt->got_iface = 1; | |
600 break; 601 602 case 'u': 603 opt->bus = num_id(optarg, "busnum"); 604 opt->got_bus = 1; 605 break; 606 607 default: --- 281 unchanged lines hidden --- | 598 break; 599 600 case 'u': 601 opt->bus = num_id(optarg, "busnum"); 602 opt->got_bus = 1; 603 break; 604 605 default: --- 281 unchanged lines hidden --- |