MFC r330875:
Add "usbconfig dump_all_desc", a subcommand to dump all device and config descriptors.
This commit is contained in:
parent
c1a2fd25d6
commit
6740092c23
@ -97,6 +97,8 @@ Remove a quirk.
|
||||
Add quirk for the currently selected USB device.
|
||||
.It Cm remove_quirk Ar quirk_name
|
||||
Remove a quirk for the currently selected USB device.
|
||||
.It Cm dump_all_desc
|
||||
Display the device and configuration descriptors.
|
||||
.It Cm dump_quirk_names
|
||||
Display the list of supported quirk names.
|
||||
.It Cm dump_device_quirks
|
||||
|
@ -77,6 +77,7 @@ struct options {
|
||||
uint8_t got_power_on:1;
|
||||
uint8_t got_dump_device_quirks:1;
|
||||
uint8_t got_dump_quirk_names:1;
|
||||
uint8_t got_dump_all_desc:1;
|
||||
uint8_t got_dump_device_desc:1;
|
||||
uint8_t got_dump_curr_config:1;
|
||||
uint8_t got_dump_all_config:1;
|
||||
@ -112,6 +113,7 @@ enum {
|
||||
T_SHOW_IFACE_DRIVER,
|
||||
T_DUMP_QUIRK_NAMES,
|
||||
T_DUMP_DEVICE_QUIRKS,
|
||||
T_DUMP_ALL_DESC,
|
||||
T_DUMP_DEVICE_DESC,
|
||||
T_DUMP_CURR_CONFIG_DESC,
|
||||
T_DUMP_ALL_CONFIG_DESC,
|
||||
@ -144,6 +146,7 @@ static const struct token token[] = {
|
||||
{"remove_quirk", T_REMOVE_QUIRK, 1},
|
||||
{"dump_quirk_names", T_DUMP_QUIRK_NAMES, 0},
|
||||
{"dump_device_quirks", T_DUMP_DEVICE_QUIRKS, 0},
|
||||
{"dump_all_desc", T_DUMP_ALL_DESC, 0},
|
||||
{"dump_device_desc", T_DUMP_DEVICE_DESC, 0},
|
||||
{"dump_curr_config_desc", T_DUMP_CURR_CONFIG_DESC, 0},
|
||||
{"dump_all_config_desc", T_DUMP_ALL_CONFIG_DESC, 0},
|
||||
@ -283,6 +286,7 @@ usage(void)
|
||||
" remove_quirk <quirk>" "\n"
|
||||
" dump_quirk_names" "\n"
|
||||
" dump_device_quirks" "\n"
|
||||
" dump_all_desc" "\n"
|
||||
" dump_device_desc" "\n"
|
||||
" dump_curr_config_desc" "\n"
|
||||
" dump_all_config_desc" "\n"
|
||||
@ -489,7 +493,8 @@ flush_command(struct libusb20_backend *pbe, struct options *opt)
|
||||
}
|
||||
}
|
||||
dump_any =
|
||||
(opt->got_dump_device_desc ||
|
||||
(opt->got_dump_all_desc ||
|
||||
opt->got_dump_device_desc ||
|
||||
opt->got_dump_curr_config ||
|
||||
opt->got_dump_all_config ||
|
||||
opt->got_dump_info);
|
||||
@ -508,6 +513,10 @@ flush_command(struct libusb20_backend *pbe, struct options *opt)
|
||||
} else if (opt->got_dump_curr_config) {
|
||||
printf("\n");
|
||||
dump_config(pdev, 0);
|
||||
} else if (opt->got_dump_all_desc) {
|
||||
printf("\n");
|
||||
dump_device_desc(pdev);
|
||||
dump_config(pdev, 1);
|
||||
}
|
||||
if (dump_any) {
|
||||
printf("\n");
|
||||
@ -696,6 +705,12 @@ main(int argc, char **argv)
|
||||
opt->got_get_template = 1;
|
||||
opt->got_any++;
|
||||
break;
|
||||
case T_DUMP_ALL_DESC:
|
||||
if (opt->got_dump_all_desc)
|
||||
duplicate_option(argv[n]);
|
||||
opt->got_dump_all_desc = 1;
|
||||
opt->got_any++;
|
||||
break;
|
||||
case T_DUMP_DEVICE_DESC:
|
||||
if (opt->got_dump_device_desc)
|
||||
duplicate_option(argv[n]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user