summaryrefslogtreecommitdiffstats
path: root/utils/nwztools
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-11-01 12:43:12 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2017-11-01 12:43:33 +0100
commit07d3b3c1fbefb5b0ed390381d11a09a46a8e08ce (patch)
tree30c93da41d76f5d054dbdef365d8cb0e1b442283 /utils/nwztools
parent62f0ba1c302a6e25e8ba55c0ba4eab2469357bbd (diff)
downloadrockbox-07d3b3c1fbefb5b0ed390381d11a09a46a8e08ce.tar.gz
rockbox-07d3b3c1fbefb5b0ed390381d11a09a46a8e08ce.tar.bz2
rockbox-07d3b3c1fbefb5b0ed390381d11a09a46a8e08ce.zip
nwztools/scsitools: print device list when listing series
Change-Id: Ic46c724c5d89a775dc20853410c8fe6f0ff9a4c8
Diffstat (limited to 'utils/nwztools')
-rw-r--r--utils/nwztools/scsitools/scsitool.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/utils/nwztools/scsitools/scsitool.c b/utils/nwztools/scsitools/scsitool.c
index 8fe66d7ce0..fd1ed545da 100644
--- a/utils/nwztools/scsitools/scsitool.c
+++ b/utils/nwztools/scsitools/scsitool.c
@@ -964,7 +964,7 @@ static void usage(void)
printf("Usage: scsitool [options] <dev> <command> [arguments]\n");
printf("Options:\n");
printf(" -o <prefix> Set output prefix\n");
- printf(" -?/--help Display this message\n");
+ printf(" -h/--help Display this message\n");
printf(" -d/--debug Display debug messages\n");
printf(" -c/--no-color Disable color output\n");
printf(" -s/--series <name> Force series (disable auto-detection, use '?' for the list)\n");
@@ -986,13 +986,22 @@ void help_us(bool unsupported, unsigned long model_id)
get_dhp(0, NULL);
}
+static const char *get_model_name(uint32_t model_id)
+{
+ int index = -1;
+ for(int i = 0; i < NWZ_MODEL_COUNT; i++)
+ if(nwz_model[i].mid == model_id)
+ index = i;
+ return index == -1 ? "Unknown" : nwz_model[index].name;
+}
+
int main(int argc, char **argv)
{
while(1)
{
static struct option long_options[] =
{
- {"help", no_argument, 0, '?'},
+ {"help", no_argument, 0, 'h'},
{"debug", no_argument, 0, 'd'},
{"no-color", no_argument, 0, 'c'},
{"series", required_argument, 0, 's'},
@@ -1012,7 +1021,7 @@ int main(int argc, char **argv)
case 'd':
g_debug = true;
break;
- case '?':
+ case 'h':
usage();
break;
case 'o':
@@ -1031,7 +1040,16 @@ int main(int argc, char **argv)
{
cprintf(OFF, "Series list:\n");
for(int i = 0; i < NWZ_SERIES_COUNT; i++)
- printf(" %-10s %s\n", nwz_series[i].codename, nwz_series[i].name);
+ {
+ printf(" %-10s %s (", nwz_series[i].codename, nwz_series[i].name);
+ for(int j = 0; j < nwz_series[i].mid_count; j++)
+ {
+ if(j != 0)
+ printf(", ");
+ printf("%s", get_model_name(nwz_series[i].mid[j]));
+ }
+ printf(")\n");
+ }
return 0;
}