diff --git a/cdba-server.c b/cdba-server.c index 2b16661..82984e7 100644 --- a/cdba-server.c +++ b/cdba-server.c @@ -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); diff --git a/cdba.c b/cdba.c index 1809423..9e392ba 100644 --- a/cdba.c +++ b/cdba.c @@ -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; diff --git a/cdba.h b/cdba.h index 0264c40..11d82db 100644 --- a/cdba.h +++ b/cdba.h @@ -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, diff --git a/device.c b/device.c index 848f552..30d7b61 100644 --- a/device.c +++ b/device.c @@ -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); diff --git a/device.h b/device.h index 75a780a..9c708d1 100644 --- a/device.h +++ b/device.h @@ -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);