diff options
Diffstat (limited to 'fastboot/engine.c')
-rw-r--r-- | fastboot/engine.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/fastboot/engine.c b/fastboot/engine.c index b07e742..972c4ed 100644 --- a/fastboot/engine.c +++ b/fastboot/engine.c @@ -36,7 +36,6 @@ #include <stdbool.h> #include <string.h> #include <sys/stat.h> -#include <sys/time.h> #include <sys/types.h> #include <unistd.h> @@ -48,34 +47,13 @@ #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) -double now() -{ - struct timeval tv; - gettimeofday(&tv, NULL); - return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; -} - -char *mkmsg(const char *fmt, ...) -{ - char buf[256]; - char *s; - va_list ap; - - va_start(ap, fmt); - vsprintf(buf, fmt, ap); - va_end(ap); - - s = strdup(buf); - if (s == 0) die("out of memory"); - return s; -} - #define OP_DOWNLOAD 1 #define OP_COMMAND 2 #define OP_QUERY 3 #define OP_NOTICE 4 #define OP_FORMAT 5 #define OP_DOWNLOAD_SPARSE 6 +#define OP_WAIT_FOR_DISCONNECT 7 typedef struct Action Action; @@ -573,6 +551,11 @@ void fb_queue_notice(const char *notice) a->data = (void*) notice; } +void fb_queue_wait_for_disconnect(void) +{ + queue_action(OP_WAIT_FOR_DISCONNECT, ""); +} + int fb_execute_queue(usb_handle *usb) { Action *a; @@ -614,6 +597,8 @@ int fb_execute_queue(usb_handle *usb) status = fb_download_data_sparse(usb, a->data); status = a->func(a, status, status ? fb_get_error() : ""); if (status) break; + } else if (a->op == OP_WAIT_FOR_DISCONNECT) { + usb_wait_for_disconnect(usb); } else { die("bogus action"); } |