lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f703a17a02475251e50071354977dca8544f969a.1593155911.git.tammo.block@gmail.com>
Date:   Fri, 26 Jun 2020 09:23:03 +0200
From:   Tammo Block <tammo.block@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jslaby@...e.com>
Subject: [PATCH v0 4/5] Add support for SRG report output format

Add SRG ("1005") style mouse reports. Always use them to create a report to
userspace if they are available because they may contain more information
(e.g. scroll wheel events).

Do not send reports at all if report information is not sufficient.

Signed-off-by: Tammo Block <tammo.block@...il.com>
---
 drivers/tty/vt/vt.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 5c9c449dc150..af0c58a9b108 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -1835,10 +1835,30 @@ static inline void respond_ID(struct tty_struct *tty)
 
 void mouse_report(struct tty_struct *tty, int butt, int mrx, int mry)
 {
-	char buf[8];
+	char buf[20];
+	char rel;
 
-	sprintf(buf, "\033[M%c%c%c", (char)(' ' + (butt & TIOCL_SELBUTTONMASK)),
-		(char)('!' + mrx), (char)('!' + mry));
+	if (butt & TIOCL_SELSRGREPORT) {
+		rel = (butt & TIOCL_SELSRGRELEASE) ? 1 : 0;
+		butt = butt >> 8;
+
+		if (vc_cons[fg_console].d->vc_proto_mouse) {
+			sprintf(buf, "\033[<%d;%d;%d%c", butt, mrx + 1, mry + 1, rel ? 'm' : 'M');
+		} else {
+			if (rel)
+				butt = (3 | butt);
+			sprintf(buf, "\033[M%c%c%c", (char)(' ' + butt),
+				(char)('!' + mrx), (char)('!' + mry));
+		}
+	} else {
+		/* Compatibility for older protocol */
+		if (vc_cons[fg_console].d->vc_proto_mouse)
+			return;
+		if (vc_cons[fg_console].d->vc_report_mouse > 2)
+			return;
+		sprintf(buf, "\033[M%c%c%c", (char)(' ' + (butt & TIOCL_SELBUTTONMASK)),
+			(char)('!' + mrx), (char)('!' + mry));
+	}
 	respond_string(buf, tty->port);
 }
 
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ