Skip to content

Commit

Permalink
cdba: add keys to press/release the fastboot button
Browse files Browse the repository at this point in the history
For some testing it's useful to manually press the fastboot button.
Add support for doing this.

Signed-off-by: Caleb Connolly <[email protected]>
  • Loading branch information
calebccff committed May 19, 2024
1 parent f4e95f6 commit 84cfa2f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cdba-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ static int handle_stdin(int fd, void *buf)
case MSG_FASTBOOT_CONTINUE:
msg_fastboot_continue();
break;
case MSG_FASTBOOT_BTN_PRESS:
device_key(selected_device, DEVICE_KEY_FASTBOOT, true);
break;
case MSG_FASTBOOT_BTN_RELEASE:
device_key(selected_device, DEVICE_KEY_FASTBOOT, false);
break;
default:
fprintf(stderr, "unk %d len %d\n", msg->type, msg->len);
exit(1);
Expand Down
6 changes: 6 additions & 0 deletions cdba.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ static int tty_callback(int *ssh_fds)
case 'B':
cdba_send(ssh_fds[0], MSG_SEND_BREAK);
break;
case 'f':
cdba_send(ssh_fds[0], MSG_FASTBOOT_BTN_PRESS);
break;
case 'F':
cdba_send(ssh_fds[0], MSG_FASTBOOT_BTN_RELEASE);
break;
}

special = false;
Expand Down
2 changes: 2 additions & 0 deletions cdba.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ enum {
MSG_FASTBOOT_PRESENT,
MSG_FASTBOOT_DOWNLOAD,
MSG_FASTBOOT_BOOT,
MSG_FASTBOOT_BTN_PRESS,
MSG_FASTBOOT_BTN_RELEASE,
MSG_STATUS_UPDATE,
MSG_VBUS_ON,
MSG_VBUS_OFF,
Expand Down
2 changes: 1 addition & 1 deletion device.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static void device_impl_power(struct device *device, bool on)
device_control(device, power, on);
}

static void device_key(struct device *device, int key, bool asserted)
void device_key(struct device *device, int key, bool asserted)
{
if (device_has_control(device, key))
device_control(device, key, key, asserted);
Expand Down
1 change: 1 addition & 0 deletions device.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ int device_power(struct device *device, bool on);
void device_status_enable(struct device *device);
void device_usb(struct device *device, bool on);
int device_write(struct device *device, const void *buf, size_t len);
void device_key(struct device *device, int key, bool asserted);

void device_boot(struct device *device, const void *data, size_t len);

Expand Down

0 comments on commit 84cfa2f

Please sign in to comment.