diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-28 03:12:05 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-28 03:12:05 +0000 |
commit | 6220136528a29e96838bf6e18ea81dad9995cecc (patch) | |
tree | 62d78b6f2b3873de7c078a44a0f7b294e68cdd7e /init/firmware_handler.cpp | |
parent | 8c2ad73742ead5dd9cec3ac78be9ca002ca8ee38 (diff) | |
parent | 0e68ab18fbef221e1a18fbf63babfd5d17bf3b2c (diff) |
Snap for 5608795 from 0e68ab18fbef221e1a18fbf63babfd5d17bf3b2c to rvc-release
Change-Id: I43f1c8b8baeaab87a6a5eb0d4821df44124bb622
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); |