tools/mesh-cfgclient: Fix model app list parsing
PATCH v2 1/1 tools/mesh-cfgclient: Fix model app list parsing
This fixes parsing of Model AppKey List & Vendor Model Appkey List
messages: taking into account the packt that AppKey indices are parked two in three octets.
Also, when printing key indices, print in both decimal and hexadecimal formats.
--- tools/mesh-cfgclient.c | 6 ++-- tools/mesh/cfgcli.c | 78 +++++++++++++++++++++++++----------------- tools/mesh/keys.c | 6 ++-- tools/mesh/remote.c | 6 ++-- 4 files changed, 57 insertions(+), 39 deletions(-)
tools/mesh-cfgclient.c +4 -2
@@ -338,12 +338,14 @@ static bool send_key(void *user_data, uint16_t dst, uint16_t key_idx, }if (!is_appkey && !keys_subnet_exists (key_idx)) { -bt_shell_printf ("Local NetKey %u not found\n" , key_idx); +bt_shell_printf ("Local NetKey %u (0x%3.3x) not found\n" , + key_idx, key_idx);return false; }if (is_appkey && (keys_get_bound_key (key_idx) ==NET_IDX_INVALID )) { -bt_shell_printf ("Local AppKey %u not found\n" , key_idx); +bt_shell_printf ("Local AppKey %u (0x%3.3x) not found\n" , + key_idx, key_idx);return false; }
tools/mesh/cfgcli.c +47 -31
167 lines not on this page · raw message
tools/mesh/keys.c +3 -3
@@ -193,15 +193,15 @@ static void print_appkey(void *app_key, void *user_data) {uint16_t app_idx =L_PTR_TO_UINT (app_key); -bt_shell_printf ("0x%3.3x, " , app_idx); +bt_shell_printf ("%u (0x%3.3x), " , app_idx, app_idx); }static void print_netkey (void *net_key,void *user_data) {struct net_key *key = net_key; -bt_shell_printf (COLOR_YELLOW "NetKey: 0x%3.3x, phase: %u\n" COLOR_OFF , - key->idx, key->phase); +bt_shell_printf (COLOR_YELLOW "NetKey: %u (0x%3.3x), phase: %u\n" +COLOR_OFF , key->idx, key->idx, key->phase);if (!key->app_keys ||l_queue_isempty (key->app_keys))return ;
tools/mesh/remote.c +3 -3
@@ -217,11 +217,11 @@ uint16_t remote_get_subnet_idx(uint16_t addr)return (uint16_t ) net_idx; } -static void print_key (void *net_key,void *user_data) +static void print_key (void *key,void *user_data) { -uint16_t net_idx =L_PTR_TO_UINT (net_key); +uint16_t idx =L_PTR_TO_UINT (key); -bt_shell_printf ("%3.3x, " , net_idx); +bt_shell_printf ("%u (0x%3.3x), " , idx, idx); }static void print_node (void *rmt,void *user_data)
Signature · 1 line
2.21.1