diff options
author | Tom Cherry <tomcherry@google.com> | 2019-05-23 16:26:57 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2019-05-23 16:27:33 -0700 |
commit | d38aafd20b3fe9a791921f526a9a2579b2be3f6e (patch) | |
tree | 0aabbe9af0cc494f0330715b5009e646d735c3b6 /init/firmware_handler.cpp | |
parent | 691e0e154ad3d666bcd3fb6d21c563700a31ff2f (diff) |
ueventd: add more logging when firmware loading fails
Bug: 130131892
Test: boots
Change-Id: I82ce0f72341bb44590177cedaa2e3a7990456c1d
Diffstat (limited to 'init/firmware_handler.cpp')
-rw-r--r-- | init/firmware_handler.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/init/firmware_handler.cpp b/init/firmware_handler.cpp index 740e82c99..c067f6f2d 100644 --- a/init/firmware_handler.cpp +++ b/init/firmware_handler.cpp @@ -80,15 +80,26 @@ void FirmwareHandler::ProcessFirmwareEvent(const Uevent& uevent) { return; } + std::vector<std::string> attempted_paths_and_errors; + try_loading_again: + attempted_paths_and_errors.clear(); for (const auto& firmware_directory : firmware_directories_) { std::string file = firmware_directory + uevent.firmware; unique_fd fw_fd(open(file.c_str(), O_RDONLY | O_CLOEXEC)); + if (fw_fd == -1) { + attempted_paths_and_errors.emplace_back("firmware: attempted " + file + + ", open failed: " + strerror(errno)); + continue; + } struct stat sb; - if (fw_fd != -1 && fstat(fw_fd, &sb) != -1) { - LoadFirmware(uevent, root, fw_fd, sb.st_size, loading_fd, data_fd); - return; + if (fstat(fw_fd, &sb) == -1) { + attempted_paths_and_errors.emplace_back("firmware: attempted " + file + + ", fstat failed: " + strerror(errno)); + continue; } + LoadFirmware(uevent, root, fw_fd, sb.st_size, loading_fd, data_fd); + return; } if (booting) { @@ -100,6 +111,9 @@ try_loading_again: } LOG(ERROR) << "firmware: could not find firmware for " << uevent.firmware; + for (const auto& message : attempted_paths_and_errors) { + LOG(ERROR) << message; + } // Write "-1" as our response to the kernel's firmware request, since we have nothing for it. write(loading_fd, "-1", 2); |