IQ.Pilot Release Commit @ 92b3bb6
This commit is contained in:
@@ -300,6 +300,10 @@ def main(demo: bool = False) -> None:
|
||||
cloudlog.error(f"iqegpumodeld giving up after {attempt} setup failures; exiting for a clean restart")
|
||||
sys.exit(1)
|
||||
if not usbgpu_present():
|
||||
from iqpilot.system.hardware.usb import ensure_host_role
|
||||
if ensure_host_role():
|
||||
cloudlog.warning("iqegpumodeld: Type-C controller was out of host mode; restored")
|
||||
time.sleep(2.0)
|
||||
_wait_for_egpu(params)
|
||||
time.sleep(min(SETUP_RETRY_MAX_S, SETUP_RETRY_BASE_S * attempt))
|
||||
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
|
||||
const bool PANDAD_MAXOUT = getenv("PANDAD_MAXOUT") != nullptr;
|
||||
|
||||
std::string panda_firmware_path() {
|
||||
const char *runtime_path = getenv("IQPILOT_PANDA_FW_PATH");
|
||||
return runtime_path != nullptr ? runtime_path : PANDA_FW_PATH;
|
||||
}
|
||||
|
||||
Panda::Panda(std::string serial, uint32_t bus_offset) : bus_offset(bus_offset) {
|
||||
// try USB first, then SPI
|
||||
try {
|
||||
@@ -138,7 +143,7 @@ std::optional<std::string> Panda::get_serial() {
|
||||
bool Panda::up_to_date() {
|
||||
if (auto fw_sig = get_firmware_version()) {
|
||||
for (auto fn : { "panda.bin.signed", "panda_h7.bin.signed" }) {
|
||||
auto content = util::read_file(std::string(PANDA_FW_PATH) + fn);
|
||||
auto content = util::read_file(panda_firmware_path() + fn);
|
||||
if (content.size() >= fw_sig->size() &&
|
||||
memcmp(content.data() + content.size() - fw_sig->size(), fw_sig->data(), fw_sig->size()) == 0) {
|
||||
return true;
|
||||
|
||||
@@ -42,6 +42,7 @@ struct can_frame {
|
||||
long src;
|
||||
};
|
||||
|
||||
std::string panda_firmware_path();
|
||||
|
||||
class Panda {
|
||||
private:
|
||||
|
||||
@@ -77,6 +77,8 @@ def check_panda_support(panda) -> bool:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
os.environ["IQPILOT_PANDA_FW_PATH"] = FW_PATH
|
||||
|
||||
# signal pandad to close the relay and exit
|
||||
def signal_handler(signum, frame):
|
||||
cloudlog.info(f"Caught signal {signum}, exiting")
|
||||
|
||||
@@ -133,3 +133,11 @@ TEST_CASE("send/recv CAN FD packets") {
|
||||
test.test_can_recv(0x40);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("firmware path runtime override") {
|
||||
unsetenv("IQPILOT_PANDA_FW_PATH");
|
||||
REQUIRE(panda_firmware_path() == PANDA_FW_PATH);
|
||||
setenv("IQPILOT_PANDA_FW_PATH", "/runtime/panda/board/obj/", 1);
|
||||
REQUIRE(panda_firmware_path() == "/runtime/panda/board/obj/");
|
||||
unsetenv("IQPILOT_PANDA_FW_PATH");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user