Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3481c9a5 authored by Steven Moreland's avatar Steven Moreland
Browse files

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
parent 3aa6c982
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@

#include "Lshal.h"

#include <hidl-util/FQName.h>

namespace android {
namespace lshal {

@@ -46,7 +48,15 @@ Status DebugCommand::main(const Arg &arg) {
    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(),