Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdba: add keys to press/release the fastboot button #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 3 additions & 0 deletions cdba.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ enum {
MSG_LIST_DEVICES,
MSG_BOARD_INFO,
MSG_FASTBOOT_CONTINUE,
MSG_FASTBOOT_BTN_PRESS,
MSG_FASTBOOT_BTN_RELEASE,

};

#endif
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
Loading