mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
cdba: Support sending break with CDB assist
Add special key 'B' to send a break, currently only implemented with the CDB assist. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
3
bad.c
3
bad.c
@@ -195,6 +195,9 @@ static int handle_stdin(int fd, void *buf)
|
||||
case MSG_VBUS_OFF:
|
||||
device_vbus(selected_device, false);
|
||||
break;
|
||||
case MSG_SEND_BREAK:
|
||||
device_send_break(selected_device);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "unk %d len %d\n", msg->type, msg->len);
|
||||
exit(1);
|
||||
|
||||
@@ -542,8 +542,10 @@ int cdb_target_write(struct device *dev, const void *buf, size_t len)
|
||||
return write(cdb->target_tty, buf, len);
|
||||
}
|
||||
|
||||
void cdb_target_break(struct cdb_assist *cdb)
|
||||
void cdb_send_break(struct device *dev)
|
||||
{
|
||||
struct cdb_assist *cdb = dev->cdb;
|
||||
|
||||
tcsendbreak(cdb->target_tty, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ int cdb_assist_power_off(struct device *dev);
|
||||
void cdb_assist_vbus(struct device *dev, bool on);
|
||||
void cdb_gpio(struct cdb_assist *cdb, int gpio, bool on);
|
||||
int cdb_target_write(struct device *dev, const void *buf, size_t len);
|
||||
void cdb_target_break(struct cdb_assist *cdb);
|
||||
void cdb_send_break(struct device *dev);
|
||||
unsigned int cdb_vref(struct cdb_assist *cdb);
|
||||
void cdb_assist_print_status(struct device *dev);
|
||||
void cdb_set_voltage(struct cdb_assist *cdb, unsigned mV);
|
||||
|
||||
8
cdba.c
8
cdba.c
@@ -193,11 +193,11 @@ static int tty_callback(int *ssh_fds)
|
||||
write(ssh_fds[0], &hdr, sizeof(hdr));
|
||||
write(ssh_fds[0], "\001", 1);
|
||||
break;
|
||||
#if 0
|
||||
case 'b':
|
||||
device_break(device);
|
||||
case 'B':
|
||||
hdr.type = MSG_SEND_BREAK;
|
||||
hdr.len = 0;
|
||||
write(ssh_fds[0], &hdr, sizeof(hdr));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
special = false;
|
||||
|
||||
1
cdba.h
1
cdba.h
@@ -27,6 +27,7 @@ enum {
|
||||
MSG_VBUS_ON,
|
||||
MSG_VBUS_OFF,
|
||||
MSG_FASTBOOT_REBOOT,
|
||||
MSG_SEND_BREAK,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
6
device.c
6
device.c
@@ -173,3 +173,9 @@ void device_fastboot_key(struct device *device, bool on)
|
||||
if (device->fastboot_key)
|
||||
device->fastboot_key(device, on);
|
||||
}
|
||||
|
||||
void device_send_break(struct device *device)
|
||||
{
|
||||
if (device->send_break)
|
||||
device->send_break(device);
|
||||
}
|
||||
|
||||
2
device.h
2
device.h
@@ -28,6 +28,7 @@ struct device {
|
||||
void (*vbus)(struct device *dev, bool on);
|
||||
int (*write)(struct device *dev, const void *buf, size_t len);
|
||||
void (*fastboot_key)(struct device *dev, bool on);
|
||||
void (*send_break)(struct device *dev);
|
||||
bool set_active;
|
||||
|
||||
void *cdb;
|
||||
@@ -50,5 +51,6 @@ void device_boot(struct device *device, const void *data, size_t len);
|
||||
void device_fastboot_boot(struct device *device);
|
||||
void device_fastboot_flash_reboot(struct device *device);
|
||||
void device_fastboot_key(struct device *device, bool on);
|
||||
void device_send_break(struct device *device);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -103,6 +103,7 @@ static void parse_board(struct device_parser *dp)
|
||||
dev->vbus = cdb_assist_vbus;
|
||||
dev->write = cdb_target_write;
|
||||
dev->fastboot_key = cdb_fastboot_key;
|
||||
dev->send_break = cdb_send_break;
|
||||
} else if (!strcmp(key, "conmux")) {
|
||||
dev->cdb_serial = strdup(value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user