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

Commit 39a6ffe0 authored by Myles Watson's avatar Myles Watson
Browse files

Retry HID Polling when EINTR is returned



While I'm here
 - use __func__ consistently in btif_hh_poll_event_thread.
 - remove braces around a single line

BUG: 24647083
Change-Id: I80b99ff0d3ba6336f5ab7a517269fdf63df59b37
Signed-off-by: default avatarMyles Watson <mylesgw@google.com>
parent 5455dfa2
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;