Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Nov 2016 15:33:35 +0700
From:      Olivier <Olivier.Nicole@cs.ait.ac.th>
To:        questions@freebsd.org
Subject:   New behavious in /dev/consolectl
Message-ID:  <wu7h977j02o.fsf@banyan.cs.ait.ac.th>

next in thread | raw e-mail | index | archive | help
Hi,

I have a simple program that read the middle button of the mouse at
start-up and reply with (close/pressed or open/released) (see below).

In previous versions of FreeBSD (up to 9 I think), if the middle button
was pressed when I launched the program, it was detected, and I could
launch and relaunch the program, it was always replying with "close".

Now (FreeBSD 10), the close is only detected on the first run. The
second run will reply "open", even if I keep the button pressed all the
time; like if by reading the button, I was erasing the memory.

I( am pretty positive it was not an issue on previous versions of
FreeBSD, as I have been relying on this for a long time.

Any idea what has changed?

Best regards,

Olivier

#include <sys/mouse.h>
#include <sys/consio.h>
#include <stdio.h>
#include <fcntl.h>

int main (int argc, char ** argv, char** env) {
  int fd_mouse;
  struct mouse_info mouse_info;
  
   fd_mouse=open("/dev/consolectl", O_RDWR); 
 
  mouse_info.operation=MOUSE_GETINFO;
  ioctl(fd_mouse, CONS_MOUSECTL, &mouse_info);
  
  if (((mouse_info.u.data.buttons&(int)2)==2)) {
    printf("closed\n");
  }
  else {
    printf("open\n");
  }
}



-- 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?wu7h977j02o.fsf>