diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2018-01-13 12:18:01 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2018-01-13 12:18:01 +0100 |
commit | 4d988d43d8804be48bbb2c07b843237a19c8bcf1 (patch) | |
tree | 23380ffd81d0f125b028a4c86f49d7085be42281 /utils/nwztools/scsitools | |
parent | 6c856c412abb8f42bd13b933eed86c4ed113f551 (diff) |
nwztools/scsitool: print clearer message when nvp info is incomplete
Change-Id: I13b20b88b35e825da929a31e71ff42d68a79f131
Diffstat (limited to 'utils/nwztools/scsitools')
-rw-r--r-- | utils/nwztools/scsitools/scsitool.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/utils/nwztools/scsitools/scsitool.c b/utils/nwztools/scsitools/scsitool.c index fd1ed545da..b3f05a0785 100644 --- a/utils/nwztools/scsitools/scsitool.c +++ b/utils/nwztools/scsitools/scsitool.c @@ -321,7 +321,7 @@ int get_model_id(unsigned long *model_id) return 0; } -int get_model_and_series(int *model_index, int *series_index) +int get_model_and_series(int *model_index, int *series_index, unsigned long *model_id_out) { /* if the user forced the series, simply match by name, special for '?' which * prompts the list */ @@ -346,6 +346,8 @@ int get_model_and_series(int *model_index, int *series_index) unsigned long model_id; if(get_model_id(&model_id)) return 1; + if(model_id_out) + *model_id_out = model_id; *model_index = -1; for(int i = 0; i < NWZ_MODEL_COUNT; i++) if(nwz_model[i].mid == model_id) @@ -448,7 +450,7 @@ int get_dnk_nvp(int argc, char **argv) return 1; } int series_index, model_index; - int ret = get_model_and_series(&model_index, &series_index); + int ret = get_model_and_series(&model_index, &series_index, NULL); if(ret) return ret; size_t size = 0; @@ -820,15 +822,18 @@ int do_dest(int argc, char **argv) } /* get model/series */ int model_index, series_index; - int ret = get_model_and_series(&model_index, &series_index); + unsigned long model_id; + int ret = get_model_and_series(&model_index, &series_index, &model_id); if(ret) return ret; int shp_index = NWZ_NVP_INVALID; if(nwz_series[series_index].nvp_index) shp_index = (*nwz_series[series_index].nvp_index)[NWZ_NVP_SHP]; + shp_index = NWZ_NVP_INVALID; if(shp_index == NWZ_NVP_INVALID) { printf("This device doesn't have node 'shp'\n"); + help_us(true, model_id); return 5; } /* in all cases, we need to read shp */ |