• Srinivas Pandruvada's avatar
    HID: hid-sensor-hub: Fix buggy report descriptors · 875e36f8
    Srinivas Pandruvada authored
    This addresses regression caused by commit id "751d17e2"
     iio: hid-sensors: Fix power and report state.
    This commit removed a quirk, to change the enumeration base
    to 1 from 0 based on an CONFIG paramter. There was objection to
    add more changes under this quirk, instead suggested to add an
    HID quirk. But there is no easy way to add HID qurik as the
    reports are not properly using collection class.
    
    The solution was to use logical minimum, which is a correct way.
    There were changes done in firmware to address this.
    
    Unfortunately some devices, still use old FW and can't be upgraded
    to newer version on Linux devices as there is no FW upgrade tool
    available for Linux devices. So we need to fix report descriptors,
    for such devices. This will not have any impact, if the FW uses
    logical 1 as minimum.
    
    In this patch we look for usage id for "power and report state", and
    modify logical minimum value to 1.
    
    Background on enum:
    In the original HID sensor hub firmwares all Named array enums were
    to 0-based. But the most recent hub implemented as 1-based,
    because of the implementation by one of the major OS vendor.
    Using logical minimum for the field as the base of enum. So we add
    logical minimum to the selector values before setting those fields.
    Some sensor hub FWs already changed logical minimum from 0 to 1
    to reflect this and hope every other vendor will follow.
    There is no easy way to add a common HID quirk for NAry elements,
    even if the standard specifies these field as NAry, the collection
    used to describe selectors is still just "logical".
    Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
    875e36f8
hid-sensor-hub.c 19 KB