Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5c736bc authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge "Retry HID Polling when EINTR is returned"

parents 5a5b3b21 39a6ffe0
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ static inline pthread_t create_thread(void *(*start_routine)(void *), void * arg
static void *btif_hh_poll_event_thread(void *arg)
{
    btif_hh_device_t *p_dev = arg;
    APPL_TRACE_DEBUG("%s: Thread created fd = %d", __FUNCTION__, p_dev->fd);
    APPL_TRACE_DEBUG("%s: Thread created fd = %d", __func__, p_dev->fd);
    struct pollfd pfds[1];
    int ret;

@@ -208,17 +208,16 @@ static void *btif_hh_poll_event_thread(void *arg)
    while(p_dev->hh_keep_polling){
        ret = poll(pfds, 1, 50);
        if (ret < 0) {
            APPL_TRACE_ERROR("%s: Cannot poll for fds: %s\n", __FUNCTION__, strerror(errno));
            APPL_TRACE_ERROR("%s: Cannot poll for fds: %s\n", __func__, strerror(errno));
            break;
        }
        if (pfds[0].revents & POLLIN) {
            APPL_TRACE_DEBUG("btif_hh_poll_event_thread: POLLIN");
            APPL_TRACE_DEBUG("%s: POLLIN", __func__);
            ret = uhid_event(p_dev);
            if (ret){
            if (ret != -EINTR)
                break;
        }
    }
    }

    p_dev->hh_poll_thread_id = -1;
    return 0;