Re: removing wsmouse_input [2]: zts, hilms, uts

2016-06-06 Thread Ulf Brosziewski
The input functions of wsmouse have changed completely,
this also concerns ums/hidms. All tests are - and will
be - welcome ;-)

On 06/06/2016 11:31 PM, Edd Barrett wrote:
> On Mon, Jun 06, 2016 at 01:53:01PM +0200, Stefan Sperling wrote:
>> On Mon, Jun 06, 2016 at 12:40:24PM +0100, Edd Barrett wrote:
>>> I have a uts.
>>>
>>> I can test later. Am I expecting to see any functional change?
>>
>> No change is expected. It should just work.
> 
> Ah, my apologies, my touchscreen is attaching to ums.
> 
> ums2 at uhidev4 reportid 2: 3 buttons, tip, barrel, eraser
> wsmouse3 at ums2 mux 0
> 
> 
> P.S.
> 
> Please feel free to CC me if there is any touch-screen related diffs
> that I could test with my touchscreen. Although I have a touch-screen,
> and despite a bit of hacking a few years back to get it working at all,
> the support is still not good, and thus I have barely used it.
> 
> My touch-screen has issues with suspend:
> http://marc.info/?l=openbsd-bugs=146504820529987=2
> 
> And we currently do not correctly transpose X co-ordinates when randr is
> used to rotate the screen.
> 
> Cheers
> 



Re: removing wsmouse_input [2]: zts, hilms, uts

2016-06-06 Thread Edd Barrett
On Mon, Jun 06, 2016 at 01:53:01PM +0200, Stefan Sperling wrote:
> On Mon, Jun 06, 2016 at 12:40:24PM +0100, Edd Barrett wrote:
> > I have a uts.
> > 
> > I can test later. Am I expecting to see any functional change?
> 
> No change is expected. It should just work.

Ah, my apologies, my touchscreen is attaching to ums.

ums2 at uhidev4 reportid 2: 3 buttons, tip, barrel, eraser
wsmouse3 at ums2 mux 0


P.S.

Please feel free to CC me if there is any touch-screen related diffs
that I could test with my touchscreen. Although I have a touch-screen,
and despite a bit of hacking a few years back to get it working at all,
the support is still not good, and thus I have barely used it.

My touch-screen has issues with suspend:
http://marc.info/?l=openbsd-bugs=146504820529987=2

And we currently do not correctly transpose X co-ordinates when randr is
used to rotate the screen.

Cheers

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk



Re: removing wsmouse_input [2]: zts, hilms, uts

2016-06-06 Thread Stefan Sperling
On Mon, Jun 06, 2016 at 12:40:24PM +0100, Edd Barrett wrote:
> I have a uts.
> 
> I can test later. Am I expecting to see any functional change?

No change is expected. It should just work.



Re: removing wsmouse_input [2]: zts, hilms, uts

2016-06-06 Thread Edd Barrett
I have a uts.

I can test later. Am I expecting to see any functional change?



On 5 June 2016 15:55:19 BST, Mark Kettenis  wrote:
>> From: Ulf Brosziewski 
>> Date: Sun, 5 Jun 2016 09:55:07 +0200
>> 
>> ok?
>
>Would have been nice if somebody with zts(4) or uts(4) would have
>tested this, but we have to move forwards.
>
>ok kettenis@
>
>> On 06/01/2016 01:23 AM, Ulf Brosziewski wrote:
>> > zts, hilms, and uts are the drivers that still use wsmouse_input
>> > with absolute coordinates (or with both types of coordinates).
>> > The new, "flag-less" interface of wsmouse requires calls of
>> > wsmouse_position, and, possibly, of wsmouse_touch in this case.
>> > 
>> > Questions, tests and OKs would be welcome.
>> > 
>> > 
>> > Index: arch/zaurus/dev/zts.c
>> > ===
>> > RCS file: /cvs/src/sys/arch/zaurus/dev/zts.c,v
>> > retrieving revision 1.16
>> > diff -u -p -r1.16 zts.c
>> > --- arch/zaurus/dev/zts.c  29 Mar 2014 18:09:30 -  1.16
>> > +++ arch/zaurus/dev/zts.c  31 May 2016 19:23:10 -
>> > @@ -544,10 +544,9 @@ zts_irq(void *v)
>> >DPRINTF(("%s: tp.z = %d, tp.x = %d, tp.y = %d\n",
>> >sc->sc_dev.dv_xname, tp.z, tp.x, tp.y));
>> >  
>> > -  wsmouse_input(sc->sc_wsmousedev, down, tp.x, tp.y,
>> > -  0 /* z */, 0 /* w */,
>> > -  WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
>> > -  WSMOUSE_INPUT_ABSOLUTE_Z);
>> > +  wsmouse_buttons(sc->sc_wsmousedev, down);
>> > +  wsmouse_position(sc->sc_wsmousedev, tp.x, tp.y);
>> > +  wsmouse_input_sync(sc->sc_wsmousedev);
>> >sc->sc_buttons = down;
>> >sc->sc_oldx = tp.x;
>> >sc->sc_oldy = tp.y;
>> > Index: dev/hil/hilms.c
>> > ===
>> > RCS file: /cvs/src/sys/dev/hil/hilms.c,v
>> > retrieving revision 1.5
>> > diff -u -p -r1.5 hilms.c
>> > --- dev/hil/hilms.c10 Apr 2007 22:37:17 -  1.5
>> > +++ dev/hil/hilms.c31 May 2016 19:23:10 -
>> > @@ -219,7 +219,7 @@ void
>> >  hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t
>*buf)
>> >  {
>> >struct hilms_softc *sc = (struct hilms_softc *)dev;
>> > -  int type, flags;
>> > +  int type;
>> >int dx, dy, dz, button;
>> >  #ifdef DIAGNOSTIC
>> >int minlen;
>> > @@ -256,9 +256,6 @@ hilms_callback(struct hildev_softc *dev,
>> > */
>> >  
>> >if (type & HIL_MOUSEMOTION) {
>> > -  flags = sc->sc_features & HIL_ABSOLUTE ?
>> > -  WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
>> > -  WSMOUSE_INPUT_ABSOLUTE_Z : WSMOUSE_INPUT_DELTA;
>> >if (sc->sc_features & HIL_16_BITS) {
>> >dx = *buf++;
>> >dx |= (*buf++) << 8;
>> > @@ -302,8 +299,7 @@ hilms_callback(struct hildev_softc *dev,
>> >if ((sc->sc_features & HIL_ABSOLUTE) == 0 &&
>> >sc->sc_buttons == 0)
>> >dy = -dy;
>> > -  } else
>> > -  dx = dy = dz = flags = 0;
>> > +  }
>> >  
>> >if (type & HIL_MOUSEBUTTON) {
>> >button = *buf;
>> > @@ -332,7 +328,18 @@ hilms_callback(struct hildev_softc *dev,
>> >/* buf++; */
>> >}
>> >
>> > -  if (sc->sc_wsmousedev != NULL)
>> > -  wsmouse_input(sc->sc_wsmousedev,
>> > -  sc->sc_buttonstate, dx, dy, dz, 0, flags);
>> > +  if (sc->sc_wsmousedev == NULL)
>> > +  return;
>> > +
>> > +  wsmouse_buttons(sc->sc_wsmousedev, sc->sc_buttonstate);
>> > +  if (type & HIL_MOUSEMOTION) {
>> > +  if ((sc->sc_features & HIL_ABSOLUTE) == 0) {
>> > +  wsmouse_motion(sc->sc_wsmousedev, dx, dy, dz, 0);
>> > +  } else {
>> > +  wsmouse_position(sc->sc_wsmousedev, dx, dy);
>> > +  if (sc->sc_axes > 2)
>> > +  wsmouse_touch(sc->sc_wsmousedev, dz, 0);
>> > +  }
>> > +  }
>> > +  wsmouse_input_sync(sc->sc_wsmousedev);
>> >  }
>> > Index: dev/usb/uts.c
>> > ===
>> > RCS file: /cvs/src/sys/dev/usb/uts.c,v
>> > retrieving revision 1.37
>> > diff -u -p -r1.37 uts.c
>> > --- dev/usb/uts.c  10 Feb 2016 05:49:50 -  1.37
>> > +++ dev/usb/uts.c  31 May 2016 19:23:12 -
>> > @@ -476,9 +476,7 @@ uts_intr(struct usbd_xfer *xfer, void *a
>> >DPRINTF(("%s: tp.down = %d, tp.z = %d, tp.x = %d, tp.y = %d\n",
>> >sc->sc_dev.dv_xname, tp.down, tp.z, tp.x, tp.y));
>> >  
>> > -  wsmouse_input(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0,
>> > -  WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
>> > -  WSMOUSE_INPUT_ABSOLUTE_Z);
>> > +  WSMOUSE_TOUCH(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0);
>> >sc->sc_oldy = tp.y;
>> >sc->sc_oldx = tp.x;
>> >  
>> > 
>> > 
>> 
>> 

-- 
Sent from my Android 

Re: removing wsmouse_input [2]: zts, hilms, uts

2016-06-05 Thread Ulf Brosziewski
Again, I think the risk is small. A test with hilms would have
been nice, of course (unfortunately, I didn't succeed in contacting
Miod).

On 06/05/16 10:38, Stefan Sperling wrote:
> On Sun, Jun 05, 2016 at 09:55:07AM +0200, Ulf Brosziewski wrote:
>> ok?
> 
> Again, I can't test this, but it's ok by me.
> 
> I like the new wsmouse interface a lot better than the old one.
> 
>> On 06/01/2016 01:23 AM, Ulf Brosziewski wrote:
>>> zts, hilms, and uts are the drivers that still use wsmouse_input
>>> with absolute coordinates (or with both types of coordinates).
>>> The new, "flag-less" interface of wsmouse requires calls of
>>> wsmouse_position, and, possibly, of wsmouse_touch in this case.
>>>
>>> Questions, tests and OKs would be welcome.
>>>
>>>
>>> Index: arch/zaurus/dev/zts.c
>>> ===
>>> RCS file: /cvs/src/sys/arch/zaurus/dev/zts.c,v
>>> retrieving revision 1.16
>>> diff -u -p -r1.16 zts.c
>>> --- arch/zaurus/dev/zts.c   29 Mar 2014 18:09:30 -  1.16
>>> +++ arch/zaurus/dev/zts.c   31 May 2016 19:23:10 -
>>> @@ -544,10 +544,9 @@ zts_irq(void *v)
>>> DPRINTF(("%s: tp.z = %d, tp.x = %d, tp.y = %d\n",
>>> sc->sc_dev.dv_xname, tp.z, tp.x, tp.y));
>>>  
>>> -   wsmouse_input(sc->sc_wsmousedev, down, tp.x, tp.y,
>>> -   0 /* z */, 0 /* w */,
>>> -   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
>>> -   WSMOUSE_INPUT_ABSOLUTE_Z);
>>> +   wsmouse_buttons(sc->sc_wsmousedev, down);
>>> +   wsmouse_position(sc->sc_wsmousedev, tp.x, tp.y);
>>> +   wsmouse_input_sync(sc->sc_wsmousedev);
>>> sc->sc_buttons = down;
>>> sc->sc_oldx = tp.x;
>>> sc->sc_oldy = tp.y;
>>> Index: dev/hil/hilms.c
>>> ===
>>> RCS file: /cvs/src/sys/dev/hil/hilms.c,v
>>> retrieving revision 1.5
>>> diff -u -p -r1.5 hilms.c
>>> --- dev/hil/hilms.c 10 Apr 2007 22:37:17 -  1.5
>>> +++ dev/hil/hilms.c 31 May 2016 19:23:10 -
>>> @@ -219,7 +219,7 @@ void
>>>  hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
>>>  {
>>> struct hilms_softc *sc = (struct hilms_softc *)dev;
>>> -   int type, flags;
>>> +   int type;
>>> int dx, dy, dz, button;
>>>  #ifdef DIAGNOSTIC
>>> int minlen;
>>> @@ -256,9 +256,6 @@ hilms_callback(struct hildev_softc *dev,
>>>  */
>>>  
>>> if (type & HIL_MOUSEMOTION) {
>>> -   flags = sc->sc_features & HIL_ABSOLUTE ?
>>> -   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
>>> -   WSMOUSE_INPUT_ABSOLUTE_Z : WSMOUSE_INPUT_DELTA;
>>> if (sc->sc_features & HIL_16_BITS) {
>>> dx = *buf++;
>>> dx |= (*buf++) << 8;
>>> @@ -302,8 +299,7 @@ hilms_callback(struct hildev_softc *dev,
>>> if ((sc->sc_features & HIL_ABSOLUTE) == 0 &&
>>> sc->sc_buttons == 0)
>>> dy = -dy;
>>> -   } else
>>> -   dx = dy = dz = flags = 0;
>>> +   }
>>>  
>>> if (type & HIL_MOUSEBUTTON) {
>>> button = *buf;
>>> @@ -332,7 +328,18 @@ hilms_callback(struct hildev_softc *dev,
>>> /* buf++; */
>>> }
>>> 
>>> -   if (sc->sc_wsmousedev != NULL)
>>> -   wsmouse_input(sc->sc_wsmousedev,
>>> -   sc->sc_buttonstate, dx, dy, dz, 0, flags);
>>> +   if (sc->sc_wsmousedev == NULL)
>>> +   return;
>>> +
>>> +   wsmouse_buttons(sc->sc_wsmousedev, sc->sc_buttonstate);
>>> +   if (type & HIL_MOUSEMOTION) {
>>> +   if ((sc->sc_features & HIL_ABSOLUTE) == 0) {
>>> +   wsmouse_motion(sc->sc_wsmousedev, dx, dy, dz, 0);
>>> +   } else {
>>> +   wsmouse_position(sc->sc_wsmousedev, dx, dy);
>>> +   if (sc->sc_axes > 2)
>>> +   wsmouse_touch(sc->sc_wsmousedev, dz, 0);
>>> +   }
>>> +   }
>>> +   wsmouse_input_sync(sc->sc_wsmousedev);
>>>  }
>>> Index: dev/usb/uts.c
>>> ===
>>> RCS file: /cvs/src/sys/dev/usb/uts.c,v
>>> retrieving revision 1.37
>>> diff -u -p -r1.37 uts.c
>>> --- dev/usb/uts.c   10 Feb 2016 05:49:50 -  1.37
>>> +++ dev/usb/uts.c   31 May 2016 19:23:12 -
>>> @@ -476,9 +476,7 @@ uts_intr(struct usbd_xfer *xfer, void *a
>>> DPRINTF(("%s: tp.down = %d, tp.z = %d, tp.x = %d, tp.y = %d\n",
>>> sc->sc_dev.dv_xname, tp.down, tp.z, tp.x, tp.y));
>>>  
>>> -   wsmouse_input(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0,
>>> -   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
>>> -   WSMOUSE_INPUT_ABSOLUTE_Z);
>>> +   WSMOUSE_TOUCH(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0);
>>> sc->sc_oldy = tp.y;
>>> sc->sc_oldx = tp.x;
>>>  
>>>
>>>
>>
> 



Re: removing wsmouse_input [2]: zts, hilms, uts

2016-06-05 Thread Stefan Sperling
On Sun, Jun 05, 2016 at 09:55:07AM +0200, Ulf Brosziewski wrote:
> ok?

Again, I can't test this, but it's ok by me.

I like the new wsmouse interface a lot better than the old one.

> On 06/01/2016 01:23 AM, Ulf Brosziewski wrote:
> > zts, hilms, and uts are the drivers that still use wsmouse_input
> > with absolute coordinates (or with both types of coordinates).
> > The new, "flag-less" interface of wsmouse requires calls of
> > wsmouse_position, and, possibly, of wsmouse_touch in this case.
> > 
> > Questions, tests and OKs would be welcome.
> > 
> > 
> > Index: arch/zaurus/dev/zts.c
> > ===
> > RCS file: /cvs/src/sys/arch/zaurus/dev/zts.c,v
> > retrieving revision 1.16
> > diff -u -p -r1.16 zts.c
> > --- arch/zaurus/dev/zts.c   29 Mar 2014 18:09:30 -  1.16
> > +++ arch/zaurus/dev/zts.c   31 May 2016 19:23:10 -
> > @@ -544,10 +544,9 @@ zts_irq(void *v)
> > DPRINTF(("%s: tp.z = %d, tp.x = %d, tp.y = %d\n",
> > sc->sc_dev.dv_xname, tp.z, tp.x, tp.y));
> >  
> > -   wsmouse_input(sc->sc_wsmousedev, down, tp.x, tp.y,
> > -   0 /* z */, 0 /* w */,
> > -   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> > -   WSMOUSE_INPUT_ABSOLUTE_Z);
> > +   wsmouse_buttons(sc->sc_wsmousedev, down);
> > +   wsmouse_position(sc->sc_wsmousedev, tp.x, tp.y);
> > +   wsmouse_input_sync(sc->sc_wsmousedev);
> > sc->sc_buttons = down;
> > sc->sc_oldx = tp.x;
> > sc->sc_oldy = tp.y;
> > Index: dev/hil/hilms.c
> > ===
> > RCS file: /cvs/src/sys/dev/hil/hilms.c,v
> > retrieving revision 1.5
> > diff -u -p -r1.5 hilms.c
> > --- dev/hil/hilms.c 10 Apr 2007 22:37:17 -  1.5
> > +++ dev/hil/hilms.c 31 May 2016 19:23:10 -
> > @@ -219,7 +219,7 @@ void
> >  hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
> >  {
> > struct hilms_softc *sc = (struct hilms_softc *)dev;
> > -   int type, flags;
> > +   int type;
> > int dx, dy, dz, button;
> >  #ifdef DIAGNOSTIC
> > int minlen;
> > @@ -256,9 +256,6 @@ hilms_callback(struct hildev_softc *dev,
> >  */
> >  
> > if (type & HIL_MOUSEMOTION) {
> > -   flags = sc->sc_features & HIL_ABSOLUTE ?
> > -   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> > -   WSMOUSE_INPUT_ABSOLUTE_Z : WSMOUSE_INPUT_DELTA;
> > if (sc->sc_features & HIL_16_BITS) {
> > dx = *buf++;
> > dx |= (*buf++) << 8;
> > @@ -302,8 +299,7 @@ hilms_callback(struct hildev_softc *dev,
> > if ((sc->sc_features & HIL_ABSOLUTE) == 0 &&
> > sc->sc_buttons == 0)
> > dy = -dy;
> > -   } else
> > -   dx = dy = dz = flags = 0;
> > +   }
> >  
> > if (type & HIL_MOUSEBUTTON) {
> > button = *buf;
> > @@ -332,7 +328,18 @@ hilms_callback(struct hildev_softc *dev,
> > /* buf++; */
> > }
> > 
> > -   if (sc->sc_wsmousedev != NULL)
> > -   wsmouse_input(sc->sc_wsmousedev,
> > -   sc->sc_buttonstate, dx, dy, dz, 0, flags);
> > +   if (sc->sc_wsmousedev == NULL)
> > +   return;
> > +
> > +   wsmouse_buttons(sc->sc_wsmousedev, sc->sc_buttonstate);
> > +   if (type & HIL_MOUSEMOTION) {
> > +   if ((sc->sc_features & HIL_ABSOLUTE) == 0) {
> > +   wsmouse_motion(sc->sc_wsmousedev, dx, dy, dz, 0);
> > +   } else {
> > +   wsmouse_position(sc->sc_wsmousedev, dx, dy);
> > +   if (sc->sc_axes > 2)
> > +   wsmouse_touch(sc->sc_wsmousedev, dz, 0);
> > +   }
> > +   }
> > +   wsmouse_input_sync(sc->sc_wsmousedev);
> >  }
> > Index: dev/usb/uts.c
> > ===
> > RCS file: /cvs/src/sys/dev/usb/uts.c,v
> > retrieving revision 1.37
> > diff -u -p -r1.37 uts.c
> > --- dev/usb/uts.c   10 Feb 2016 05:49:50 -  1.37
> > +++ dev/usb/uts.c   31 May 2016 19:23:12 -
> > @@ -476,9 +476,7 @@ uts_intr(struct usbd_xfer *xfer, void *a
> > DPRINTF(("%s: tp.down = %d, tp.z = %d, tp.x = %d, tp.y = %d\n",
> > sc->sc_dev.dv_xname, tp.down, tp.z, tp.x, tp.y));
> >  
> > -   wsmouse_input(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0,
> > -   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> > -   WSMOUSE_INPUT_ABSOLUTE_Z);
> > +   WSMOUSE_TOUCH(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0);
> > sc->sc_oldy = tp.y;
> > sc->sc_oldx = tp.x;
> >  
> > 
> > 
> 



Re: removing wsmouse_input [2]: zts, hilms, uts

2016-06-05 Thread Ulf Brosziewski
ok?

On 06/01/2016 01:23 AM, Ulf Brosziewski wrote:
> zts, hilms, and uts are the drivers that still use wsmouse_input
> with absolute coordinates (or with both types of coordinates).
> The new, "flag-less" interface of wsmouse requires calls of
> wsmouse_position, and, possibly, of wsmouse_touch in this case.
> 
> Questions, tests and OKs would be welcome.
> 
> 
> Index: arch/zaurus/dev/zts.c
> ===
> RCS file: /cvs/src/sys/arch/zaurus/dev/zts.c,v
> retrieving revision 1.16
> diff -u -p -r1.16 zts.c
> --- arch/zaurus/dev/zts.c 29 Mar 2014 18:09:30 -  1.16
> +++ arch/zaurus/dev/zts.c 31 May 2016 19:23:10 -
> @@ -544,10 +544,9 @@ zts_irq(void *v)
>   DPRINTF(("%s: tp.z = %d, tp.x = %d, tp.y = %d\n",
>   sc->sc_dev.dv_xname, tp.z, tp.x, tp.y));
>  
> - wsmouse_input(sc->sc_wsmousedev, down, tp.x, tp.y,
> - 0 /* z */, 0 /* w */,
> - WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> - WSMOUSE_INPUT_ABSOLUTE_Z);
> + wsmouse_buttons(sc->sc_wsmousedev, down);
> + wsmouse_position(sc->sc_wsmousedev, tp.x, tp.y);
> + wsmouse_input_sync(sc->sc_wsmousedev);
>   sc->sc_buttons = down;
>   sc->sc_oldx = tp.x;
>   sc->sc_oldy = tp.y;
> Index: dev/hil/hilms.c
> ===
> RCS file: /cvs/src/sys/dev/hil/hilms.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 hilms.c
> --- dev/hil/hilms.c   10 Apr 2007 22:37:17 -  1.5
> +++ dev/hil/hilms.c   31 May 2016 19:23:10 -
> @@ -219,7 +219,7 @@ void
>  hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
>  {
>   struct hilms_softc *sc = (struct hilms_softc *)dev;
> - int type, flags;
> + int type;
>   int dx, dy, dz, button;
>  #ifdef DIAGNOSTIC
>   int minlen;
> @@ -256,9 +256,6 @@ hilms_callback(struct hildev_softc *dev,
>*/
>  
>   if (type & HIL_MOUSEMOTION) {
> - flags = sc->sc_features & HIL_ABSOLUTE ?
> - WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> - WSMOUSE_INPUT_ABSOLUTE_Z : WSMOUSE_INPUT_DELTA;
>   if (sc->sc_features & HIL_16_BITS) {
>   dx = *buf++;
>   dx |= (*buf++) << 8;
> @@ -302,8 +299,7 @@ hilms_callback(struct hildev_softc *dev,
>   if ((sc->sc_features & HIL_ABSOLUTE) == 0 &&
>   sc->sc_buttons == 0)
>   dy = -dy;
> - } else
> - dx = dy = dz = flags = 0;
> + }
>  
>   if (type & HIL_MOUSEBUTTON) {
>   button = *buf;
> @@ -332,7 +328,18 @@ hilms_callback(struct hildev_softc *dev,
>   /* buf++; */
>   }
>   
> - if (sc->sc_wsmousedev != NULL)
> - wsmouse_input(sc->sc_wsmousedev,
> - sc->sc_buttonstate, dx, dy, dz, 0, flags);
> + if (sc->sc_wsmousedev == NULL)
> + return;
> +
> + wsmouse_buttons(sc->sc_wsmousedev, sc->sc_buttonstate);
> + if (type & HIL_MOUSEMOTION) {
> + if ((sc->sc_features & HIL_ABSOLUTE) == 0) {
> + wsmouse_motion(sc->sc_wsmousedev, dx, dy, dz, 0);
> + } else {
> + wsmouse_position(sc->sc_wsmousedev, dx, dy);
> + if (sc->sc_axes > 2)
> + wsmouse_touch(sc->sc_wsmousedev, dz, 0);
> + }
> + }
> + wsmouse_input_sync(sc->sc_wsmousedev);
>  }
> Index: dev/usb/uts.c
> ===
> RCS file: /cvs/src/sys/dev/usb/uts.c,v
> retrieving revision 1.37
> diff -u -p -r1.37 uts.c
> --- dev/usb/uts.c 10 Feb 2016 05:49:50 -  1.37
> +++ dev/usb/uts.c 31 May 2016 19:23:12 -
> @@ -476,9 +476,7 @@ uts_intr(struct usbd_xfer *xfer, void *a
>   DPRINTF(("%s: tp.down = %d, tp.z = %d, tp.x = %d, tp.y = %d\n",
>   sc->sc_dev.dv_xname, tp.down, tp.z, tp.x, tp.y));
>  
> - wsmouse_input(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0,
> - WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> - WSMOUSE_INPUT_ABSOLUTE_Z);
> + WSMOUSE_TOUCH(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0);
>   sc->sc_oldy = tp.y;
>   sc->sc_oldx = tp.x;
>  
> 
> 



removing wsmouse_input [2]: zts, hilms, uts

2016-05-31 Thread Ulf Brosziewski
zts, hilms, and uts are the drivers that still use wsmouse_input
with absolute coordinates (or with both types of coordinates).
The new, "flag-less" interface of wsmouse requires calls of
wsmouse_position, and, possibly, of wsmouse_touch in this case.

Questions, tests and OKs would be welcome.


Index: arch/zaurus/dev/zts.c
===
RCS file: /cvs/src/sys/arch/zaurus/dev/zts.c,v
retrieving revision 1.16
diff -u -p -r1.16 zts.c
--- arch/zaurus/dev/zts.c   29 Mar 2014 18:09:30 -  1.16
+++ arch/zaurus/dev/zts.c   31 May 2016 19:23:10 -
@@ -544,10 +544,9 @@ zts_irq(void *v)
DPRINTF(("%s: tp.z = %d, tp.x = %d, tp.y = %d\n",
sc->sc_dev.dv_xname, tp.z, tp.x, tp.y));
 
-   wsmouse_input(sc->sc_wsmousedev, down, tp.x, tp.y,
-   0 /* z */, 0 /* w */,
-   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
-   WSMOUSE_INPUT_ABSOLUTE_Z);
+   wsmouse_buttons(sc->sc_wsmousedev, down);
+   wsmouse_position(sc->sc_wsmousedev, tp.x, tp.y);
+   wsmouse_input_sync(sc->sc_wsmousedev);
sc->sc_buttons = down;
sc->sc_oldx = tp.x;
sc->sc_oldy = tp.y;
Index: dev/hil/hilms.c
===
RCS file: /cvs/src/sys/dev/hil/hilms.c,v
retrieving revision 1.5
diff -u -p -r1.5 hilms.c
--- dev/hil/hilms.c 10 Apr 2007 22:37:17 -  1.5
+++ dev/hil/hilms.c 31 May 2016 19:23:10 -
@@ -219,7 +219,7 @@ void
 hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
 {
struct hilms_softc *sc = (struct hilms_softc *)dev;
-   int type, flags;
+   int type;
int dx, dy, dz, button;
 #ifdef DIAGNOSTIC
int minlen;
@@ -256,9 +256,6 @@ hilms_callback(struct hildev_softc *dev,
 */
 
if (type & HIL_MOUSEMOTION) {
-   flags = sc->sc_features & HIL_ABSOLUTE ?
-   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
-   WSMOUSE_INPUT_ABSOLUTE_Z : WSMOUSE_INPUT_DELTA;
if (sc->sc_features & HIL_16_BITS) {
dx = *buf++;
dx |= (*buf++) << 8;
@@ -302,8 +299,7 @@ hilms_callback(struct hildev_softc *dev,
if ((sc->sc_features & HIL_ABSOLUTE) == 0 &&
sc->sc_buttons == 0)
dy = -dy;
-   } else
-   dx = dy = dz = flags = 0;
+   }
 
if (type & HIL_MOUSEBUTTON) {
button = *buf;
@@ -332,7 +328,18 @@ hilms_callback(struct hildev_softc *dev,
/* buf++; */
}

-   if (sc->sc_wsmousedev != NULL)
-   wsmouse_input(sc->sc_wsmousedev,
-   sc->sc_buttonstate, dx, dy, dz, 0, flags);
+   if (sc->sc_wsmousedev == NULL)
+   return;
+
+   wsmouse_buttons(sc->sc_wsmousedev, sc->sc_buttonstate);
+   if (type & HIL_MOUSEMOTION) {
+   if ((sc->sc_features & HIL_ABSOLUTE) == 0) {
+   wsmouse_motion(sc->sc_wsmousedev, dx, dy, dz, 0);
+   } else {
+   wsmouse_position(sc->sc_wsmousedev, dx, dy);
+   if (sc->sc_axes > 2)
+   wsmouse_touch(sc->sc_wsmousedev, dz, 0);
+   }
+   }
+   wsmouse_input_sync(sc->sc_wsmousedev);
 }
Index: dev/usb/uts.c
===
RCS file: /cvs/src/sys/dev/usb/uts.c,v
retrieving revision 1.37
diff -u -p -r1.37 uts.c
--- dev/usb/uts.c   10 Feb 2016 05:49:50 -  1.37
+++ dev/usb/uts.c   31 May 2016 19:23:12 -
@@ -476,9 +476,7 @@ uts_intr(struct usbd_xfer *xfer, void *a
DPRINTF(("%s: tp.down = %d, tp.z = %d, tp.x = %d, tp.y = %d\n",
sc->sc_dev.dv_xname, tp.down, tp.z, tp.x, tp.y));
 
-   wsmouse_input(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0,
-   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
-   WSMOUSE_INPUT_ABSOLUTE_Z);
+   WSMOUSE_TOUCH(sc->sc_wsmousedev, tp.down, tp.x, tp.y, tp.z, 0);
sc->sc_oldy = tp.y;
sc->sc_oldx = tp.x;