diff --git a/fastboot.c b/fastboot.c index c11fe5a..dc685da 100644 --- a/fastboot.c +++ b/fastboot.c @@ -77,7 +77,7 @@ static int fastboot_read(struct fastboot *fb, char *buf, size_t len) } return n - 4; } else if (strncmp(status, "FAIL", 4) == 0) { - fb->ops->tty_write(status + 4, n - 4, true); + fprintf(stderr, "%s\n", status + 4); return -ENXIO; } else if (strncmp(status, "DATA", 4) == 0) { return strtol(status + 4, NULL, 16); @@ -267,7 +267,7 @@ static int handle_udev_event(int fd, void *data) if (fastboot->ops && fastboot->ops->opened) fastboot->ops->opened(fastboot, fastboot->data); } else if (!strcmp(action, "remove")) { - if (strcmp(dev_path, fastboot->dev_path)) + if (!fastboot->dev_path || strcmp(dev_path, fastboot->dev_path)) goto unref_dev; close(fastboot->fd); diff --git a/fastboot.h b/fastboot.h index 27ecbd7..c1da59b 100644 --- a/fastboot.h +++ b/fastboot.h @@ -7,7 +7,6 @@ struct fastboot_ops { void (*opened)(struct fastboot *, void *); void (*disconnect)(void *); void (*info)(struct fastboot *, const void *, size_t); - ssize_t (*tty_write)(const void *, size_t, bool); }; struct fastboot *fastboot_open(const char *serial, struct fastboot_ops *ops, void *);