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

Commit d34157e2 authored by Vincent Donnefort's avatar Vincent Donnefort Committed by Gerrit Code Review
Browse files

Merge "toolbox/modprobe: Fallback to /lib/modules/<uname>"

parents 545141f4 83207784
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -23,8 +23,11 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include <android-base/stringprintf.h>
#include <modprobe/modprobe.h>

#include <sys/utsname.h>

namespace {

enum modprobe_mode {
@@ -37,9 +40,8 @@ enum modprobe_mode {
void print_usage(void) {
    LOG(INFO) << "Usage:";
    LOG(INFO);
    // -d option is required on Android
    LOG(INFO) << "  modprobe [options] -d DIR [--all=FILE|MODULE]...";
    LOG(INFO) << "  modprobe [options] -d DIR MODULE [symbol=value]...";
    LOG(INFO) << "  modprobe [options] [-d DIR] [--all=FILE|MODULE]...";
    LOG(INFO) << "  modprobe [options] [-d DIR] MODULE [symbol=value]...";
    LOG(INFO);
    LOG(INFO) << "Options:";
    LOG(INFO) << "  --all=FILE: FILE to acquire module names from";
@@ -189,6 +191,12 @@ extern "C" int modprobe_main(int argc, char** argv) {
        }
    }

    if (mod_dirs.empty()) {
        utsname uts;
        uname(&uts);
        mod_dirs.emplace_back(android::base::StringPrintf("/lib/modules/%s", uts.release));
    }

    LOG(DEBUG) << "mode is " << mode;
    LOG(DEBUG) << "mod_dirs is: " << android::base::Join(mod_dirs, " ");
    LOG(DEBUG) << "modules is: " << android::base::Join(modules, " ");