Merge pull request #22 from lumag/set_active

device: support specifying active slot
This commit is contained in:
Konrad Dybcio
2023-09-21 12:43:18 +02:00
committed by GitHub
3 changed files with 6 additions and 3 deletions

View File

@@ -258,7 +258,7 @@ void device_boot(struct device *device, const void *data, size_t len)
{
warnx("booting the board...");
if (device->set_active)
fastboot_set_active(device->fastboot, "a");
fastboot_set_active(device->fastboot, device->set_active);
fastboot_download(device->fastboot, data, len);
device->boot(device);
}

View File

@@ -35,7 +35,7 @@ struct device {
void (*key)(struct device *device, int key, bool asserted);
void (*send_break)(struct device *dev);
bool set_active;
const char *set_active;
void *cdb;

View File

@@ -144,7 +144,10 @@ static void parse_board(struct device_parser *dp)
if (!dev->boot)
dev->boot = device_fastboot_boot;
} else if (!strcmp(key, "fastboot_set_active")) {
dev->set_active = !strcmp(value, "true");
if (!strcmp(value, "true"))
dev->set_active = "a";
else
dev->set_active = strdup(value);
} else if (!strcmp(key, "broken_fastboot_boot")) {
if (!strcmp(value, "true"))
dev->boot = device_fastboot_flash_reboot;