diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c index 67a01dd0d..c5afbb9a9 100644 --- a/system/fastboot/fastboot.c +++ b/system/fastboot/fastboot.c @@ -43,13 +43,13 @@ #include #include +#include #include #include #include #include #include #include -#include #include /**************************************************************************** @@ -980,14 +980,27 @@ static void fastboot_oem(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) static void fastboot_command_loop(FAR struct fastboot_ctx_s *ctx) { + struct epoll_event ev[1]; + int epfd; + if (ctx->left > 0) { - struct pollfd fds[1]; + epfd = epoll_create(1); + if (epfd < 0) + { + fb_err("open epoll failed %d", errno); + return; + } - fds[0].fd = ctx->tran_fd[0]; - fds[0].events = POLLIN; + ev[0].events = EPOLLIN; + ev[0].data.ptr = ctx; + if (epoll_ctl(epfd, EPOLL_CTL_ADD, ctx->tran_fd[0], &ev[0]) < 0) + { + fb_err("err add poll %d", ctx->tran_fd[0]); + return; + } - if (poll(fds, 1, ctx->left) <= 0) + if (epoll_wait(epfd, ev, nitems(ev), ctx->left) <= 0) { return; }