usb: handle displayport debounce timer empty reads
If the device is unplugged then plugged before mDisplayPortDebounceTimer triggers, then the new displayPortPollWork could process the trigger in the intial epoll handling loop. Because the timer can be rearmed, the timerfd read results in -EAGAIN because no data is ready, but stale data was ready to begin with. Disarm the debounce timer when displayPortPollWork closes to prevent new work threads from reading timer when not ready. Also log debounce read errors as a warning and not an error. Test: manual test on device Bug: 328553922 Change-Id: Icf3dbe929eb9f0520941a4efe3dcea79a71d46c3 Signed-off-by: RD Babiera <rdbabiera@google.com>
This commit is contained in:
parent
f5f7a90578
commit
94c9c1ac86
1 changed files with 5 additions and 2 deletions
|
@ -1749,8 +1749,10 @@ void *displayPortPollWork(void *param) {
|
|||
std::vector<PortStatus> currentPortStatus;
|
||||
ret = read(usb->mDisplayPortDebounceTimer, &res, sizeof(res));
|
||||
ALOGI("usbdp: dp debounce triggered, val:%lu ret:%d", res, ret);
|
||||
if (ret < 0)
|
||||
ALOGE("usbdp: debounce read errno:%d", errno);
|
||||
if (ret < 0) {
|
||||
ALOGW("usbdp: debounce read error:%d", errno);
|
||||
continue;
|
||||
}
|
||||
queryVersionHelper(usb, ¤tPortStatus);
|
||||
} else if (events[n].data.fd == usb->mDisplayPortActivateTimer) {
|
||||
string activePartner, activePort;
|
||||
|
@ -1801,6 +1803,7 @@ void *displayPortPollWork(void *param) {
|
|||
|
||||
error:
|
||||
/* Need to disarm so new threads don't get old event */
|
||||
armTimerFdHelper(usb->mDisplayPortDebounceTimer, 0);
|
||||
armTimerFdHelper(usb->mDisplayPortActivateTimer, 0);
|
||||
close(link_training_status_fd);
|
||||
link_training_status_fd_error:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue