Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/usbhid-ups.c: try to detect "Driver stale" situations when in "pollonly" mode #1630

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions drivers/usbhid-ups.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,11 +1422,23 @@ static bool_t hid_ups_walk(walkmode_t mode)

case HU_WALKMODE_FULL_UPDATE:
/* These don't need polling after initinfo() */
if (item->hidflags & (HU_FLAG_ABSENT | HU_TYPE_CMD | HU_FLAG_STATIC))
if (item->hidflags & (HU_FLAG_ABSENT | HU_TYPE_CMD))
continue;

/* These need to be polled after user changes (setvar / instcmd) */
if ( (item->hidflags & HU_FLAG_SEMI_STATIC) && (data_has_changed == FALSE) )
/* These don't need polling after initinfo() normally
* However in "pollonly" mode we use these to detect "Data stale"
* condition (e.g. cable disconnected) by failing the reads:
*/
if ((item->hidflags & HU_FLAG_STATIC) && use_interrupt_pipe)
continue;

/* These need to be polled after user changes (setvar / instcmd)
* or to detect "Data stale" in "pollonly" mode
*/
if ( (item->hidflags & HU_FLAG_SEMI_STATIC)
&& (data_has_changed == FALSE)
&& use_interrupt_pipe
)
continue;

break;
Expand Down Expand Up @@ -1530,7 +1542,7 @@ static bool_t hid_ups_walk(walkmode_t mode)
if (ups_infoval_set(item, value) != 1)
continue;

if (mode == HU_WALKMODE_INIT) {
if (mode == HU_WALKMODE_INIT || (!use_interrupt_pipe)) {
info_lkp_t *info_lkp;

dstate_setflags(item->info_type, item->info_flags);
Expand Down