Shouldn't the check of the button page remain in place, for identifying
plain old touchpads with external buttons?  Looking for the "Pad Type"
feature (HUD_BUTTON_TYPE in hid.h) doesn't make much sense for these
devices because the feature report is optional:

    "If the device has a non-button reporting digitizer surface and relies
    instead on external buttons only for mouse clicks, then this usage can
    be optionally reported."
    ( 
https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/touchpad-windows-precision-touchpad-collection
 )

It seems that we have, once more, a specification mess here.  My quote is
from the current web page, which describes the Pad Type as a three-valued
feature, with value 2 indicating a "Non-Clickable" touchpad.  HUT1_3_0.pdf
("HID Usage Tables") just states that
    "When set, the touchpad is non-depressible (pressure-pad); when clear,
    the touchpad is depressible (click-pad)." (p. 177)

A pad type and the HUP_BUTTON 1 feature (the "clickpad button") aren't
reported by the Synaptics touchpad on my Clevo N151CU, it correctly reports
only HUP_BUTTON 2 (the external left button) and 3 (the external right
button).

On 5/19/22 15:01, joshua stein wrote:
> Most Windows Precision Touchpad-style touchpads will be clickpads, 
> with no-button "pressure pad" style devices being the outlier.  Make 
> clickpad the default unless the report says otherwise.
> 
> This fixes the Framework laptop which has a PixArt touchpad with a 
> weird HID descriptor report which puts the button type on its own 
> report (so this heuristic doesn't find it) but also claims to have 3 
> buttons, failing the second heuristic.  If it's not setup as a 
> clickpad, wstpad doesn't do left/center/right button emulation 
> properly.
> 
> I'm curious if this breaks anyone's laptop, especially those ones 
> with a touchpad that also have a separate row of buttons like some 
> Dells.
> 
> 
> diff --git sys/dev/hid/hidmt.c sys/dev/hid/hidmt.c
> index 5ca26899e50..0baf724a9da 100644
> --- sys/dev/hid/hidmt.c
> +++ sys/dev/hid/hidmt.c
> @@ -149,16 +149,13 @@ hidmt_setup(struct device *self, struct hidmt *mt, void 
> *desc, int dlen)
>                       mt->sc_num_contacts = d;
>       }
>  
> -     /* find whether this is a clickpad or not */
> +     /* a "pressure pad" has no buttons, so wstpad needs to know */
> +     mt->sc_clickpad = 1;
>       if (hid_locate(desc, dlen, HID_USAGE2(HUP_DIGITIZERS, HUD_BUTTON_TYPE),
>           mt->sc_rep_cap, hid_feature, &cap, NULL)) {
>               d = hid_get_udata(rep, capsize, &cap);
> -             mt->sc_clickpad = (d == 0);
> -     } else {
> -             /* if there's not a 2nd button, this is probably a clickpad */
> -             if (!hid_locate(desc, dlen, HID_USAGE2(HUP_BUTTON, 2),
> -                 mt->sc_rep_input, hid_input, &cap, NULL))
> -                     mt->sc_clickpad = 1;
> +             if (d == 0x1)
> +                     mt->sc_clickpad = 0;
>       }
>  
>       /*
> 

Reply via email to