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

Commit 3e4159a2 authored by Luca Stefani's avatar Luca Stefani
Browse files

firmware_handler: Print full FW path before loading

As of now ueventd only prints the firmware name
requested by the uevent, but in case the device
has multiple firmware going by the same name it's
more interesting to know what file ends up actually
being used for the firmware request.

Test: m, check logcat
Change-Id: Ia90d387f09789d8e8b337a1a178144fad553d37b
parent 09071c46
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -264,8 +264,9 @@ std::string FirmwareHandler::GetFirmwarePath(const Uevent& uevent) const {
    return uevent.firmware;
}

void FirmwareHandler::ProcessFirmwareEvent(const std::string& root,
void FirmwareHandler::ProcessFirmwareEvent(const std::string& path,
                                           const std::string& firmware) const {
    std::string root = "/sys" + path;
    std::string loading = root + "/loading";
    std::string data = root + "/data";

@@ -296,6 +297,7 @@ void FirmwareHandler::ProcessFirmwareEvent(const std::string& root,
                                                    ", fstat failed: " + strerror(errno));
            return false;
        }
        LOG(INFO) << "found " << file << " for " << path;
        LoadFirmware(firmware, root, fw_fd.get(), sb.st_size, loading_fd.get(), data_fd.get());
        return true;
    };
@@ -362,7 +364,7 @@ void FirmwareHandler::HandleUevent(const Uevent& uevent) {
    if (pid == 0) {
        Timer t;
        auto firmware = GetFirmwarePath(uevent);
        ProcessFirmwareEvent("/sys" + uevent.path, firmware);
        ProcessFirmwareEvent(uevent.path, firmware);
        LOG(INFO) << "loading " << uevent.path << " took " << t;
        _exit(EXIT_SUCCESS);
    }
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ class FirmwareHandler : public UeventHandler {
    Result<std::string> RunExternalHandler(const std::string& handler, uid_t uid, gid_t gid,
                                           const Uevent& uevent) const;
    std::string GetFirmwarePath(const Uevent& uevent) const;
    void ProcessFirmwareEvent(const std::string& root, const std::string& firmware) const;
    void ProcessFirmwareEvent(const std::string& path, const std::string& firmware) const;
    bool ForEachFirmwareDirectory(std::function<bool(const std::string&)> handler) const;

    std::vector<std::string> firmware_directories_;