4e9f147e55
Adds pawlethwd, a native C++ system_ext daemon (coredomain) that detects peripherals, checks the hardware update catalog (ota.php?mode=hardware), verifies payloads, and flashes firmware via authorized handler plugins. - daemon/: manifest parse, libcurl HTTP + sha256, sysfs USB detection, catalog client, dlopen handler registry (fixed path + ABI + allowlist), state persistence, orchestration engine, AIDL service, main. - aidl/: IPawletHardwareUpdate (getComponents/getPendingUpdates/checkNow/...). - include/pawlet/hwh_abi.h: stable C plugin ABI. - handlers/usbdfu/: libpawlethwh_usbdfu.so, DFU 1.1 download over libusb. - sepolicy/: pawlethwd domain, pawlet_hw_data_file, service type. - schemas/, etc/supported_hardware.default.json, README design doc. - hwupdate.mk wires packages + ro.pawlet.hardware.manifest + sepolicy dir; inherited from config/common.mk. Trust: a server-named installer handler is honored only if allowlisted in the immutable supported_hardware.json, maps to a fixed dm-verity-protected .so path, is ABI/id-checked, and every payload is sha256-verified before a handler runs.
60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
/*
|
|
* Copyright (C) 2026 oxmc / PawletOS
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#include "service.h"
|
|
|
|
namespace pawlet::hwupdate {
|
|
|
|
namespace aidl = ::me::pawlet::hardware::update;
|
|
using ::android::binder::Status;
|
|
|
|
Status HwUpdateService::getComponents(::std::vector<aidl::HwComponent>* out) {
|
|
out->clear();
|
|
for (const auto& c : engine_->Components()) {
|
|
aidl::HwComponent hc;
|
|
hc.componentId = c.componentId;
|
|
hc.productId = c.productId;
|
|
hc.componentClass = c.componentClass;
|
|
hc.role = c.role;
|
|
hc.transport = c.transport;
|
|
hc.present = c.present;
|
|
hc.installedVersion = c.installedVersion;
|
|
hc.hardwareRevision = c.hardwareRevision;
|
|
hc.support = c.support;
|
|
out->push_back(std::move(hc));
|
|
}
|
|
return Status::ok();
|
|
}
|
|
|
|
Status HwUpdateService::getPendingUpdates(::std::vector<aidl::HwUpdateInfo>* out) {
|
|
out->clear();
|
|
for (const auto& p : engine_->Pending()) {
|
|
aidl::HwUpdateInfo hu;
|
|
hu.componentId = p.componentId;
|
|
hu.available = p.available;
|
|
hu.version = p.version;
|
|
hu.sizeBytes = p.sizeBytes;
|
|
hu.changelogUrl = p.changelogUrl;
|
|
out->push_back(std::move(hu));
|
|
}
|
|
return Status::ok();
|
|
}
|
|
|
|
Status HwUpdateService::checkNow() {
|
|
engine_->CheckNow();
|
|
return Status::ok();
|
|
}
|
|
|
|
Status HwUpdateService::isBusy(bool* out) {
|
|
*out = engine_->IsBusy();
|
|
return Status::ok();
|
|
}
|
|
|
|
Status HwUpdateService::getLastResult(int32_t* out) {
|
|
*out = engine_->LastResult();
|
|
return Status::ok();
|
|
}
|
|
|
|
} // namespace pawlet::hwupdate
|