From: Jiri Slaby <jirislaby@kernel.org>
To: Tammo Block <tammo.block@gmail.com>, linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v0 4/5] Add support for SRG report output format
Date: Fri, 26 Jun 2020 12:52:38 +0200 [thread overview]
Message-ID: <5ad95786-3c3b-7a1e-c3db-2d03e4319fad@kernel.org> (raw)
In-Reply-To: <f703a17a02475251e50071354977dca8544f969a.1593155911.git.tammo.block@gmail.com>
On 26. 06. 20, 9:23, Tammo Block wrote:
> 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@gmail.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;
bool 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;
Ternary operator superfluous.
> + butt = butt >> 8;
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);
butt |= 3;
> + 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);
thanks,
--
js
suse labs
next prev parent reply other threads:[~2020-06-26 10:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-26 7:21 [PATCH v0 0/5] vt: Add SRG mouse reporting features Tammo Block
2020-06-26 7:22 ` [PATCH v0 1/5] Change/add data structures for SRG mouse reporting Tammo Block
2020-06-26 10:38 ` Jiri Slaby
2020-06-26 7:22 ` [PATCH v0 2/5] Make it possible to enable/disable " Tammo Block
2020-06-26 10:43 ` Jiri Slaby
2020-06-26 7:22 ` [PATCH v0 3/5] Check for SRG protocol and move bit masking Tammo Block
2020-06-26 7:23 ` [PATCH v0 4/5] Add support for SRG report output format Tammo Block
2020-06-26 10:52 ` Jiri Slaby [this message]
2020-06-26 7:23 ` [PATCH v0 5/5] Add Documentation for console mouse reporting Tammo Block
2020-06-26 11:00 ` Jiri Slaby
2020-06-26 17:55 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ad95786-3c3b-7a1e-c3db-2d03e4319fad@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tammo.block@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome