Skip to content

Commit 59ff716

Browse files
authored
Merge pull request #1630 from jimklimov/issue-1624
drivers/usbhid-ups.c: try to detect "Driver stale" situations when in "pollonly" mode
2 parents 06ca23e + 855a7ca commit 59ff716

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

drivers/usbhid-ups.c

+16-4
Original file line numberDiff line numberDiff line change
@@ -1955,11 +1955,23 @@ static bool_t hid_ups_walk(walkmode_t mode)
19551955

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

1961-
/* These need to be polled after user changes (setvar / instcmd) */
1962-
if ( (item->hidflags & HU_FLAG_SEMI_STATIC) && (data_has_changed == FALSE) )
1961+
/* These don't need polling after initinfo() normally
1962+
* However in "pollonly" mode we use these to detect "Data stale"
1963+
* condition (e.g. cable disconnected) by failing the reads:
1964+
*/
1965+
if ((item->hidflags & HU_FLAG_STATIC) && use_interrupt_pipe)
1966+
continue;
1967+
1968+
/* These need to be polled after user changes (setvar / instcmd)
1969+
* or to detect "Data stale" in "pollonly" mode
1970+
*/
1971+
if ( (item->hidflags & HU_FLAG_SEMI_STATIC)
1972+
&& (data_has_changed == FALSE)
1973+
&& use_interrupt_pipe
1974+
)
19631975
continue;
19641976

19651977
break;
@@ -2074,7 +2086,7 @@ static bool_t hid_ups_walk(walkmode_t mode)
20742086
if (ups_infoval_set(item, value) != 1)
20752087
continue;
20762088

2077-
if (mode == HU_WALKMODE_INIT) {
2089+
if (mode == HU_WALKMODE_INIT || (!use_interrupt_pipe)) {
20782090
info_lkp_t *info_lkp;
20792091

20802092
dstate_setflags(item->info_type, item->info_flags);

0 commit comments

Comments
 (0)