From ff654bdfa073c4c7c09dc2f97f91d99cf279c6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20=C3=96hrstr=C3=B6m?= Date: Mon, 27 Dec 2021 14:30:54 +0100 Subject: [PATCH] Add encrypted to type info when listening to all meters. --- Makefile | 1 + src/meters.cc | 4 +-- src/wmbus.cc | 13 +++++-- tests/test_hex_cmdline.sh | 2 +- tests/test_listen_to_all.sh | 72 ++++++++++++++++++------------------- 5 files changed, 50 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 6ada031..3053406 100644 --- a/Makefile +++ b/Makefile @@ -216,6 +216,7 @@ clean_deb: # Check docs verifies that all options in the source have been mentioned in the README and in the man page. # Also any option not in the source but mentioned in the docs is warned for as well. check_docs: + @rm -f /tmp/options_in_* @cat src/cmdline.cc | grep -o -- '--[a-z][a-z]*' | sort | uniq | grep -v internaltesting > /tmp/options_in_code @cat wmbusmeters.1 | grep -o -- '--[a-z][a-z]*' | sort | uniq | grep -v internaltesting > /tmp/options_in_man @cat README.md | grep -o -- '--[a-z][a-z]*' | sort | uniq | grep -v internaltesting > /tmp/options_in_readme diff --git a/src/meters.cc b/src/meters.cc index 2e29825..e9f8419 100644 --- a/src/meters.cc +++ b/src/meters.cc @@ -338,8 +338,8 @@ LIST_OF_METERS { // Oups, we added a new meter object tailored for this telegram // but it still did not handle it! This can happen if the wrong - // decryption key was used. - warning("(meter) newly created meter (%s %s %s) did not handle telegram!\n", + // decryption key was used. But it is ok if analyzing.... + debug("(meter) newly created meter (%s %s %s) did not handle telegram!\n", meter->name().c_str(), meter->idsc().c_str(), toString(meter->driver()).c_str()); } else diff --git a/src/wmbus.cc b/src/wmbus.cc index 2a03ebe..7715038 100644 --- a/src/wmbus.cc +++ b/src/wmbus.cc @@ -229,12 +229,20 @@ void Telegram::print() c = dll_id[2]; d = dll_id[3]; } + const char *enc = ""; + + if (ell_sec_mode != ELLSecurityMode::NoSecurity || + tpl_sec_mode != TPLSecurityMode::NoSecurity) + { + enc = " encrypted"; + } + notice("Received telegram from: %02x%02x%02x%02x\n", a,b,c,d); notice(" manufacturer: (%s) %s (0x%02x)\n", manufacturerFlag(dll_mfct).c_str(), manufacturer(dll_mfct).c_str(), dll_mfct); - notice(" type: %s (0x%02x)\n", mediaType(dll_type, dll_mfct).c_str(), dll_type); + notice(" type: %s (0x%02x)%s\n", mediaType(dll_type, dll_mfct).c_str(), dll_type, enc); notice(" ver: 0x%02x\n", dll_version); @@ -245,10 +253,9 @@ void Telegram::print() manufacturerFlag(tpl_mfct).c_str(), manufacturer(tpl_mfct).c_str(), tpl_mfct); - notice(" type: %s (0x%02x)\n", mediaType(tpl_type, dll_mfct).c_str(), tpl_type); + notice(" type: %s (0x%02x)%s\n", mediaType(tpl_type, dll_mfct).c_str(), tpl_type, enc); notice(" ver: 0x%02x\n", tpl_version); - } if (about.device != "") { diff --git a/tests/test_hex_cmdline.sh b/tests/test_hex_cmdline.sh index 426c089..56f0659 100755 --- a/tests/test_hex_cmdline.sh +++ b/tests/test_hex_cmdline.sh @@ -11,7 +11,7 @@ cat > $TEST/test_expected.txt <