From c0a05e36a84962f2bfc342ecfa66b65c12e59736 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sat, 11 Jun 2022 20:49:34 -0500 Subject: [PATCH 1/2] Allows for xinput mouse w/ pipeinput uinput kb. Closes #194 --- src/pointer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pointer.c b/src/pointer.c index c0f6433a..0960a098 100644 --- a/src/pointer.c +++ b/src/pointer.c @@ -630,7 +630,9 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) { } else if (pipeinput_int == PIPEINPUT_CONSOLE) { console_pointer_command(mask, x, y, client); } else if (pipeinput_int == PIPEINPUT_UINPUT) { - uinput_pointer_command(mask, x, y, client); + // uinput_pointer_command(mask, x, y, client); + update_x11_pointer_position(x, y, client); + update_x11_pointer_mask(mask, client); } else if (pipeinput_int == PIPEINPUT_MACOSX) { macosx_pointer_command(mask, x, y, client); } else if (pipeinput_int == PIPEINPUT_VNC) { From f1eeb6d7d3f73503f66bf7ab85e8721ae088cbe7 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 5 Sep 2022 00:36:53 -0500 Subject: [PATCH 2/2] Added UINPUTX to -pipeinput, uinput for keystrokes, xinput for mouse --- doc/FAQ.md | 7 ++++++- src/help.c | 10 ++++++++++ src/keyboard.c | 2 +- src/params.h | 1 + src/pointer.c | 11 ++++++++++- x11vnc.1 | 8 ++++++++ 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/doc/FAQ.md b/doc/FAQ.md index 65500d90..c35a8dc9 100755 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -5705,6 +5705,9 @@ program that will inject or otherwise process mouse and keystroke input.) Some useful -pipeinput schemes, VID, CONSOLE, and UINPUT, have since been built into x11vnc for convenience. +As of Sept/2022 UINPUTX scheme has been added to -pipeinput for better +scrolling capabilities via xinput while using uinput for keyboard keystrokes. + This non-X mode for x11vnc is somewhat experimental because it is so removed in scope from the intended usage of the tool. Incomplete attempt is made to make all of the other options consistent with non-X @@ -5926,7 +5929,9 @@ and mouse input and so it preferred when accessing graphical (e.g. Qt-embedded) linux console apps. See -pipeinput UINPUT below for more information on this mode (you may want to also use the -nodragging and -cursor none options.) Use "console0", etc or --pipeinput CONSOLE to force the /dev/ttyN method. +-pipeinput CONSOLE to force the /dev/ttyN method. Another option +if you only need keystrokes over uinput is to use +-pipeinput INPUTX and it will keep the mouse working over xinput. Note you can change VT remotely using the chvt(1) command. Sometimes switching out and back corrects the framebuffer state. diff --git a/src/help.c b/src/help.c index dacebe49..746b6b2f 100644 --- a/src/help.c +++ b/src/help.c @@ -4589,6 +4589,8 @@ void print_help(int mode) { " You may also want to also use the -nodragging and\n" " -cursor none options. Use \"console0\", etc or\n" " -pipeinput CONSOLE to force the /dev/ttyN method.\n" +" If you only want keystrokes over UINPUT, but keep\n" +" your mouse over xinput then use -pipeinput UINPUTX.\n" "\n" " Note you can change the Linux VT remotely using the\n" " chvt(1) command to make the one you want be the active\n" @@ -4730,6 +4732,14 @@ void print_help(int mode) { " create it with \"mknod /dev/input/uinput c 10 223\"\n" " and insert the module with \"modprobe uinput\".\n" "\n" +" If cmd begins with \"UINPUTX\" then the Linux uinput\n" +" module is used to insert both keystroke to the \n" +" Linux console (see -rawfb above), but mouse events stay\n" +" with xinput for better scrolling. The keyboard input is\n" +" usually the /dev/input/uinput device file (you may need\n" +" to create it with \"mknod /dev/input/uinput c 10 223\"\n" +" and insert the module with \"modprobe uinput\".\n" +"\n" " The UINPUT mode currently only does US keyboards (a\n" " scan code option may be added), and not all keysyms\n" " are supported. But it is probably more accurate than\n" diff --git a/src/keyboard.c b/src/keyboard.c index 6dd161da..fb4d409b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2926,7 +2926,7 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { v4l_key_command(down, keysym, client); } else if (pipeinput_int == PIPEINPUT_CONSOLE) { console_key_command(down, keysym, client); - } else if (pipeinput_int == PIPEINPUT_UINPUT) { + } else if (pipeinput_int == PIPEINPUT_UINPUT || pipeinput_int == PIPEINPUT_UINPUTX) { uinput_key_command(down, keysym, client); } else if (pipeinput_int == PIPEINPUT_MACOSX) { macosx_key_command(down, keysym, client); diff --git a/src/params.h b/src/params.h index 6c707f1e..dff2c344 100644 --- a/src/params.h +++ b/src/params.h @@ -74,6 +74,7 @@ so, delete this exception statement from your version. #define PIPEINPUT_UINPUT 0x3 #define PIPEINPUT_MACOSX 0x4 #define PIPEINPUT_VNC 0x5 +#define PIPEINPUT_UINPUTX 0x6 #define MAX_BUTTONS 7 diff --git a/src/pointer.c b/src/pointer.c index 0960a098..ad141872 100644 --- a/src/pointer.c +++ b/src/pointer.c @@ -630,7 +630,8 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) { } else if (pipeinput_int == PIPEINPUT_CONSOLE) { console_pointer_command(mask, x, y, client); } else if (pipeinput_int == PIPEINPUT_UINPUT) { - // uinput_pointer_command(mask, x, y, client); + uinput_pointer_command(mask, x, y, client); + } else if (pipeinput_int == PIPEINPUT_UINPUTX) { update_x11_pointer_position(x, y, client); update_x11_pointer_mask(mask, client); } else if (pipeinput_int == PIPEINPUT_MACOSX) { @@ -1097,6 +1098,14 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p); pipeinput_int = PIPEINPUT_UINPUT; initialize_uinput(); return; + } else if (strstr(p, "UINPUTX") == p) { + char *q = strchr(p, ':'); + if (q) { + parse_uinput_str(q+1); + } + pipeinput_int = PIPEINPUT_UINPUTX; + initialize_uinput(); + return; } else if (strstr(p, "MACOSX") == p) { pipeinput_int = PIPEINPUT_MACOSX; return; diff --git a/x11vnc.1 b/x11vnc.1 index d5497c13..3cbab50c 100644 --- a/x11vnc.1 +++ b/x11vnc.1 @@ -5351,6 +5351,14 @@ is the /dev/input/uinput device file (you may need to create it with "mknod /dev/input/uinput c 10 223" and insert the module with "modprobe uinput". .IP +If cmd begins with "UINPUTX" then the Linux uinput +module is used to insert both keystroke +to the Linux console (see \fB-rawfb\fR above), but mouse events +stay with xinput for better scrolling. The keyboard input is +usually the /dev/input/uinput device file (you may need to +create it with "mknod /dev/input/uinput c 10 223" +and insert the module with "modprobe uinput". +.IP The UINPUT mode currently only does US keyboards (a scan code option may be added), and not all keysyms are supported. But it is probably more accurate than