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.bl...@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