usbconfig.c (912280b4b4bb73550319bb860aa3d3b641e1ddfe) | usbconfig.c (49366f62991ba8e723c0fcadd60007afe4d3b0a5) |
---|---|
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 --- 75 unchanged lines hidden (view full) --- 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; 89 uint8_t got_add_quirk:1; 90 uint8_t got_dump_string:1; 91 uint8_t got_do_request: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 --- 75 unchanged lines hidden (view full) --- 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; 89 uint8_t got_add_quirk:1; 90 uint8_t got_dump_string:1; 91 uint8_t got_do_request:1; |
92 uint8_t got_detach_kernel_driver:1; |
|
92}; 93 94struct token { 95 const char *name; 96 uint8_t value; 97 uint8_t narg; 98}; 99 --- 6 unchanged lines hidden (view full) --- 106 T_SET_ALT, 107 T_SET_TEMPLATE, 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, | 93}; 94 95struct token { 96 const char *name; 97 uint8_t value; 98 uint8_t narg; 99}; 100 --- 6 unchanged lines hidden (view full) --- 107 T_SET_ALT, 108 T_SET_TEMPLATE, 109 T_GET_TEMPLATE, 110 T_ADD_DEVICE_QUIRK, 111 T_REMOVE_DEVICE_QUIRK, 112 T_ADD_QUIRK, 113 T_REMOVE_QUIRK, 114 T_SHOW_IFACE_DRIVER, |
115 T_DETACH_KERNEL_DRIVER, |
|
114 T_DUMP_QUIRK_NAMES, 115 T_DUMP_DEVICE_QUIRKS, 116 T_DUMP_ALL_DESC, 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, --- 17 unchanged lines hidden (view full) --- 139 {"set_config", T_SET_CONFIG, 1}, 140 {"set_alt", T_SET_ALT, 1}, 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}, | 116 T_DUMP_QUIRK_NAMES, 117 T_DUMP_DEVICE_QUIRKS, 118 T_DUMP_ALL_DESC, 119 T_DUMP_DEVICE_DESC, 120 T_DUMP_CURR_CONFIG_DESC, 121 T_DUMP_ALL_CONFIG_DESC, 122 T_DUMP_STRING, 123 T_DUMP_INFO, --- 17 unchanged lines hidden (view full) --- 141 {"set_config", T_SET_CONFIG, 1}, 142 {"set_alt", T_SET_ALT, 1}, 143 {"set_template", T_SET_TEMPLATE, 1}, 144 {"get_template", T_GET_TEMPLATE, 0}, 145 {"add_dev_quirk_vplh", T_ADD_DEVICE_QUIRK, 5}, 146 {"remove_dev_quirk_vplh", T_REMOVE_DEVICE_QUIRK, 5}, 147 {"add_quirk", T_ADD_QUIRK, 1}, 148 {"remove_quirk", T_REMOVE_QUIRK, 1}, |
149 {"detach_kernel_driver", T_DETACH_KERNEL_DRIVER, 0}, |
|
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}, 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}, --- 124 unchanged lines hidden (view full) --- 279 " set_config <cfg_index>" "\n" 280 " set_alt <alt_index>" "\n" 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" | 150 {"dump_quirk_names", T_DUMP_QUIRK_NAMES, 0}, 151 {"dump_device_quirks", T_DUMP_DEVICE_QUIRKS, 0}, 152 {"dump_all_desc", T_DUMP_ALL_DESC, 0}, 153 {"dump_device_desc", T_DUMP_DEVICE_DESC, 0}, 154 {"dump_curr_config_desc", T_DUMP_CURR_CONFIG_DESC, 0}, 155 {"dump_all_config_desc", T_DUMP_ALL_CONFIG_DESC, 0}, 156 {"dump_string", T_DUMP_STRING, 1}, 157 {"dump_info", T_DUMP_INFO, 0}, --- 124 unchanged lines hidden (view full) --- 282 " set_config <cfg_index>" "\n" 283 " set_alt <alt_index>" "\n" 284 " set_template <template>" "\n" 285 " get_template" "\n" 286 " add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n" 287 " remove_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n" 288 " add_quirk <quirk>" "\n" 289 " remove_quirk <quirk>" "\n" |
290 " detach_kernel_driver" "\n" |
|
287 " dump_quirk_names" "\n" 288 " dump_device_quirks" "\n" 289 " dump_all_desc" "\n" 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" --- 192 unchanged lines hidden (view full) --- 487 } 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 } | 291 " dump_quirk_names" "\n" 292 " dump_device_quirks" "\n" 293 " dump_all_desc" "\n" 294 " dump_device_desc" "\n" 295 " dump_curr_config_desc" "\n" 296 " dump_all_config_desc" "\n" 297 " dump_string <index>" "\n" 298 " dump_info" "\n" --- 192 unchanged lines hidden (view full) --- 491 } 492 } 493 if (opt->got_power_on) { 494 if (libusb20_dev_set_power_mode(pdev, 495 LIBUSB20_POWER_ON)) { 496 err(1, "could not set power ON"); 497 } 498 } |
499 if (opt->got_detach_kernel_driver) { 500 if (libusb20_dev_detach_kernel_driver(pdev, opt->iface)) { 501 err(1, "could not detach kernel driver"); 502 } 503 } |
|
495 dump_any = 496 (opt->got_dump_all_desc || 497 opt->got_dump_device_desc || 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) { --- 103 unchanged lines hidden (view full) --- 606 opt->lo_rev = num_id(argv[n + 3], "Low Revision"); 607 opt->hi_rev = num_id(argv[n + 4], "High Revision"); 608 opt->quirkname = argv[n + 5]; 609 n += 5; 610 opt->got_remove_device_quirk = 1; 611 opt->got_any++; 612 break; 613 | 504 dump_any = 505 (opt->got_dump_all_desc || 506 opt->got_dump_device_desc || 507 opt->got_dump_curr_config || 508 opt->got_dump_all_config || 509 opt->got_dump_info); 510 511 if (opt->got_list || dump_any) { --- 103 unchanged lines hidden (view full) --- 615 opt->lo_rev = num_id(argv[n + 3], "Low Revision"); 616 opt->hi_rev = num_id(argv[n + 4], "High Revision"); 617 opt->quirkname = argv[n + 5]; 618 n += 5; 619 opt->got_remove_device_quirk = 1; 620 opt->got_any++; 621 break; 622 |
623 case T_DETACH_KERNEL_DRIVER: 624 if (opt->got_detach_kernel_driver) 625 duplicate_option(argv[n]); 626 opt->got_detach_kernel_driver = 1; 627 opt->got_any++; 628 break; 629 |
|
614 case T_DUMP_QUIRK_NAMES: 615 if (opt->got_dump_quirk_names) 616 duplicate_option(argv[n]); 617 opt->got_dump_quirk_names = 1; 618 opt->got_any++; 619 break; 620 621 case T_DUMP_DEVICE_QUIRKS: --- 242 unchanged lines hidden --- | 630 case T_DUMP_QUIRK_NAMES: 631 if (opt->got_dump_quirk_names) 632 duplicate_option(argv[n]); 633 opt->got_dump_quirk_names = 1; 634 opt->got_any++; 635 break; 636 637 case T_DUMP_DEVICE_QUIRKS: --- 242 unchanged lines hidden --- |