removing wsmouse_input [3]: cleanup

2016-06-05 Thread Ulf Brosziewski
This the last patch of this series, which removes wsmouse_input.

ok?


Index: dev/wscons/wsmouse.c
===
RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
retrieving revision 1.29
diff -u -p -r1.29 wsmouse.c
--- dev/wscons/wsmouse.c30 Mar 2016 23:34:12 -  1.29
+++ dev/wscons/wsmouse.c5 Jun 2016 21:44:58 -
@@ -72,6 +72,22 @@
  */
 
 /*
+ * Copyright (c) 2015, 2016 Ulf Brosziewski
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
  * Mouse driver.
  */
 
@@ -112,28 +128,12 @@ extern int wsmuxdebug;
 #defineDPRINTFN(n,x)
 #endif
 
-#defineINVALID_X   INT_MAX
-#defineINVALID_Y   INT_MAX
-#defineINVALID_Z   INT_MAX
-#defineINVALID_W   INT_MAX
-
 struct wsmouse_softc {
struct wsevsrc  sc_base;
 
const struct wsmouse_accessops *sc_accessops;
void*sc_accesscookie;
 
-   u_int   sc_mb;  /* mouse button state */
-   u_int   sc_ub;  /* user button state */
-   int sc_dx;  /* delta-x */
-   int sc_dy;  /* delta-y */
-   int sc_dz;  /* delta-z */
-   int sc_dw;  /* delta-w */
-   int sc_x;   /* absolute-x */
-   int sc_y;   /* absolute-y */
-   int sc_z;   /* absolute-z */
-   int sc_w;   /* absolute-w */
-
struct wsmouseinput input;
 
int sc_refcnt;
@@ -290,200 +290,6 @@ wsmouse_detach(struct device *self, int 
return (0);
 }
 
-void
-wsmouse_input(struct device *wsmousedev, u_int btns, /* 0 is up */
-int x, int y, int z, int w, u_int flags)
-{
-   struct wsmouse_softc *sc = (struct wsmouse_softc *)wsmousedev;
-   struct wscons_event *ev;
-   struct wseventvar *evar;
-   int mb, ub, d, get, put, any;
-
-   add_mouse_randomness(x ^ y ^ z ^ w ^ btns);
-
-   /*
-* Discard input if not ready.
-*/
-   evar = sc->sc_base.me_evp;
-   if (evar == NULL)
-   return;
-
-#ifdef DIAGNOSTIC
-   if (evar->q == NULL) {
-   printf("wsmouse_input: evar->q=NULL\n");
-   return;
-   }
-#endif
-
-#if NWSMUX > 0
-   DPRINTFN(5,("wsmouse_input: %s mux=%p, evar=%p\n",
-   sc->sc_base.me_dv.dv_xname, sc->sc_base.me_parent, evar));
-#endif
-
-   sc->sc_mb = btns;
-   if (!(flags & WSMOUSE_INPUT_ABSOLUTE_X))
-   sc->sc_dx += x;
-   if (!(flags & WSMOUSE_INPUT_ABSOLUTE_Y))
-   sc->sc_dy += y;
-   if (!(flags & WSMOUSE_INPUT_ABSOLUTE_Z))
-   sc->sc_dz += z;
-   if (!(flags & WSMOUSE_INPUT_ABSOLUTE_W))
-   sc->sc_dw += w;
-
-   /*
-* We have at least one event (mouse button, delta-X, or
-* delta-Y; possibly all three, and possibly three separate
-* button events).  Deliver these events until we are out
-* of changes or out of room.  As events get delivered,
-* mark them `unchanged'.
-*/
-   ub = sc->sc_ub;
-   any = 0;
-   get = evar->get;
-   put = evar->put;
-   ev = >q[put];
-
-   /* NEXT prepares to put the next event, backing off if necessary */
-#defineNEXT
\
-   if ((++put) % WSEVENT_QSIZE == get) {   \
-   put--;  \
-   goto out;   \
-   }
-   /* ADVANCE completes the `put' of the event */
-#defineADVANCE 
\
-   ev++;   \
-   if (put >= WSEVENT_QSIZE) { \
-   put = 0;\
-   ev = >q[0];   \
-   }   \
-   any = 1
-   /* TIMESTAMP sets `time' field of the event to the current time */
-#define TIMESTAMP   

Re: [patch] adding quotes for space-containing values in smtpd(8) logs

2016-06-05 Thread Giovanni Bechis
On Sun, Jun 05, 2016 at 12:43:14PM +0200, Gilles Chehade wrote:
> On Thu, Jun 02, 2016 at 05:18:21PM +0300, Pavel Korovin wrote:
> > Dear all,
> > 
> > Could you consider quoting the space-containing values in smtpd log
> > messages?
> > 
> > I like the latest smtpd log format improvements, but it's hard to parse
> > space-separated key-value pairs if they have space-containing values :)
> > Please see the patch attached.
> > 
> 
> I understand and agree with you about the problem, however I haven't been able
> to convince hackers that space-separated key-value pairs were annoying enough.
> 
> I think this diff makes sense, waiting for other ok's
> 
> gilles
> 
makes sense.
ok giovanni@



Re: bgpd: add format attributes

2016-06-05 Thread Martin Pieuchot
On 05/06/16(Sun) 20:33, Sebastian Benoit wrote:
> Martin Pieuchot(m...@openbsd.org) on 2016.06.05 20:06:17 +0200:
> > On 04/06/16(Sat) 18:33, Sebastian Benoit wrote:
> > > Add format attributes to the proper functions and then fix the warning in
> > > session.c.
> > 
> > Shouldn't you introduce a log.h instead an make sure all daemons share
> > the same log.h and log.c?
> 
> That question came up in the past. I can certainly do that.

It would be awesome.

> However, can i put in the attributes first?

Ok with me



Re: bgpd: add format attributes

2016-06-05 Thread Sebastian Benoit
Martin Pieuchot(m...@openbsd.org) on 2016.06.05 20:06:17 +0200:
> On 04/06/16(Sat) 18:33, Sebastian Benoit wrote:
> > Add format attributes to the proper functions and then fix the warning in
> > session.c.
> 
> Shouldn't you introduce a log.h instead an make sure all daemons share
> the same log.h and log.c?

That question came up in the past. I can certainly do that.

However, can i put in the attributes first?

In bgpd i missed fatalx(), updated diff.

ok?


diff --git bgpd.h bgpd.h
index 5fa046e..e5145d4 100644
--- bgpd.h
+++ bgpd.h
@@ -989,16 +989,26 @@ struct in6_addr   *prefixlen2mask6(u_int8_t prefixlen);
 /* log.c */
 voidlog_init(int);
 voidlog_verbose(int);
-voidlogit(int, const char *, ...);
-voidvlog(int, const char *, va_list);
-voidlog_peer_warn(const struct peer_config *, const char *, ...);
-voidlog_peer_warnx(const struct peer_config *, const char *, ...);
-voidlog_warn(const char *, ...);
-voidlog_warnx(const char *, ...);
-voidlog_info(const char *, ...);
-voidlog_debug(const char *, ...);
-voidfatal(const char *, ...) __dead;
-voidfatalx(const char *) __dead;
+voidlogit(int, const char *, ...)
+   __attribute__((__format__ (printf, 2, 3)));
+voidvlog(int, const char *, va_list)
+   __attribute__((__format__ (printf, 2, 0)));
+voidlog_peer_warn(const struct peer_config *, const char *, ...)
+   __attribute__((__format__ (printf, 2, 3)));
+voidlog_peer_warnx(const struct peer_config *, const char *, ...)
+   __attribute__((__format__ (printf, 2, 3)));
+voidlog_warn(const char *, ...)
+   __attribute__((__format__ (printf, 1, 2)));
+voidlog_warnx(const char *, ...)
+   __attribute__((__format__ (printf, 1, 2)));
+voidlog_info(const char *, ...)
+   __attribute__((__format__ (printf, 1, 2)));
+voidlog_debug(const char *, ...)
+   __attribute__((__format__ (printf, 1, 2)));
+voidfatal(const char *, ...) __dead
+   __attribute__((__format__ (printf, 1, 2)));
+voidfatalx(const char *) __dead
+   __attribute__((__format__ (printf, 1, 0)));
 
 /* mrt.c */
 voidmrt_clear_seq(void);
diff --git session.c session.c
index 8c853a1..e736b76 100644
--- session.c
+++ session.c
@@ -2017,7 +2017,7 @@ parse_open(struct peer *peer)
 
/* check bgpid for validity - just disallow 0 */
if (ntohl(bgpid) == 0) {
-   log_peer_warnx(>conf, "peer BGPID %lu unacceptable",
+   log_peer_warnx(>conf, "peer BGPID %u unacceptable",
ntohl(bgpid));
session_notification(peer, ERR_OPEN, ERR_OPEN_BGPID,
NULL, 0);



Re: [patch] adding quotes for space-containing values in smtpd(8) logs

2016-06-05 Thread Gilles Chehade
On Thu, Jun 02, 2016 at 05:18:21PM +0300, Pavel Korovin wrote:
> Dear all,
> 
> Could you consider quoting the space-containing values in smtpd log
> messages?
> 
> I like the latest smtpd log format improvements, but it's hard to parse
> space-separated key-value pairs if they have space-containing values :)
> Please see the patch attached.
> 

I understand and agree with you about the problem, however I haven't been able
to convince hackers that space-separated key-value pairs were annoying enough.

I think this diff makes sense, waiting for other ok's

gilles


> Index: smtp_session.c
> ===
> RCS file: /cvs/src/usr.sbin/smtpd/smtp_session.c,v
> retrieving revision 1.272
> diff -u -p -r1.272 smtp_session.c
> --- smtp_session.c22 May 2016 16:31:21 -  1.272
> +++ smtp_session.c2 Jun 2016 12:55:51 -
> @@ -1258,7 +1258,7 @@ smtp_io(struct io *io, int evt)
>   switch (evt) {
>  
>   case IO_TLSREADY:
> - log_info("%016"PRIx64" smtp event=starttls ciphers=%s",
> + log_info("%016"PRIx64" smtp event=starttls ciphers=\"%s\"",
>   s->id, ssl_to_text(s->io.ssl));
>  
>   s->flags |= SF_SECURE;
> @@ -1283,7 +1283,7 @@ smtp_io(struct io *io, int evt)
>   x = SSL_get_peer_certificate(s->io.ssl);
>   if (x) {
>   log_info("%016"PRIx64" smtp "
> - "event=client-cert-check result=%s",
> + "event=client-cert-check result=\"%s\"",
>   s->id,
>   (s->flags & SF_VERIFIED) ? "success" : "failure");
>   X509_free(x);
> @@ -1402,7 +1402,7 @@ smtp_io(struct io *io, int evt)
>   break;
>  
>   case IO_ERROR:
> - log_info("%016"PRIx64" smtp event=closed reason=io-error: %s",
> + log_info("%016"PRIx64" smtp event=closed reason=\"io-error: 
> %s\"",
>   s->id, io->error);
>   smtp_free(s, "IO error");
>   break;
> @@ -2183,7 +2183,7 @@ smtp_reply(struct smtp_session *s, char 
>   case '4':
>   if (s->flags & SF_BADINPUT) {
>   log_info("%016"PRIx64" smtp "
> - "event=bad-input result=%.*s",
> + "event=bad-input result=\"%.*s\"",
>   s->id, n, buf);
>   }
>   else if (s->state == STATE_AUTH_INIT) {
> @@ -2201,7 +2201,7 @@ smtp_reply(struct smtp_session *s, char 
>   else {
>   strnvis(tmp, s->cmd, sizeof tmp, VIS_SAFE | VIS_CSTYLE);
>   log_info("%016"PRIx64" smtp "
> - "event=failed-command command=%s result=%.*s",
> + "event=failed-command command=\"%s\" 
> result=\"%.*s\"",
>   s->id, tmp, n, buf);
>   }
>   break;


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: fix copy-pasto in netstat

2016-06-05 Thread Theo Buehler
ok

On Sun, Jun 05, 2016 at 10:50:17AM +0200, Stefan Sperling wrote:
> Index: net80211.c
> ===
> RCS file: /cvs/src/usr.bin/netstat/net80211.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 net80211.c
> --- net80211.c28 Apr 2016 14:46:50 -  1.15
> +++ net80211.c29 Apr 2016 16:57:45 -
> @@ -117,7 +117,7 @@ net80211_ifstats(char *ifname)
>   p(is_pbac_errs, "\t%lu pbac error%s\n");
>   p(is_ht_nego_no_mandatory_mcs, "\t%lu HT negotiation failure%s because "
>   "peer does not support MCS 0-7\n");
> - p(is_ht_nego_no_mandatory_mcs, "\t%lu HT negotiation failure%s because "
> + p(is_ht_nego_no_basic_mcs, "\t%lu HT negotiation failure%s because "
>   "we do not support basic MCS set\n");
>   p(is_ht_nego_bad_crypto,
>   "\t%lu HT negotiation failure%s because peer uses bad crypto\n");
> 



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 [1]

2016-06-05 Thread Ulf Brosziewski
The changes are simple, the functions are already in use and
no regressions are known; if nobody insists on tests, I will
commit that soon.


On 06/05/16 10:36, Stefan Sperling wrote:
> On Sun, Jun 05, 2016 at 09:54:55AM +0200, Ulf Brosziewski wrote:
>> ok?
>>
> 
> Looks good, ok by me.
> 
> I don't think I have any of these devices, though, so I can't test.
> 
>> On 06/01/2016 01:21 AM, Ulf Brosziewski wrote:
>>> These diffs adapt various drivers to the new input functions of
>>> wsmouse, namely
>>> arch/i386/isa/lms.c,
>>> arch/i386/isa/mms.c,
>>> arch/luna88k/dev/lunaws.c,
>>> arch/sgi/hpc/z8530ms.c,
>>> dev/adb/ams.c,
>>> dev/sun/sunms.c, and
>>> dev/usb/utpms.c.
>>> Each of the diffs just replaces wsmouse_input with the WSMOUSE_INPUT
>>> macro, which reports inputs with relative coordinates to wsmouse
>>> (I will post a second set of diffs for drivers that handle absolute
>>> coordinates).
>>>
>>> Tests and/or OKs would be welcome.
>>>
>>>
>>> Index: arch/i386/isa/lms.c
>>> ===
>>> RCS file: /cvs/src/sys/arch/i386/isa/lms.c,v
>>> retrieving revision 1.20
>>> diff -u -p -r1.20 lms.c
>>> --- arch/i386/isa/lms.c 10 Apr 2007 22:37:17 -  1.20
>>> +++ arch/i386/isa/lms.c 31 May 2016 19:23:09 -
>>> @@ -235,8 +235,7 @@ lmsintr(void *arg)
>>> sc->oldbuttons = buttons;
>>>  
>>> if (dx || dy || changed)
>>> -   wsmouse_input(sc->sc_wsmousedev,
>>> - buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA);
>>> +   WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, dy, 0, 0);
>>>  
>>> return -1;
>>>  }
>>> Index: arch/i386/isa/mms.c
>>> ===
>>> RCS file: /cvs/src/sys/arch/i386/isa/mms.c,v
>>> retrieving revision 1.19
>>> diff -u -p -r1.19 mms.c
>>> --- arch/i386/isa/mms.c 10 Apr 2007 22:37:17 -  1.19
>>> +++ arch/i386/isa/mms.c 31 May 2016 19:23:09 -
>>> @@ -229,8 +229,7 @@ mmsintr(void *arg)
>>> changed = status & 0x38;
>>>  
>>> if (dx || dy || changed)
>>> -   wsmouse_input(sc->sc_wsmousedev,
>>> - buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA);
>>> +   WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, dy, 0, 0);
>>>  
>>> return -1;
>>>  }
>>> Index: arch/luna88k/dev/lunaws.c
>>> ===
>>> RCS file: /cvs/src/sys/arch/luna88k/dev/lunaws.c,v
>>> retrieving revision 1.11
>>> diff -u -p -r1.11 lunaws.c
>>> --- arch/luna88k/dev/lunaws.c   7 Jun 2014 11:55:35 -   1.11
>>> +++ arch/luna88k/dev/lunaws.c   31 May 2016 19:23:09 -
>>> @@ -260,9 +260,8 @@ wsintr(int chan)
>>> else if (sc->sc_msreport == 2) {
>>> sc->dy = (signed char)code;
>>> if (sc->sc_wsmousedev != NULL)
>>> -   wsmouse_input(sc->sc_wsmousedev,
>>> -   sc->buttons, sc->dx, sc->dy, 0, 0,
>>> -   WSMOUSE_INPUT_DELTA);
>>> +   WSMOUSE_INPUT(sc->sc_wsmousedev,
>>> +   sc->buttons, sc->dx, sc->dy, 0, 0);
>>> sc->sc_msreport = 0;
>>> }
>>>  #else
>>> Index: arch/sgi/hpc/z8530ms.c
>>> ===
>>> RCS file: /cvs/src/sys/arch/sgi/hpc/z8530ms.c,v
>>> retrieving revision 1.1
>>> diff -u -p -r1.1 z8530ms.c
>>> --- arch/sgi/hpc/z8530ms.c  17 Apr 2012 22:06:33 -  1.1
>>> +++ arch/sgi/hpc/z8530ms.c  31 May 2016 19:23:09 -
>>> @@ -296,7 +296,7 @@ zsms_wsmouse_input(struct zsms_softc *sc
>>> x = (int)sc->packet[ZSMS_PACKET_X1] + (int)sc->packet[ZSMS_PACKET_X2];
>>> y = (int)sc->packet[ZSMS_PACKET_Y1] + (int)sc->packet[ZSMS_PACKET_Y2];
>>>  
>>> -   wsmouse_input(sc->wsmousedev, btns, x, y, 0, 0, WSMOUSE_INPUT_DELTA);
>>> +   WSMOUSE_INPUT(sc->wsmousedev, btns, x, y, 0, 0);
>>>  }
>>>  
>>>  int
>>> Index: dev/adb/ams.c
>>> ===
>>> RCS file: /cvs/src/sys/dev/adb/ams.c,v
>>> retrieving revision 1.6
>>> diff -u -p -r1.6 ams.c
>>> --- dev/adb/ams.c   15 Jun 2011 21:32:05 -  1.6
>>> +++ dev/adb/ams.c   31 May 2016 19:23:10 -
>>> @@ -501,8 +501,7 @@ ms_processevent(adb_event_t *event, stru
>>> ((event->bytes[0] & 0x40) ? 64 : 0);
>>>  
>>> if (sc->sc_wsmousedev)
>>> -   wsmouse_input(sc->sc_wsmousedev, buttons, dx, -dy, 0, 0,
>>> -   WSMOUSE_INPUT_DELTA);
>>> +   WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, -dy, 0, 0);
>>>  }
>>>  
>>>  int
>>> Index: dev/sun/sunms.c
>>> ===
>>> RCS file: /cvs/src/sys/dev/sun/sunms.c,v
>>> retrieving revision 1.1
>>> diff -u -p -r1.1 sunms.c

Re: bgpd: print AS range

2016-06-05 Thread Denis Fondras
On Sun, Jun 05, 2016 at 10:28:05AM +0200, Sebastian Benoit wrote:
> hei,
> 
> thanks! i forgot that we print the config.
> 
> ok benno@, with whitespace fixed.
> 


Index: printconf.c
===
RCS file: /cvs/src/usr.sbin/bgpd/printconf.c,v
retrieving revision 1.96
diff -u -p -r1.96 printconf.c
--- printconf.c 21 Sep 2015 09:47:15 -  1.96
+++ printconf.c 5 Jun 2016 09:00:18 -
@@ -41,8 +41,9 @@ void   print_peer(struct peer_config *, 
 const char *print_auth_alg(u_int8_t);
 const char *print_enc_alg(u_int8_t);
 voidprint_announce(struct peer_config *, const char *);
+voidprint_as(struct filter_rule *);
 voidprint_rule(struct peer *, struct filter_rule *);
-const char *mrt_type(enum mrt_type);
+const char *mrt_type(enum mrt_type);
 voidprint_mrt(struct bgpd_config *, u_int32_t, u_int32_t,
const char *, const char *);
 voidprint_groups(struct bgpd_config *, struct peer *);
@@ -506,6 +507,26 @@ print_announce(struct peer_config *p, co
printf("%s\tannounce %s\n", c, aid2str(aid));
 }
 
+void print_as(struct filter_rule *r)
+{
+   switch(r->match.as.op) {
+   case OP_RANGE:
+   printf("%s - ", log_as(r->match.as.as_min));
+   printf("%s ", log_as(r->match.as.as_max));
+   break;  
+   case OP_XRANGE:
+   printf("%s >< ", log_as(r->match.as.as_min));
+   printf("%s ", log_as(r->match.as.as_max));
+   break;
+   case OP_NE:
+   printf("!= %s ", log_as(r->match.as.as));
+   break;
+   default:
+   printf("%s ", log_as(r->match.as.as));
+   break;
+   }
+}
+
 void
 print_rule(struct peer *peer_l, struct filter_rule *r)
 {
@@ -577,15 +598,16 @@ print_rule(struct peer *peer_l, struct f
 
if (r->match.as.type) {
if (r->match.as.type == AS_ALL)
-   printf("AS %s ", log_as(r->match.as.as));
+   printf("AS ");
else if (r->match.as.type == AS_SOURCE)
-   printf("source-as %s ", log_as(r->match.as.as));
+   printf("source-as ");
else if (r->match.as.type == AS_TRANSIT)
-   printf("transit-as %s ", log_as(r->match.as.as));
+   printf("transit-as ");
else if (r->match.as.type == AS_PEER)
-   printf("peer-as %s ", log_as(r->match.as.as));
+   printf("peer-as ");
else
-   printf("unfluffy-as %s ", log_as(r->match.as.as));
+   printf("unfluffy-as ");
+   print_as(r);
}
 
if (r->match.aslen.type) {



fix copy-pasto in netstat

2016-06-05 Thread Stefan Sperling
Index: net80211.c
===
RCS file: /cvs/src/usr.bin/netstat/net80211.c,v
retrieving revision 1.15
diff -u -p -r1.15 net80211.c
--- net80211.c  28 Apr 2016 14:46:50 -  1.15
+++ net80211.c  29 Apr 2016 16:57:45 -
@@ -117,7 +117,7 @@ net80211_ifstats(char *ifname)
p(is_pbac_errs, "\t%lu pbac error%s\n");
p(is_ht_nego_no_mandatory_mcs, "\t%lu HT negotiation failure%s because "
"peer does not support MCS 0-7\n");
-   p(is_ht_nego_no_mandatory_mcs, "\t%lu HT negotiation failure%s because "
+   p(is_ht_nego_no_basic_mcs, "\t%lu HT negotiation failure%s because "
"we do not support basic MCS set\n");
p(is_ht_nego_bad_crypto,
"\t%lu HT negotiation failure%s because peer uses bad crypto\n");



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 [1]

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

Looks good, ok by me.

I don't think I have any of these devices, though, so I can't test.

> On 06/01/2016 01:21 AM, Ulf Brosziewski wrote:
> > These diffs adapt various drivers to the new input functions of
> > wsmouse, namely
> > arch/i386/isa/lms.c,
> > arch/i386/isa/mms.c,
> > arch/luna88k/dev/lunaws.c,
> > arch/sgi/hpc/z8530ms.c,
> > dev/adb/ams.c,
> > dev/sun/sunms.c, and
> > dev/usb/utpms.c.
> > Each of the diffs just replaces wsmouse_input with the WSMOUSE_INPUT
> > macro, which reports inputs with relative coordinates to wsmouse
> > (I will post a second set of diffs for drivers that handle absolute
> > coordinates).
> > 
> > Tests and/or OKs would be welcome.
> > 
> > 
> > Index: arch/i386/isa/lms.c
> > ===
> > RCS file: /cvs/src/sys/arch/i386/isa/lms.c,v
> > retrieving revision 1.20
> > diff -u -p -r1.20 lms.c
> > --- arch/i386/isa/lms.c 10 Apr 2007 22:37:17 -  1.20
> > +++ arch/i386/isa/lms.c 31 May 2016 19:23:09 -
> > @@ -235,8 +235,7 @@ lmsintr(void *arg)
> > sc->oldbuttons = buttons;
> >  
> > if (dx || dy || changed)
> > -   wsmouse_input(sc->sc_wsmousedev,
> > - buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA);
> > +   WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, dy, 0, 0);
> >  
> > return -1;
> >  }
> > Index: arch/i386/isa/mms.c
> > ===
> > RCS file: /cvs/src/sys/arch/i386/isa/mms.c,v
> > retrieving revision 1.19
> > diff -u -p -r1.19 mms.c
> > --- arch/i386/isa/mms.c 10 Apr 2007 22:37:17 -  1.19
> > +++ arch/i386/isa/mms.c 31 May 2016 19:23:09 -
> > @@ -229,8 +229,7 @@ mmsintr(void *arg)
> > changed = status & 0x38;
> >  
> > if (dx || dy || changed)
> > -   wsmouse_input(sc->sc_wsmousedev,
> > - buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA);
> > +   WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, dy, 0, 0);
> >  
> > return -1;
> >  }
> > Index: arch/luna88k/dev/lunaws.c
> > ===
> > RCS file: /cvs/src/sys/arch/luna88k/dev/lunaws.c,v
> > retrieving revision 1.11
> > diff -u -p -r1.11 lunaws.c
> > --- arch/luna88k/dev/lunaws.c   7 Jun 2014 11:55:35 -   1.11
> > +++ arch/luna88k/dev/lunaws.c   31 May 2016 19:23:09 -
> > @@ -260,9 +260,8 @@ wsintr(int chan)
> > else if (sc->sc_msreport == 2) {
> > sc->dy = (signed char)code;
> > if (sc->sc_wsmousedev != NULL)
> > -   wsmouse_input(sc->sc_wsmousedev,
> > -   sc->buttons, sc->dx, sc->dy, 0, 0,
> > -   WSMOUSE_INPUT_DELTA);
> > +   WSMOUSE_INPUT(sc->sc_wsmousedev,
> > +   sc->buttons, sc->dx, sc->dy, 0, 0);
> > sc->sc_msreport = 0;
> > }
> >  #else
> > Index: arch/sgi/hpc/z8530ms.c
> > ===
> > RCS file: /cvs/src/sys/arch/sgi/hpc/z8530ms.c,v
> > retrieving revision 1.1
> > diff -u -p -r1.1 z8530ms.c
> > --- arch/sgi/hpc/z8530ms.c  17 Apr 2012 22:06:33 -  1.1
> > +++ arch/sgi/hpc/z8530ms.c  31 May 2016 19:23:09 -
> > @@ -296,7 +296,7 @@ zsms_wsmouse_input(struct zsms_softc *sc
> > x = (int)sc->packet[ZSMS_PACKET_X1] + (int)sc->packet[ZSMS_PACKET_X2];
> > y = (int)sc->packet[ZSMS_PACKET_Y1] + (int)sc->packet[ZSMS_PACKET_Y2];
> >  
> > -   wsmouse_input(sc->wsmousedev, btns, x, y, 0, 0, WSMOUSE_INPUT_DELTA);
> > +   WSMOUSE_INPUT(sc->wsmousedev, btns, x, y, 0, 0);
> >  }
> >  
> >  int
> > Index: dev/adb/ams.c
> > ===
> > RCS file: /cvs/src/sys/dev/adb/ams.c,v
> > retrieving revision 1.6
> > diff -u -p -r1.6 ams.c
> > --- dev/adb/ams.c   15 Jun 2011 21:32:05 -  1.6
> > +++ dev/adb/ams.c   31 May 2016 19:23:10 -
> > @@ -501,8 +501,7 @@ ms_processevent(adb_event_t *event, stru
> > ((event->bytes[0] & 0x40) ? 64 : 0);
> >  
> > if (sc->sc_wsmousedev)
> > -   wsmouse_input(sc->sc_wsmousedev, buttons, dx, -dy, 0, 0,
> > -   WSMOUSE_INPUT_DELTA);
> > +   WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, -dy, 0, 0);
> >  }
> >  
> >  int
> > Index: dev/sun/sunms.c
> > ===
> > RCS file: /cvs/src/sys/dev/sun/sunms.c,v
> > retrieving revision 1.1
> > diff -u -p -r1.1 sunms.c
> > --- dev/sun/sunms.c 20 May 2009 18:22:33 -  1.1
> > +++ dev/sun/sunms.c 31 May 2016 19:23:12 -
> > @@ -220,8 +220,8 @@ sunms_input(struct sunms_softc *sc, int 
> > if 

Re: bgpd: print AS range

2016-06-05 Thread Sebastian Benoit
hei,

thanks! i forgot that we print the config.

ok benno@, with whitespace fixed.

Denis Fondras(open...@ledeuns.net) on 2016.06.05 10:06:29 +0200:
> > This didn't quite work, as log_as will override itself when used twice
> > in the same printf.
> > 
> 
> I should not have sent this late at night...
> 
> 
> Index: printconf.c
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/printconf.c,v
> retrieving revision 1.96
> diff -u -p -r1.96 printconf.c
> --- printconf.c   21 Sep 2015 09:47:15 -  1.96
> +++ printconf.c   5 Jun 2016 08:00:59 -
> @@ -41,8 +41,9 @@ void print_peer(struct peer_config *, 
>  const char   *print_auth_alg(u_int8_t);
>  const char   *print_enc_alg(u_int8_t);
>  void  print_announce(struct peer_config *, const char *);
> +void  print_as(struct filter_rule *);
>  void  print_rule(struct peer *, struct filter_rule *);
> -const char *  mrt_type(enum mrt_type);
> +const char   *mrt_type(enum mrt_type);
>  void  print_mrt(struct bgpd_config *, u_int32_t, u_int32_t,
>   const char *, const char *);
>  void  print_groups(struct bgpd_config *, struct peer *);
> @@ -506,6 +507,26 @@ print_announce(struct peer_config *p, co
>   printf("%s\tannounce %s\n", c, aid2str(aid));
>  }
>  
> +void print_as(struct filter_rule *r)
> +{
> + switch(r->match.as.op) {
> + case OP_RANGE:
> +printf("%s - ", log_as(r->match.as.as_min));

whitespace

> + printf("%s ", log_as(r->match.as.as_max));
> + break;  
> + case OP_XRANGE:
> + printf("%s >< ", log_as(r->match.as.as_min));
> + printf("%s ", log_as(r->match.as.as_max));
> + break;
> + case OP_NE:
> + printf("!= %s ", log_as(r->match.as.as));
> + break;
> + default:
> + printf("%s ", log_as(r->match.as.as));
> + break;
> + }
> +}
> +
>  void
>  print_rule(struct peer *peer_l, struct filter_rule *r)
>  {
> @@ -577,15 +598,16 @@ print_rule(struct peer *peer_l, struct f
>  
>   if (r->match.as.type) {
>   if (r->match.as.type == AS_ALL)
> - printf("AS %s ", log_as(r->match.as.as));
> + printf("AS ");
>   else if (r->match.as.type == AS_SOURCE)
> - printf("source-as %s ", log_as(r->match.as.as));
> + printf("source-as ");
>   else if (r->match.as.type == AS_TRANSIT)
> - printf("transit-as %s ", log_as(r->match.as.as));
> + printf("transit-as ");
>   else if (r->match.as.type == AS_PEER)
> - printf("peer-as %s ", log_as(r->match.as.as));
> + printf("peer-as ");
>   else
> - printf("unfluffy-as %s ", log_as(r->match.as.as));
> + printf("unfluffy-as ");
> + print_as(r);
>   }
>  
>   if (r->match.aslen.type) {
> 

-- 



Re: bgpd: print AS range

2016-06-05 Thread Denis Fondras
> This didn't quite work, as log_as will override itself when used twice
> in the same printf.
> 

I should not have sent this late at night...


Index: printconf.c
===
RCS file: /cvs/src/usr.sbin/bgpd/printconf.c,v
retrieving revision 1.96
diff -u -p -r1.96 printconf.c
--- printconf.c 21 Sep 2015 09:47:15 -  1.96
+++ printconf.c 5 Jun 2016 08:00:59 -
@@ -41,8 +41,9 @@ void   print_peer(struct peer_config *, 
 const char *print_auth_alg(u_int8_t);
 const char *print_enc_alg(u_int8_t);
 voidprint_announce(struct peer_config *, const char *);
+voidprint_as(struct filter_rule *);
 voidprint_rule(struct peer *, struct filter_rule *);
-const char *mrt_type(enum mrt_type);
+const char *mrt_type(enum mrt_type);
 voidprint_mrt(struct bgpd_config *, u_int32_t, u_int32_t,
const char *, const char *);
 voidprint_groups(struct bgpd_config *, struct peer *);
@@ -506,6 +507,26 @@ print_announce(struct peer_config *p, co
printf("%s\tannounce %s\n", c, aid2str(aid));
 }
 
+void print_as(struct filter_rule *r)
+{
+   switch(r->match.as.op) {
+   case OP_RANGE:
+printf("%s - ", log_as(r->match.as.as_min));
+   printf("%s ", log_as(r->match.as.as_max));
+   break;  
+   case OP_XRANGE:
+   printf("%s >< ", log_as(r->match.as.as_min));
+   printf("%s ", log_as(r->match.as.as_max));
+   break;
+   case OP_NE:
+   printf("!= %s ", log_as(r->match.as.as));
+   break;
+   default:
+   printf("%s ", log_as(r->match.as.as));
+   break;
+   }
+}
+
 void
 print_rule(struct peer *peer_l, struct filter_rule *r)
 {
@@ -577,15 +598,16 @@ print_rule(struct peer *peer_l, struct f
 
if (r->match.as.type) {
if (r->match.as.type == AS_ALL)
-   printf("AS %s ", log_as(r->match.as.as));
+   printf("AS ");
else if (r->match.as.type == AS_SOURCE)
-   printf("source-as %s ", log_as(r->match.as.as));
+   printf("source-as ");
else if (r->match.as.type == AS_TRANSIT)
-   printf("transit-as %s ", log_as(r->match.as.as));
+   printf("transit-as ");
else if (r->match.as.type == AS_PEER)
-   printf("peer-as %s ", log_as(r->match.as.as));
+   printf("peer-as ");
else
-   printf("unfluffy-as %s ", log_as(r->match.as.as));
+   printf("unfluffy-as ");
+   print_as(r);
}
 
if (r->match.aslen.type) {



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;
>  
> 
> 



Re: removing wsmouse_input [1]

2016-06-05 Thread Ulf Brosziewski
ok?

On 06/01/2016 01:21 AM, Ulf Brosziewski wrote:
> These diffs adapt various drivers to the new input functions of
> wsmouse, namely
> arch/i386/isa/lms.c,
> arch/i386/isa/mms.c,
> arch/luna88k/dev/lunaws.c,
> arch/sgi/hpc/z8530ms.c,
> dev/adb/ams.c,
> dev/sun/sunms.c, and
> dev/usb/utpms.c.
> Each of the diffs just replaces wsmouse_input with the WSMOUSE_INPUT
> macro, which reports inputs with relative coordinates to wsmouse
> (I will post a second set of diffs for drivers that handle absolute
> coordinates).
> 
> Tests and/or OKs would be welcome.
> 
> 
> Index: arch/i386/isa/lms.c
> ===
> RCS file: /cvs/src/sys/arch/i386/isa/lms.c,v
> retrieving revision 1.20
> diff -u -p -r1.20 lms.c
> --- arch/i386/isa/lms.c   10 Apr 2007 22:37:17 -  1.20
> +++ arch/i386/isa/lms.c   31 May 2016 19:23:09 -
> @@ -235,8 +235,7 @@ lmsintr(void *arg)
>   sc->oldbuttons = buttons;
>  
>   if (dx || dy || changed)
> - wsmouse_input(sc->sc_wsmousedev,
> -   buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA);
> + WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, dy, 0, 0);
>  
>   return -1;
>  }
> Index: arch/i386/isa/mms.c
> ===
> RCS file: /cvs/src/sys/arch/i386/isa/mms.c,v
> retrieving revision 1.19
> diff -u -p -r1.19 mms.c
> --- arch/i386/isa/mms.c   10 Apr 2007 22:37:17 -  1.19
> +++ arch/i386/isa/mms.c   31 May 2016 19:23:09 -
> @@ -229,8 +229,7 @@ mmsintr(void *arg)
>   changed = status & 0x38;
>  
>   if (dx || dy || changed)
> - wsmouse_input(sc->sc_wsmousedev,
> -   buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA);
> + WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, dy, 0, 0);
>  
>   return -1;
>  }
> Index: arch/luna88k/dev/lunaws.c
> ===
> RCS file: /cvs/src/sys/arch/luna88k/dev/lunaws.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 lunaws.c
> --- arch/luna88k/dev/lunaws.c 7 Jun 2014 11:55:35 -   1.11
> +++ arch/luna88k/dev/lunaws.c 31 May 2016 19:23:09 -
> @@ -260,9 +260,8 @@ wsintr(int chan)
>   else if (sc->sc_msreport == 2) {
>   sc->dy = (signed char)code;
>   if (sc->sc_wsmousedev != NULL)
> - wsmouse_input(sc->sc_wsmousedev,
> - sc->buttons, sc->dx, sc->dy, 0, 0,
> - WSMOUSE_INPUT_DELTA);
> + WSMOUSE_INPUT(sc->sc_wsmousedev,
> + sc->buttons, sc->dx, sc->dy, 0, 0);
>   sc->sc_msreport = 0;
>   }
>  #else
> Index: arch/sgi/hpc/z8530ms.c
> ===
> RCS file: /cvs/src/sys/arch/sgi/hpc/z8530ms.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 z8530ms.c
> --- arch/sgi/hpc/z8530ms.c17 Apr 2012 22:06:33 -  1.1
> +++ arch/sgi/hpc/z8530ms.c31 May 2016 19:23:09 -
> @@ -296,7 +296,7 @@ zsms_wsmouse_input(struct zsms_softc *sc
>   x = (int)sc->packet[ZSMS_PACKET_X1] + (int)sc->packet[ZSMS_PACKET_X2];
>   y = (int)sc->packet[ZSMS_PACKET_Y1] + (int)sc->packet[ZSMS_PACKET_Y2];
>  
> - wsmouse_input(sc->wsmousedev, btns, x, y, 0, 0, WSMOUSE_INPUT_DELTA);
> + WSMOUSE_INPUT(sc->wsmousedev, btns, x, y, 0, 0);
>  }
>  
>  int
> Index: dev/adb/ams.c
> ===
> RCS file: /cvs/src/sys/dev/adb/ams.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 ams.c
> --- dev/adb/ams.c 15 Jun 2011 21:32:05 -  1.6
> +++ dev/adb/ams.c 31 May 2016 19:23:10 -
> @@ -501,8 +501,7 @@ ms_processevent(adb_event_t *event, stru
>   ((event->bytes[0] & 0x40) ? 64 : 0);
>  
>   if (sc->sc_wsmousedev)
> - wsmouse_input(sc->sc_wsmousedev, buttons, dx, -dy, 0, 0,
> - WSMOUSE_INPUT_DELTA);
> + WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, -dy, 0, 0);
>  }
>  
>  int
> Index: dev/sun/sunms.c
> ===
> RCS file: /cvs/src/sys/dev/sun/sunms.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 sunms.c
> --- dev/sun/sunms.c   20 May 2009 18:22:33 -  1.1
> +++ dev/sun/sunms.c   31 May 2016 19:23:12 -
> @@ -220,8 +220,8 @@ sunms_input(struct sunms_softc *sc, int 
>   if (sc->sc_byteno == sc->sc_pktlen) {
>   timeout_del(>sc_abort_tmo);
>   sc->sc_byteno = -1;
> - wsmouse_input(sc->sc_wsmousedev, sc->sc_mb,
> - sc->sc_dx, sc->sc_dy, 0, 0, WSMOUSE_INPUT_DELTA);
> + WSMOUSE_INPUT(sc->sc_wsmousedev,
> +