lshal: debug checks fqname
Lshal debug now checks that the argument is the fully-qualified name.
Without this, it just complains that it can't connect to the hal
which is misleading.
Test: manual w/ lshal debug
Change-Id: Ia4aad1a306ba8f411132c44a7331123b463ad50c
diff --git a/cmds/lshal/DebugCommand.cpp b/cmds/lshal/DebugCommand.cpp
index 622f866..f371320 100644
--- a/cmds/lshal/DebugCommand.cpp
+++ b/cmds/lshal/DebugCommand.cpp
@@ -18,6 +18,8 @@
#include "Lshal.h"
+#include <hidl-util/FQName.h>
+
namespace android {
namespace lshal {
@@ -46,7 +48,15 @@
if (status != OK) {
return status;
}
+
auto pair = splitFirst(mInterfaceName, '/');
+
+ FQName fqName(pair.first);
+ if (!fqName.isValid() || fqName.isIdentifier() || !fqName.isFullyQualified()) {
+ mLshal.err() << "Invalid fully-qualified name '" << pair.first << "'\n\n";
+ return USAGE;
+ }
+
return mLshal.emitDebugInfo(
pair.first, pair.second.empty() ? "default" : pair.second, mOptions,
mLshal.out().buf(),