• Benjamin Tissoires's avatar
    HID: remove initial reading of reports at connect · 9143059f
    Benjamin Tissoires authored
    It looks like a bunch of devices do not like to be polled
    for their reports at init time. When you look into the details,
    it seems that for those that are requiring the quirk
    HID_QUIRK_NO_INIT_REPORTS, the driver fails to retrieve part
    of the features/inputs while others (more generic) work.
    
    IMO, it should be acceptable to remove the need for the quirk
    in the general case. On the small amount of cases where
    we actually need to read the current values, the driver
    in charge (hid-mt or wacom) already retrieves the features
    manually.
    
    There are 2 cases where we might need to retrieve the reports at
    init:
    1. hiddev devices with specific use-space tool
    2. a device that would require the driver to fetch a specific
       feature/input at plug
    
    For case 2, I have seen this a few time on hid-multitouch. It
    is solved in hid-multitouch directly by fetching the feature.
    I hope it won't be too common and this can be solved on a per-case
    basis (crossing fingers).
    
    For case 1, we moved the implementation of HID_QUIRK_NO_INIT_REPORTS
    in hiddev. When somebody starts calling ioctls that needs an initial
    update, the hiddev device will fetch the initial state of the reports
    to mimic the current behavior. This adds a small amount of time during
    the first HIDIOCGUSAGE(S), but it should be acceptable in
    most cases. To keep the currently known broken devices, we have to
    keep around HID_QUIRK_NO_INIT_REPORTS, but the scope will only be
    for hiddev.
    
    Note that I don't think hidraw would be affected and I checked that
    the FF drivers that need to interact with the report fields are all
    using output reports, which are not initialized by
    usbhid_init_reports().
    
    NO_INIT_INPUT_REPORTS is then replaced by HID_QUIRK_NO_INIT_REPORTS:
    there is no point keeping it for just one device.
    Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
    Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
    9143059f
hid.h 34.7 KB