From owner-freebsd-questions@freebsd.org Thu Nov 17 07:23:52 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2CF1C4658C for ; Thu, 17 Nov 2016 07:23:52 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id B8247E17 for ; Thu, 17 Nov 2016 07:23:52 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: by mailman.ysv.freebsd.org (Postfix) id B7800C4658B; Thu, 17 Nov 2016 07:23:52 +0000 (UTC) Delivered-To: questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B736AC4658A for ; Thu, 17 Nov 2016 07:23:52 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (mail.cs.ait.ac.th [192.41.170.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D76AE16 for ; Thu, 17 Nov 2016 07:23:51 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (localhost [127.0.0.1]) by mail.cs.ait.ac.th (Postfix) with ESMTP id 33974D7884 for ; Thu, 17 Nov 2016 14:13:48 +0700 (ICT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cs.ait.ac.th; h= content-type:content-type:mime-version:message-id:date:date :subject:subject:from:from:received:received:received; s= selector1; t=1479366827; x=1481181228; bh=3Bp6w0TVvyhjpnbmDBNwCn g2W2exfpGzK4lIVmHtNUQ=; b=LY7mJPoz+Fim7tSMSXuebiITsED3UNV8owkJE7 DT4qkPu/l+cNyIttIv9vgHAS+o4DmSkoBZi8NadRa6mfniBumao4E5TU7d6Wf2Pm u8/FQrIxlnZeacbKGce3lrLcO/7/+uSdX5BYBJQ8B5bPn1MRr32gO9VlEnIVebI7 6JNz4= X-Virus-Scanned: amavisd-new at cs.ait.ac.th Received: from mail.cs.ait.ac.th ([127.0.0.1]) by mail.cs.ait.ac.th (mail.cs.ait.ac.th [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id PHryoCP3VG7F for ; Thu, 17 Nov 2016 14:13:47 +0700 (ICT) Received: from banyan.cs.ait.ac.th (banyan.cs.ait.ac.th [192.41.170.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.cs.ait.ac.th (Postfix) with ESMTPS id 7B6EAD78A1 for ; Thu, 17 Nov 2016 14:13:32 +0700 (ICT) Received: (from on@localhost) by banyan.cs.ait.ac.th (8.15.2/8.15.2/Submit) id uAG8XZEu013673; Wed, 16 Nov 2016 15:33:35 +0700 (ICT) (envelope-from on@banyan.cs.ait.ac.th) From: Olivier To: questions@freebsd.org Subject: New behavious in /dev/consolectl Date: Wed, 16 Nov 2016 15:33:35 +0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2016 07:23:52 -0000 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 #include #include #include 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"); } } --