WSCONS_EVENT_WSMOUSED_SLEEP and WSCONS_EVENT_WSMOUSED_CLOSE not used anymore.

OK ?

-- 
Alexandr Shadchin

Index: wsconsio.h
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.69
diff -u -p -r1.69 wsconsio.h
--- wsconsio.h  17 Nov 2013 13:41:26 -0000      1.69
+++ wsconsio.h  21 Dec 2014 17:25:21 -0000
@@ -87,9 +87,6 @@ struct wscons_event {
  */
 #define WSCONS_EVENT_WSMOUSED_ON       12      /* wsmoused(8) active */
 #define WSCONS_EVENT_WSMOUSED_OFF      13      /* wsmoused(8) inactive */
-#define WSCONS_EVENT_WSMOUSED_SLEEP    14      /* wsmoused(8) sleeping */
-#define WSCONS_EVENT_WSMOUSED_CLOSE    15      /* notify wsmoused(8) to close 
-                                                  mouse device */
 
 #define IS_MOTION_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_DELTA_X) || \
                               ((type) == WSCONS_EVENT_MOUSE_DELTA_Y) || \
@@ -98,8 +95,7 @@ struct wscons_event {
 #define IS_BUTTON_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_UP) || \
                               ((type) == WSCONS_EVENT_MOUSE_DOWN))
 #define IS_CTRL_EVENT(type) ((type == WSCONS_EVENT_WSMOUSED_ON) || \
-                            (type == WSCONS_EVENT_WSMOUSED_OFF)|| \
-                            (type == WSCONS_EVENT_WSMOUSED_SLEEP))
+                            (type == WSCONS_EVENT_WSMOUSED_OFF))
 
 /*
  * Keyboard ioctls (0 - 31)
Index: wsmoused.c
===================================================================
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
retrieving revision 1.32
diff -u -p -r1.32 wsmoused.c
--- wsmoused.c  14 May 2014 18:23:22 -0000      1.32
+++ wsmoused.c  21 Dec 2014 17:19:14 -0000
@@ -329,24 +329,18 @@ normalize_event(struct wscons_event *eve
 }
 
 /* send a wscons_event to the kernel */
-static int
+static void
 treat_event(struct wscons_event *event)
 {
        struct wscons_event mapped_event;
 
        if (IS_MOTION_EVENT(event->type)) {
                ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED, event);
-               return 1;
        } else if (IS_BUTTON_EVENT(event->type) &&
            (uint)event->value < MOUSE_MAXBUTTON) {
                mouse_map(event, &mapped_event);
                mouse_click(&mapped_event);
-               return 1;
        }
-       if (event->type == WSCONS_EVENT_WSMOUSED_CLOSE)
-               /* we have to close mouse fd */
-               return 0;
-       return 1;
 }
 
 /* split a full mouse event into multiples wscons events */
@@ -446,56 +440,7 @@ wsmoused(void)
                if (mouse.proto == P_WSCONS) {
                        /* wsmouse supported mouse */
                        read(mouse.mfd, &event, sizeof(event));
-                       res = treat_event(&event);
-                       if (!res) {
-                               /*
-                                * close mouse device and sleep until
-                                * the X server releases it
-                                */
-
-                               struct wscons_event sleeping;
-                               unsigned int tries;
-
-                               /* restore mouse resolution to default value */
-                               res = WSMOUSE_RES_DEFAULT;
-                               ioctl(mouse.mfd, WSMOUSEIO_SRES, &res);
-
-                               close(mouse.mfd);
-                               mouse.mfd = -1;
-
-                               /* sleep until X server releases mouse device */
-                               sleeping.type = WSCONS_EVENT_WSMOUSED_SLEEP;
-                               sleeping.value = 0;
-                               ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED,
-                                   &sleeping);
-
-                               /*
-                                * Since the X server could still be running
-                                * (e.g. when switching from the graphics
-                                * screen to a virtual text console), it might
-                                * not have freed the device yet.
-                                *
-                                * Try to open the device until it succeeds.
-                                */
-                               tries = 0;
-                               for (;;) {
-                                       if ((mouse.mfd = open(mouse.portname,
-                                           O_RDONLY | O_NONBLOCK, 0)) != -1)
-                                               break;
-
-                                       if (tries < 10) {
-                                               tries++;
-                                               sleep(1);
-                                       } else {
-                                               logwarn("unable to open %s, "
-                                                   "will retry in 10 seconds",
-                                                   mouse.portname);
-                                               sleep(10);
-                                       }
-                               }
-
-                               wsmouse_init();
-                       }
+                       treat_event(&event);
                } else {
                        /* serial mouse (not supported by wsmouse) */
                        res = read(mouse.mfd, &b, 1);

Reply via email to