コード例 #1
0
void HDMIDaemon::processUevent()
{
    uevent event;
    if(processUeventMessage(event)) {
        if (event.action == action_offline) {
            ALOGD("processUevent: event.action == offline");
            mDriverOnline = true;
            sendCommandToFramework(false);
        } else if (event.action == action_online) {
            ALOGD("processUevent: event.action == online");
            mDriverOnline = true;
            sendCommandToFramework(true);
        }
    }
}
コード例 #2
0
void HDMIDaemon::processUeventQueue()
{
    HDMIUeventQueue* tmp = mHDMIUeventQueueHead, *tmp1;
    while (tmp != NULL) {
        tmp1 = tmp;
        if (tmp->mEvent.action == action_offline) {
            ALOGD("processUeventQueue: event.action == offline");
            mDriverOnline = true;
            sendCommandToFramework(false);
        } else if (tmp->mEvent.action == action_online) {
            ALOGD("processUeventQueue: event.action == online");
            mDriverOnline = true;
            sendCommandToFramework(true);
        }
        tmp = tmp->next;
        delete tmp1;
    }
    mHDMIUeventQueueHead = NULL;
}
コード例 #3
0
void HDMIDaemon::processUevent()
{
    uevent event;
    if(processUeventMessage(event)) {
        if (event.action) {
            LOGD("processUevent: event.action == %d", event.action);
            mDriverOnline = true;
            sendCommandToFramework(event.action);
        }
    }
}
コード例 #4
0
void HDMIDaemon::processUeventQueue()
{
    HDMIUeventQueue* tmp = mHDMIUeventQueueHead, *tmp1;
    while (tmp != NULL) {
        tmp1 = tmp;
        if (tmp->mEvent.action) {
            LOGD("processUeventQueue: event.action == %d", tmp->mEvent.action);
            mDriverOnline = true;
            sendCommandToFramework(tmp->mEvent.action);
        }
        tmp = tmp->next;
        delete tmp1;
    }
    mHDMIUeventQueueHead = NULL;
}
コード例 #5
0
bool HDMIDaemon::threadLoop()
{
    int max = -1;
    fd_set read_fds;
    FD_ZERO(&read_fds);

    FD_SET(mFrameworkSock, &read_fds);
    if (max < mFrameworkSock)
        max = mFrameworkSock;
    FD_SET(mUeventSock, &read_fds);
    if (max < mUeventSock)
        max = mUeventSock;

    if (mAcceptedConnection != -1) {
        FD_SET(mAcceptedConnection, &read_fds);
        if (max < mAcceptedConnection)
            max = mAcceptedConnection;
    }

    struct timeval to;
    to.tv_sec = (60 * 60);
    to.tv_usec = 0;

    int ret;
    if ((ret = select(max + 1, &read_fds, NULL, NULL, &to)) < 0) {
        ALOGE("select() failed (%s)", strerror(errno));
        sleep(1);
        return true;
    }

    if (!ret) {
        return true;
    }

    if (mAcceptedConnection != -1 && FD_ISSET(mAcceptedConnection, &read_fds)) {
        if (processFrameworkCommand() == -1)
            mAcceptedConnection = -1;
    }

    if (FD_ISSET(mFrameworkSock, &read_fds)) {
        struct sockaddr addr;
        socklen_t alen;
        alen = sizeof(addr);

        if (mAcceptedConnection != -1) {
            close(mAcceptedConnection);
            mAcceptedConnection = accept(mFrameworkSock, &addr, &alen);
            return true;
        }

        if ((mAcceptedConnection = accept(mFrameworkSock, &addr, &alen)) < 0) {
            ALOGE("Unable to accept framework connection (%s)",
                strerror(errno));
        }
        else {
            mSession = new SurfaceComposerClient();
            processUeventQueue();

            if (!mDriverOnline) {
                ALOGE("threadLoop: driver not online; use state-file");
                sendCommandToFramework(false);
            }
        }

        ALOGD("threadLoop: Accepted connection from framework");
    }

    if (FD_ISSET(mUeventSock, &read_fds)) {
        if (mAcceptedConnection == -1)
            queueUevent();
        else
            processUevent();
    }

    return true;
}