usbconfig.c (1de7b4b805ddbf2429da511c053686ac4591ed89) usbconfig.c (cd1fd29c26d341bf99175e01c0a6c797340bdfe2)
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

--- 63 unchanged lines hidden (view full) ---

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;
76 uint8_t got_power_save:1;
77 uint8_t got_power_on:1;
78 uint8_t got_dump_device_quirks:1;
79 uint8_t got_dump_quirk_names: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

--- 63 unchanged lines hidden (view full) ---

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;
76 uint8_t got_power_save:1;
77 uint8_t got_power_on:1;
78 uint8_t got_dump_device_quirks:1;
79 uint8_t got_dump_quirk_names:1;
80 uint8_t got_dump_all_desc:1;
80 uint8_t got_dump_device_desc:1;
81 uint8_t got_dump_curr_config:1;
82 uint8_t got_dump_all_config:1;
83 uint8_t got_dump_info:1;
84 uint8_t got_show_iface_driver:1;
85 uint8_t got_remove_device_quirk:1;
86 uint8_t got_add_device_quirk:1;
87 uint8_t got_remove_quirk:1;

--- 19 unchanged lines hidden (view full) ---

107 T_GET_TEMPLATE,
108 T_ADD_DEVICE_QUIRK,
109 T_REMOVE_DEVICE_QUIRK,
110 T_ADD_QUIRK,
111 T_REMOVE_QUIRK,
112 T_SHOW_IFACE_DRIVER,
113 T_DUMP_QUIRK_NAMES,
114 T_DUMP_DEVICE_QUIRKS,
81 uint8_t got_dump_device_desc:1;
82 uint8_t got_dump_curr_config:1;
83 uint8_t got_dump_all_config:1;
84 uint8_t got_dump_info:1;
85 uint8_t got_show_iface_driver:1;
86 uint8_t got_remove_device_quirk:1;
87 uint8_t got_add_device_quirk:1;
88 uint8_t got_remove_quirk:1;

--- 19 unchanged lines hidden (view full) ---

108 T_GET_TEMPLATE,
109 T_ADD_DEVICE_QUIRK,
110 T_REMOVE_DEVICE_QUIRK,
111 T_ADD_QUIRK,
112 T_REMOVE_QUIRK,
113 T_SHOW_IFACE_DRIVER,
114 T_DUMP_QUIRK_NAMES,
115 T_DUMP_DEVICE_QUIRKS,
116 T_DUMP_ALL_DESC,
115 T_DUMP_DEVICE_DESC,
116 T_DUMP_CURR_CONFIG_DESC,
117 T_DUMP_ALL_CONFIG_DESC,
118 T_DUMP_STRING,
119 T_DUMP_INFO,
120 T_SUSPEND,
121 T_RESUME,
122 T_POWER_OFF,

--- 16 unchanged lines hidden (view full) ---

139 {"set_template", T_SET_TEMPLATE, 1},
140 {"get_template", T_GET_TEMPLATE, 0},
141 {"add_dev_quirk_vplh", T_ADD_DEVICE_QUIRK, 5},
142 {"remove_dev_quirk_vplh", T_REMOVE_DEVICE_QUIRK, 5},
143 {"add_quirk", T_ADD_QUIRK, 1},
144 {"remove_quirk", T_REMOVE_QUIRK, 1},
145 {"dump_quirk_names", T_DUMP_QUIRK_NAMES, 0},
146 {"dump_device_quirks", T_DUMP_DEVICE_QUIRKS, 0},
117 T_DUMP_DEVICE_DESC,
118 T_DUMP_CURR_CONFIG_DESC,
119 T_DUMP_ALL_CONFIG_DESC,
120 T_DUMP_STRING,
121 T_DUMP_INFO,
122 T_SUSPEND,
123 T_RESUME,
124 T_POWER_OFF,

--- 16 unchanged lines hidden (view full) ---

141 {"set_template", T_SET_TEMPLATE, 1},
142 {"get_template", T_GET_TEMPLATE, 0},
143 {"add_dev_quirk_vplh", T_ADD_DEVICE_QUIRK, 5},
144 {"remove_dev_quirk_vplh", T_REMOVE_DEVICE_QUIRK, 5},
145 {"add_quirk", T_ADD_QUIRK, 1},
146 {"remove_quirk", T_REMOVE_QUIRK, 1},
147 {"dump_quirk_names", T_DUMP_QUIRK_NAMES, 0},
148 {"dump_device_quirks", T_DUMP_DEVICE_QUIRKS, 0},
149 {"dump_all_desc", T_DUMP_ALL_DESC, 0},
147 {"dump_device_desc", T_DUMP_DEVICE_DESC, 0},
148 {"dump_curr_config_desc", T_DUMP_CURR_CONFIG_DESC, 0},
149 {"dump_all_config_desc", T_DUMP_ALL_CONFIG_DESC, 0},
150 {"dump_string", T_DUMP_STRING, 1},
151 {"dump_info", T_DUMP_INFO, 0},
152 {"show_ifdrv", T_SHOW_IFACE_DRIVER, 0},
153 {"suspend", T_SUSPEND, 0},
154 {"resume", T_RESUME, 0},

--- 123 unchanged lines hidden (view full) ---

278 " set_template <template>" "\n"
279 " get_template" "\n"
280 " add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n"
281 " remove_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n"
282 " add_quirk <quirk>" "\n"
283 " remove_quirk <quirk>" "\n"
284 " dump_quirk_names" "\n"
285 " dump_device_quirks" "\n"
150 {"dump_device_desc", T_DUMP_DEVICE_DESC, 0},
151 {"dump_curr_config_desc", T_DUMP_CURR_CONFIG_DESC, 0},
152 {"dump_all_config_desc", T_DUMP_ALL_CONFIG_DESC, 0},
153 {"dump_string", T_DUMP_STRING, 1},
154 {"dump_info", T_DUMP_INFO, 0},
155 {"show_ifdrv", T_SHOW_IFACE_DRIVER, 0},
156 {"suspend", T_SUSPEND, 0},
157 {"resume", T_RESUME, 0},

--- 123 unchanged lines hidden (view full) ---

281 " set_template <template>" "\n"
282 " get_template" "\n"
283 " add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n"
284 " remove_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n"
285 " add_quirk <quirk>" "\n"
286 " remove_quirk <quirk>" "\n"
287 " dump_quirk_names" "\n"
288 " dump_device_quirks" "\n"
289 " dump_all_desc" "\n"
286 " dump_device_desc" "\n"
287 " dump_curr_config_desc" "\n"
288 " dump_all_config_desc" "\n"
289 " dump_string <index>" "\n"
290 " dump_info" "\n"
291 " show_ifdrv" "\n"
292 " suspend" "\n"
293 " resume" "\n"

--- 190 unchanged lines hidden (view full) ---

484 }
485 if (opt->got_power_on) {
486 if (libusb20_dev_set_power_mode(pdev,
487 LIBUSB20_POWER_ON)) {
488 err(1, "could not set power ON");
489 }
490 }
491 dump_any =
290 " dump_device_desc" "\n"
291 " dump_curr_config_desc" "\n"
292 " dump_all_config_desc" "\n"
293 " dump_string <index>" "\n"
294 " dump_info" "\n"
295 " show_ifdrv" "\n"
296 " suspend" "\n"
297 " resume" "\n"

--- 190 unchanged lines hidden (view full) ---

488 }
489 if (opt->got_power_on) {
490 if (libusb20_dev_set_power_mode(pdev,
491 LIBUSB20_POWER_ON)) {
492 err(1, "could not set power ON");
493 }
494 }
495 dump_any =
492 (opt->got_dump_device_desc ||
496 (opt->got_dump_all_desc ||
497 opt->got_dump_device_desc ||
493 opt->got_dump_curr_config ||
494 opt->got_dump_all_config ||
495 opt->got_dump_info);
496
497 if (opt->got_list || dump_any) {
498 dump_device_info(pdev,
499 opt->got_show_iface_driver);
500 }
501 if (opt->got_dump_device_desc) {
502 printf("\n");
503 dump_device_desc(pdev);
504 }
505 if (opt->got_dump_all_config) {
506 printf("\n");
507 dump_config(pdev, 1);
508 } else if (opt->got_dump_curr_config) {
509 printf("\n");
510 dump_config(pdev, 0);
498 opt->got_dump_curr_config ||
499 opt->got_dump_all_config ||
500 opt->got_dump_info);
501
502 if (opt->got_list || dump_any) {
503 dump_device_info(pdev,
504 opt->got_show_iface_driver);
505 }
506 if (opt->got_dump_device_desc) {
507 printf("\n");
508 dump_device_desc(pdev);
509 }
510 if (opt->got_dump_all_config) {
511 printf("\n");
512 dump_config(pdev, 1);
513 } else if (opt->got_dump_curr_config) {
514 printf("\n");
515 dump_config(pdev, 0);
516 } else if (opt->got_dump_all_desc) {
517 printf("\n");
518 dump_device_desc(pdev);
519 dump_config(pdev, 1);
511 }
512 if (dump_any) {
513 printf("\n");
514 }
515 if (libusb20_dev_close(pdev)) {
516 err(1, "could not close device");
517 }
518 }

--- 172 unchanged lines hidden (view full) ---

691 n++;
692 break;
693 case T_GET_TEMPLATE:
694 if (opt->got_get_template)
695 duplicate_option(argv[n]);
696 opt->got_get_template = 1;
697 opt->got_any++;
698 break;
520 }
521 if (dump_any) {
522 printf("\n");
523 }
524 if (libusb20_dev_close(pdev)) {
525 err(1, "could not close device");
526 }
527 }

--- 172 unchanged lines hidden (view full) ---

700 n++;
701 break;
702 case T_GET_TEMPLATE:
703 if (opt->got_get_template)
704 duplicate_option(argv[n]);
705 opt->got_get_template = 1;
706 opt->got_any++;
707 break;
708 case T_DUMP_ALL_DESC:
709 if (opt->got_dump_all_desc)
710 duplicate_option(argv[n]);
711 opt->got_dump_all_desc = 1;
712 opt->got_any++;
713 break;
699 case T_DUMP_DEVICE_DESC:
700 if (opt->got_dump_device_desc)
701 duplicate_option(argv[n]);
702 opt->got_dump_device_desc = 1;
703 opt->got_any++;
704 break;
705 case T_DUMP_CURR_CONFIG_DESC:
706 if (opt->got_dump_curr_config)

--- 119 unchanged lines hidden ---
714 case T_DUMP_DEVICE_DESC:
715 if (opt->got_dump_device_desc)
716 duplicate_option(argv[n]);
717 opt->got_dump_device_desc = 1;
718 opt->got_any++;
719 break;
720 case T_DUMP_CURR_CONFIG_DESC:
721 if (opt->got_dump_curr_config)

--- 119 unchanged lines hidden ---