On Thu, Sep 10, 2020 at 10:13:30AM +0200, Tobias Heider wrote:
> Hi,
> 
> the newer Geyser 2 touchpad has only 9 sensors in the Y-direction instead
> of 16 like the other Apple touch pads.
> The driver sets sc_y_sensors correctly and then immediately overwrites
> it with the wrong default.
> I think we should first set the defaults and then treat the special
> cases.
> 
> ok?

*not* ok

> Index: utpms.c
> ===================================================================
> RCS file: /mount/openbsd/cvs/src/sys/dev/usb/utpms.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 utpms.c
> --- utpms.c   25 Aug 2020 14:01:58 -0000      1.9
> +++ utpms.c   9 Sep 2020 22:45:42 -0000
> @@ -311,6 +311,13 @@ utpms_attach(struct device *parent, stru
>               for (i = 0; i < nitems(utpms_devices); i++) {
>                       pd = &utpms_devices[i];
>                       if (product == pd->product && vendor == pd->vendor) {
> +                             printf(" Trackpad\n");

You moved the printf, that's wrong.  I guess your dmesg will look like:

utpms0 Trackpad
: GeyserANOTHERDRIVER: lalala

but it is supposed to be:

utpms0: Geyser Trackpad
ANOTHERDRIVER: lalala

> +                             sc->sc_noise = pd->noise;
> +                             sc->sc_threshold = pd->threshold;
> +                             sc->sc_x_factor = pd->x_factor;
> +                             sc->sc_x_sensors = pd->x_sensors;
> +                             sc->sc_y_factor = pd->y_factor;
> +                             sc->sc_y_sensors = pd->y_sensors;
>                               switch (pd->type) {
>                               case FOUNTAIN:
>                                       printf(": Fountain");
> @@ -325,13 +332,6 @@ utpms_attach(struct device *parent, stru
>                                       printf(": Geyser 2");
>                                       break;
>                               }
> -                             printf(" Trackpad\n");

So, the " Trackpad\n" printf *needs* to stay here while the rest can
happily move upstairs.

With that fixed, ok patrick@

> -                             sc->sc_noise = pd->noise;
> -                             sc->sc_threshold = pd->threshold;
> -                             sc->sc_x_factor = pd->x_factor;
> -                             sc->sc_x_sensors = pd->x_sensors;
> -                             sc->sc_y_factor = pd->y_factor;
> -                             sc->sc_y_sensors = pd->y_sensors;
>                               break;
>                       }
>               }
> 

Reply via email to