Commit 816d7e06 authored by runge's avatar runge

x11vnc: first pass at touchscreens via uinput.

parent 0bc50a9d
2006-08-10 Karl Runge <runge@karlrunge.com>
* x11vnc: first pass at touchscreens via uinput.
2006-08-02 Karl Runge <runge@karlrunge.com> 2006-08-02 Karl Runge <runge@karlrunge.com>
* x11vnc: add -ssltimeout option; tweak ssl timeouts. * x11vnc: add -ssltimeout option; tweak ssl timeouts.
......
x11vnc README file Date: Wed Aug 2 12:13:27 EDT 2006 x11vnc README file Date: Thu Aug 10 17:31:16 EDT 2006
The following information is taken from these URLs: The following information is taken from these URLs:
...@@ -2708,7 +2708,7 @@ fi ...@@ -2708,7 +2708,7 @@ fi
client = yes client = yes
options = ALL options = ALL
[myvncssl] [myvncssl]
accept = 5902 accept = localhost:5902
connect = far-away.east:5901 connect = far-away.east:5901
then double click on the stunnel.exe icon to launch it (followed by then double click on the stunnel.exe icon to launch it (followed by
...@@ -5504,6 +5504,10 @@ ied) ...@@ -5504,6 +5504,10 @@ ied)
cannot do both the Linux console framebuffer and VNC at the same time, cannot do both the Linux console framebuffer and VNC at the same time,
which is often what is desired from VNC. which is often what is desired from VNC.
Update: We are finding some setups like Qtopia the IPAQ do not allow
mouse input via uinput. Please help us debug this problem by trying
x11vnc on your device and letting us know what does and does not work.
Q-95: Now that non-X11 devices can be exported via VNC using x11vnc, Q-95: Now that non-X11 devices can be exported via VNC using x11vnc,
can I build it with no dependencies on X11 header files and libraries? can I build it with no dependencies on X11 header files and libraries?
...@@ -7478,12 +7482,13 @@ http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html: ...@@ -7478,12 +7482,13 @@ http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html:
Enhanced TightVNC Viewer Enhanced TightVNC Viewer
The Enhanced TightVNC Viewer package is an attempt to add some patches The Enhanced TightVNC Viewer package is a project to add some patches
to the long neglected Unix Tight VNC Viewer. It also adds a simple GUI to the long neglected Unix TightVNC Viewer. It also adds a GUI for
for Windows that automatically starts up a STUNNEL SSL tunnel for SSL Windows and Unix that automatically starts up a STUNNEL SSL tunnel for
connections to [1]x11vnc (or any other VNC Server also running STUNNEL SSL connections to [1]x11vnc (or any other VNC Server also running an
at their end), and then launches the Windows Tight VNC Viewer. A SSL tunnel, such as STUNNEL, at their end), and then launches the
wrapper and gui for SSH connections is also provided. TightVNC Viewer. The program can also be used set up SSH tunnelled
connections instead.
Patches were created for the TightVNC 1.3dev7 vnc_unixsrc tree to add Patches were created for the TightVNC 1.3dev7 vnc_unixsrc tree to add
these features: these features:
...@@ -7497,9 +7502,9 @@ Enhanced TightVNC Viewer ...@@ -7497,9 +7502,9 @@ Enhanced TightVNC Viewer
The Viewer SSL support is done via a wrapper script The Viewer SSL support is done via a wrapper script
(bin/ssl_tightvncviewer) that starts up the STUNNEL tunnel first and (bin/ssl_tightvncviewer) that starts up the STUNNEL tunnel first and
then starts the Tight VNC viewer pointed at that tunnel. The then starts the TightVNC viewer pointed at that tunnel. The
bin/ssl_vnc_gui program is a simple gui front-end to that script. See bin/ssl_vnc_gui program is a GUI front-end to that script. See [2]this
[2]this FAQ for more details on SSL tunnelling. FAQ for more details on SSL tunnelling.
The rfbNewFBSize support allows the enhanced TightVNC Unix viewer to The rfbNewFBSize support allows the enhanced TightVNC Unix viewer to
resize when the server does (e.g. "x11vnc -R scale=3/4" remote control resize when the server does (e.g. "x11vnc -R scale=3/4" remote control
...@@ -7507,21 +7512,22 @@ Enhanced TightVNC Viewer ...@@ -7507,21 +7512,22 @@ Enhanced TightVNC Viewer
The cursor alphablending is [3]described here. The cursor alphablending is [3]described here.
For Windows SSL Viewer support is provided by a simple program For Windows, SSL Viewer support is provided by a GUI
Windows/ssl_tightvncviewer.exe that prompts for the VNC display and Windows/ssl_tightvncviewer.exe that prompts for the VNC display and
then starts up STUNNEL followed by the Stock TightVNC Windows Viewer. then starts up STUNNEL followed by the Stock TightVNC Windows Viewer.
When the connection is finished, you may need to manually stop the The GUI has other useful features. When the connection is finished,
STUNNEL program by clicking on the icon in the System Tray. If it can you will be asked if you want to terminate the STUNNEL program. For
track the STUNNEL processes it will ask you if you want to terminate SSH connections from Windows the GUI will use PLINK instead of
it. STUNNEL.
Hopefully these binaries will make it convenient for people to help Hopefully these binaries will make it convenient for people to help
test and use the [4]built-in SSL support in x11vnc. Extra testing of test and use the [4]built-in SSL support in x11vnc. Extra testing of
this feature is much appreciated! Thanks. this feature is much appreciated!! Thanks.
For the heck of it, some wrapper scripts and gui interfaces where also For the heck of it, the wrapper scripts and GUI interface were also
added to automatically set up a SSH tunnel instead of STUNNEL SSL. modified to be able to automatically set up an SSH tunnel instead of
This works on Unix and Windows (and more smoothly on Unix of course). STUNNEL SSL. This works on Unix and Windows (and more smoothly on Unix
of course).
This package can be downloaded here: This package can be downloaded here:
[5]enhanced_tightvnc_viewer-1.0.zip All Unix and Windows bi [5]enhanced_tightvnc_viewer-1.0.zip All Unix and Windows bi
...@@ -7554,9 +7560,10 @@ es. (~3MB) ...@@ -7554,9 +7560,10 @@ es. (~3MB)
or the included binary does not run properly on your system. Let me or the included binary does not run properly on your system. Let me
know how that goes. know how that goes.
IMPORTANT: there may be restrictions for you do download the above IMPORTANT: there may be restrictions for you to download, use, or
because of cryptographic software they contain. Please check out your redistribute the above because of cryptographic software they contain.
situation and information at the following and related sites: Please check out your situation and information at the following and
related sites:
[10]http://www.tightvnc.com [10]http://www.tightvnc.com
[11]http://www.realvnc.com [11]http://www.realvnc.com
[12]http://www.stunnel.org [12]http://www.stunnel.org
...@@ -7568,7 +7575,8 @@ es. (~3MB) ...@@ -7568,7 +7575,8 @@ es. (~3MB)
cryptographic software (again, if your situation warrants, you will cryptographic software (again, if your situation warrants, you will
need to check). This "no_windows" tarball only contains software (from need to check). This "no_windows" tarball only contains software (from
the above URL's and elsewhere) that will use cryptographic software the above URL's and elsewhere) that will use cryptographic software
(libraries) already installed on your system. (libraries) already installed on your system. See the section on this
in the README below.
Here is the toplevel README from the package: Here is the toplevel README from the package:
...@@ -7655,7 +7663,7 @@ If you need to Build: ...@@ -7655,7 +7663,7 @@ If you need to Build:
-------------------- --------------------
If your OS/arch is not included, the script "build.unix" may be able to If your OS/arch is not included, the script "build.unix" may be able to
successfully build on for you and desposit the binaries down in ./bin/... successfully build on for you and deposit the binaries down in ./bin/...
using the included source code. using the included source code.
You must run the build.unix script from this directory (that this toplevel You must run the build.unix script from this directory (that this toplevel
...@@ -7677,22 +7685,27 @@ combination and if binaries are present for it automatically use them. ...@@ -7677,22 +7685,27 @@ combination and if binaries are present for it automatically use them.
(if not found try the running the build.unix script). (if not found try the running the build.unix script).
If you prefer a GUI to prompt for parameters and then start ssl_tightvncviewer If you prefer a GUI to prompt for parameters and then start ssl_tightvncviewer
run this script: you can run this instead:
./bin/ssl_vnc_gui ./bin/ssl_vnc_gui
this is basically the same GUI that is run on Windows. this is essentially the same GUI that is run on Windows (the
ssl_tightvncviewer.exe).
Using the GUI is it impossible to initiate a VNC connection that is not
encrypted with either SSL or SSH. Unencrypted VNC connections can only
be started by manually running the ./bin/tightvncviewer script.
For convenience, you can make symlinks from a directory in your PATH to For convenience, you can make symlinks from a directory in your PATH to
any of the 3 programs above you want to run. That is all you usually any of the 3 programs above you wish to run. That is all you usually
need to do for it to pick up all of the binaries, utils, etc. E.g. need to do for it to pick up all of the binaries, utils, etc. E.g.
assuming $HOME/bin is in your $PATH: assuming $HOME/bin is in your $PATH:
cd $HOME/bin cd $HOME/bin
ln -s /path/to/enhanced_tightvnc_viewer/bin/{s,t}* . ln -s /path/to/enhanced_tightvnc_viewer/bin/{s,t}* .
(note the "." at the end). That is basically the way to "install" this (note the "." at the end). The above commands is basically the way to
package on Unix. "install" this package on Unix.
Examples: Examples:
...@@ -7704,7 +7717,7 @@ Use enhanced TightVNC unix viewer to connect to x11vnc via SSL: ...@@ -7704,7 +7717,7 @@ Use enhanced TightVNC unix viewer to connect to x11vnc via SSL:
./bin/tightvncviewer -ssl far-away.east:0 (same) ./bin/tightvncviewer -ssl far-away.east:0 (same)
./bin/ssl_vnc_gui (start gui launcher) ./bin/ssl_vnc_gui (start GUI launcher)
Use enhanced TightVNC unix viewer without SSL: Use enhanced TightVNC unix viewer without SSL:
...@@ -7812,7 +7825,7 @@ x11vnc: a VNC server for real X displays ...@@ -7812,7 +7825,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options: Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions) % x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-08-02 x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-08-10
x11vnc options: x11vnc options:
-display disp -auth file -id windowid -display disp -auth file -id windowid
...@@ -7911,7 +7924,7 @@ libvncserver-tight-extension options: ...@@ -7911,7 +7924,7 @@ libvncserver-tight-extension options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-08-02 x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-08-10
(type "x11vnc -opts" to just list the options.) (type "x11vnc -opts" to just list the options.)
...@@ -8508,35 +8521,38 @@ Options: ...@@ -8508,35 +8521,38 @@ Options:
above command is run as the user who just authenticated above command is run as the user who just authenticated
via the login and password prompt. via the login and password prompt.
Also in the case of -unixpw, the user logging in Also in the case of -unixpw, the user logging in can
can place a colon at the end of his username and place a colon at the end of his username and supply
supply a few options: scale=, scale_cursor= (or sc=), a few options: scale=, scale_cursor= (or sc=), solid
solid (or so), id=, clear_mods (or cm), clear_keys (or so), id=, clear_mods (or cm), clear_keys (or ck),
(or ck), repeat, speeds= (or sp=), readtimeout= repeat, speeds= (or sp=), readtimeout= (or rd=), or
(or rd=), or rotate= (or ro=) separated by commas if the rotate= (or ro=) separated by commas if there is more
re is more than one. than one. After the user logs in successfully, these
After the user logs in successfully, these options will options will be applied to the VNC screen. For example,
be applied to the VNC screen. For example,
login: fred:scale=3/4,sc=1,repeat login: fred:scale=3/4,sc=1,repeat
Password: ... Password: ...
login: runge:sp=modem,rd=120,solid=root: login: runge:sp=modem,rd=120,solid
for convenience m/n implies scale= e.g. fred:3/4 for convenience m/n implies scale= e.g. fred:3/4 If you
To disable this set the environment variable type and enter your password incorrectly, to retrieve
X11VNC_NO_UNIXPW_OPTS=1. To set any other options, your long "login:" line press the Up arrow once
the user can use the gui (x11vnc -gui connect) or the (before typing anything else).
remote control method (x11vnc -R opt:val) during his
VNC session.
So the combination of -display WAIT:cmd=... and To disable the option setting set the environment
-unixpw allows automatic pairing of an unix variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.
authenticated VNC user with his desktop. This could To set any other options, the user can use the gui
be very useful on SunRays and also any system where (x11vnc -gui connect) or the remote control method
multiple users share a given machine. The user does (x11vnc -R opt:val) during his VNC session.
not need to remember special ports or passwords set up
for his desktop and VNC. The combination of -display WAIT:cmd=... and -unixpw
allows automatic pairing of an unix authenticated VNC
user with his desktop. This could be very useful on
SunRays and also any system where multiple users share
a given machine. The user does not need to remember
special ports or passwords set up for his desktop
and VNC.
A nice way to use WAIT:cmd=... is out of inetd(8) A nice way to use WAIT:cmd=... is out of inetd(8)
(it automatically forks a new x11vnc for each user). (it automatically forks a new x11vnc for each user).
...@@ -9067,7 +9083,7 @@ re is more than one. ...@@ -9067,7 +9083,7 @@ re is more than one.
unreliable (especially if the user takes much time to unreliable (especially if the user takes much time to
ponder the Certificate dialogs in his browser, Java VM, ponder the Certificate dialogs in his browser, Java VM,
or VNC Viewer applet. That's right 3 separate "Are or VNC Viewer applet. That's right 3 separate "Are
you sure you want to connect" dialogs!) you sure you want to connect?" dialogs!)
So use the -https option to provide a separate, more So use the -https option to provide a separate, more
reliable HTTPS port that x11vnc will listen on. If reliable HTTPS port that x11vnc will listen on. If
...@@ -10591,6 +10607,16 @@ re is more than one. ...@@ -10591,6 +10607,16 @@ re is more than one.
cause jerkiness or unexpected behavior with menus, etc. cause jerkiness or unexpected behavior with menus, etc.
Use reset=0 to disable. Use reset=0 to disable.
If the uinput device has an absolute pointer (as opposed
to a normal mouse that is a relative pointer) you can
specify the option "abs". Note that a touchpad
on a laptop is an absolute device t some degree.
This (usually) avoids all the problems with mouse
acceleration. If x11vnc has trouble deducing the size
of the device, use "abs=WxH". Furthermore, if the
device is a touchscreen (assumed to have an absolute
pointer) use "touch" or "touch=WxH".
If you set the env. var X11VNC_UINPUT_THRESHOLDS then If you set the env. var X11VNC_UINPUT_THRESHOLDS then
the thresh=n mode will be enabled. It it currently the thresh=n mode will be enabled. It it currently
not working well. If |dx| <= thresh and |dy| < thresh not working well. If |dx| <= thresh and |dy| < thresh
......
...@@ -620,34 +620,38 @@ void print_help(int mode) { ...@@ -620,34 +620,38 @@ void print_help(int mode) {
" above command is run as the user who just authenticated\n" " above command is run as the user who just authenticated\n"
" via the login and password prompt.\n" " via the login and password prompt.\n"
"\n" "\n"
" Also in the case of -unixpw, the user logging in\n" " Also in the case of -unixpw, the user logging in can\n"
" can place a colon at the end of his username and\n" " place a colon at the end of his username and supply\n"
" supply a few options: scale=, scale_cursor= (or sc=),\n" " a few options: scale=, scale_cursor= (or sc=), solid\n"
" solid (or so), id=, clear_mods (or cm), clear_keys\n" " (or so), id=, clear_mods (or cm), clear_keys (or ck),\n"
" (or ck), repeat, speeds= (or sp=), readtimeout=\n" " repeat, speeds= (or sp=), readtimeout= (or rd=), or\n"
" (or rd=), or rotate= (or ro=) separated by commas if there is more than one.\n" " rotate= (or ro=) separated by commas if there is more\n"
" After the user logs in successfully, these options will\n" " than one. After the user logs in successfully, these\n"
" be applied to the VNC screen. For example,\n" " options will be applied to the VNC screen. For example,\n"
"\n" "\n"
" login: fred:scale=3/4,sc=1,repeat\n" " login: fred:scale=3/4,sc=1,repeat\n"
" Password: ...\n" " Password: ...\n"
"\n" "\n"
" login: runge:sp=modem,rd=120,solid=root:\n" " login: runge:sp=modem,rd=120,solid\n"
"\n" "\n"
" for convenience m/n implies scale= e.g. fred:3/4\n" " for convenience m/n implies scale= e.g. fred:3/4 If you\n"
" To disable this set the environment variable\n" " type and enter your password incorrectly, to retrieve\n"
" X11VNC_NO_UNIXPW_OPTS=1. To set any other options,\n" " your long \"login:\" line press the Up arrow once\n"
" the user can use the gui (x11vnc -gui connect) or the\n" " (before typing anything else).\n"
" remote control method (x11vnc -R opt:val) during his\n"
" VNC session.\n"
"\n" "\n"
" So the combination of -display WAIT:cmd=... and\n" " To disable the option setting set the environment\n"
" -unixpw allows automatic pairing of an unix\n" " variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.\n"
" authenticated VNC user with his desktop. This could\n" " To set any other options, the user can use the gui\n"
" be very useful on SunRays and also any system where\n" " (x11vnc -gui connect) or the remote control method\n"
" multiple users share a given machine. The user does\n" " (x11vnc -R opt:val) during his VNC session.\n"
" not need to remember special ports or passwords set up\n" "\n"
" for his desktop and VNC.\n" " The combination of -display WAIT:cmd=... and -unixpw\n"
" allows automatic pairing of an unix authenticated VNC\n"
" user with his desktop. This could be very useful on\n"
" SunRays and also any system where multiple users share\n"
" a given machine. The user does not need to remember\n"
" special ports or passwords set up for his desktop\n"
" and VNC.\n"
"\n" "\n"
" A nice way to use WAIT:cmd=... is out of inetd(8)\n" " A nice way to use WAIT:cmd=... is out of inetd(8)\n"
" (it automatically forks a new x11vnc for each user).\n" " (it automatically forks a new x11vnc for each user).\n"
...@@ -1181,7 +1185,7 @@ void print_help(int mode) { ...@@ -1181,7 +1185,7 @@ void print_help(int mode) {
" unreliable (especially if the user takes much time to\n" " unreliable (especially if the user takes much time to\n"
" ponder the Certificate dialogs in his browser, Java VM,\n" " ponder the Certificate dialogs in his browser, Java VM,\n"
" or VNC Viewer applet. That's right 3 separate \"Are\n" " or VNC Viewer applet. That's right 3 separate \"Are\n"
" you sure you want to connect\" dialogs!)\n" " you sure you want to connect?\" dialogs!)\n"
"\n" "\n"
" So use the -https option to provide a separate, more\n" " So use the -https option to provide a separate, more\n"
" reliable HTTPS port that x11vnc will listen on. If\n" " reliable HTTPS port that x11vnc will listen on. If\n"
...@@ -2714,6 +2718,16 @@ void print_help(int mode) { ...@@ -2714,6 +2718,16 @@ void print_help(int mode) {
" cause jerkiness or unexpected behavior with menus, etc.\n" " cause jerkiness or unexpected behavior with menus, etc.\n"
" Use reset=0 to disable.\n" " Use reset=0 to disable.\n"
"\n" "\n"
" If the uinput device has an absolute pointer (as opposed\n"
" to a normal mouse that is a relative pointer) you can\n"
" specify the option \"abs\". Note that a touchpad\n"
" on a laptop is an absolute device t some degree.\n"
" This (usually) avoids all the problems with mouse\n"
" acceleration. If x11vnc has trouble deducing the size\n"
" of the device, use \"abs=WxH\". Furthermore, if the\n"
" device is a touchscreen (assumed to have an absolute\n"
" pointer) use \"touch\" or \"touch=WxH\".\n"
"\n"
" If you set the env. var X11VNC_UINPUT_THRESHOLDS then\n" " If you set the env. var X11VNC_UINPUT_THRESHOLDS then\n"
" the thresh=n mode will be enabled. It it currently\n" " the thresh=n mode will be enabled. It it currently\n"
" not working well. If |dx| <= thresh and |dy| < thresh\n" " not working well. If |dx| <= thresh and |dy| < thresh\n"
......
...@@ -94,20 +94,6 @@ char *console_guess(char *str, int *fd) { ...@@ -94,20 +94,6 @@ char *console_guess(char *str, int *fd) {
} }
} }
if (do_input) {
if (tty >=0 && tty < 64) {
pipeinput_str = (char *) malloc(10);
sprintf(pipeinput_str, "CONSOLE%d", tty);
rfbLog("console_guess: file pipeinput %s\n",
pipeinput_str);
initialize_pipeinput();
} else if (have_uinput) {
pipeinput_str = strdup("UINPUT");
rfbLog("console_guess: file pipeinput %s\n",
pipeinput_str);
initialize_pipeinput();
}
}
if (! atparms) { if (! atparms) {
#if LIBVNCSERVER_HAVE_LINUX_FB_H #if LIBVNCSERVER_HAVE_LINUX_FB_H
#if LIBVNCSERVER_HAVE_SYS_IOCTL_H #if LIBVNCSERVER_HAVE_SYS_IOCTL_H
...@@ -153,6 +139,30 @@ char *console_guess(char *str, int *fd) { ...@@ -153,6 +139,30 @@ char *console_guess(char *str, int *fd) {
#endif #endif
} }
if (atparms) {
int gw, gh, gb;
if (sscanf(atparms, "%dx%dx%d", &gw, &gh, &gb) == 3) {
fb_x = gw;
fb_y = gh;
fb_b = gb;
}
}
if (do_input) {
if (tty >=0 && tty < 64) {
pipeinput_str = (char *) malloc(10);
sprintf(pipeinput_str, "CONSOLE%d", tty);
rfbLog("console_guess: file pipeinput %s\n",
pipeinput_str);
initialize_pipeinput();
} else if (have_uinput) {
pipeinput_str = strdup("UINPUT");
rfbLog("console_guess: file pipeinput %s\n",
pipeinput_str);
initialize_pipeinput();
}
}
if (! atparms) { if (! atparms) {
rfbLog("console_guess: could not get @ parameters.\n"); rfbLog("console_guess: could not get @ parameters.\n");
return NULL; return NULL;
......
...@@ -28,9 +28,15 @@ int initialize_uinput(void); ...@@ -28,9 +28,15 @@ int initialize_uinput(void);
int set_uinput_accel(char *str); int set_uinput_accel(char *str);
int set_uinput_thresh(char *str); int set_uinput_thresh(char *str);
void set_uinput_reset(int ms); void set_uinput_reset(int ms);
void set_uinput_always(int);
void set_uinput_touchscreen(int);
void set_uinput_abs(int);
char *get_uinput_accel(); char *get_uinput_accel();
char *get_uinput_thresh(); char *get_uinput_thresh();
int get_uinput_reset(); int get_uinput_reset();
int get_uinput_always();
int get_uinput_touchscreen();
int get_uinput_abs();
void parse_uinput_str(char *str); void parse_uinput_str(char *str);
void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client); void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client);
void uinput_key_command(int down, int keysym, rfbClientPtr client); void uinput_key_command(int down, int keysym, rfbClientPtr client);
...@@ -51,6 +57,9 @@ static int bmask = 0; ...@@ -51,6 +57,9 @@ static int bmask = 0;
static char *injectable = NULL; static char *injectable = NULL;
static char *uinput_dev = NULL; static char *uinput_dev = NULL;
static int uinput_touchscreen = 0;
static int uinput_abs = 0;
static int abs_x = 0, abs_y = 0;
static char *devs[] = { static char *devs[] = {
"/dev/misc/uinput", "/dev/misc/uinput",
...@@ -78,9 +87,12 @@ int check_uinput(void) { ...@@ -78,9 +87,12 @@ int check_uinput(void) {
if (maj < 2) { if (maj < 2) {
return 0; return 0;
} else if (maj == 2) { } else if (maj == 2) {
/* hmmm IPAQ 2.4.19-rmk6-pxa1-hh37 works... */
#if 0
if (min < 6) { if (min < 6) {
return 0; return 0;
} }
#endif
} }
} }
} }
...@@ -210,6 +222,35 @@ int initialize_uinput(void) { ...@@ -210,6 +222,35 @@ int initialize_uinput(void) {
ioctl(fd, UI_SET_KEYBIT, BTN_FORWARD); ioctl(fd, UI_SET_KEYBIT, BTN_FORWARD);
ioctl(fd, UI_SET_KEYBIT, BTN_BACK); ioctl(fd, UI_SET_KEYBIT, BTN_BACK);
if (uinput_touchscreen) {
ioctl(fd, UI_SET_KEYBIT, BTN_TOUCH);
rfbLog("uinput: touchscreen enabled.\n");
}
if (uinput_touchscreen || uinput_abs) {
int gw = abs_x, gh = abs_y;
if (! gw || ! gh) {
gw = fb_x; gh = fb_y;
}
if (! gw || ! gh) {
gw = dpy_x; gh = dpy_y;
}
abs_x = gw;
abs_y = gh;
ioctl(fd, UI_SET_EVBIT, EV_ABS);
ioctl(fd, UI_SET_ABSBIT, ABS_X);
ioctl(fd, UI_SET_ABSBIT, ABS_Y);
udev.absmin[ABS_X] = 0;
udev.absmax[ABS_X] = gw;
udev.absfuzz[ABS_X] = 0;
udev.absflat[ABS_X] = 0;
udev.absmin[ABS_Y] = 0;
udev.absmax[ABS_Y] = gh;
udev.absfuzz[ABS_Y] = 0;
udev.absflat[ABS_Y] = 0;
rfbLog("uinput: absolute pointer enabled at %dx%d.\n", abs_x, abs_y);
set_uinput_accel_xy(1.0, 1.0);
}
write(fd, &udev, sizeof(udev)); write(fd, &udev, sizeof(udev));
if (ioctl(fd, UI_DEV_CREATE) != 0) { if (ioctl(fd, UI_DEV_CREATE) != 0) {
...@@ -287,6 +328,14 @@ void set_uinput_always(int a) { ...@@ -287,6 +328,14 @@ void set_uinput_always(int a) {
uinput_always = a; uinput_always = a;
} }
void set_uinput_touchscreen(int b) {
uinput_touchscreen = b;
}
void set_uinput_abs(int b) {
uinput_abs = b;
}
char *get_uinput_accel(void) { char *get_uinput_accel(void) {
return uinput_accel_str; return uinput_accel_str;
} }
...@@ -301,6 +350,14 @@ int get_uinput_always(void) { ...@@ -301,6 +350,14 @@ int get_uinput_always(void) {
return uinput_always; return uinput_always;
} }
int get_uinput_touchscreen(void) {
return uinput_touchscreen;
}
int get_uinput_abs(void) {
return uinput_abs;
}
void parse_uinput_str(char *in) { void parse_uinput_str(char *in) {
char *p, *q, *str = strdup(in); char *p, *q, *str = strdup(in);
...@@ -309,6 +366,10 @@ void parse_uinput_str(char *in) { ...@@ -309,6 +366,10 @@ void parse_uinput_str(char *in) {
injectable = strdup("KMB"); injectable = strdup("KMB");
} }
uinput_touchscreen = 0;
uinput_abs = 0;
abs_x = abs_y = 0;
p = strtok(str, ","); p = strtok(str, ",");
while (p) { while (p) {
if (p[0] == '/') { if (p[0] == '/') {
...@@ -336,6 +397,24 @@ void parse_uinput_str(char *in) { ...@@ -336,6 +397,24 @@ void parse_uinput_str(char *in) {
free(injectable); free(injectable);
} }
injectable = strdup(p); injectable = strdup(p);
} else if (strstr(p, "touch") == p) {
int gw, gh;
q = strchr(p, '=');
set_uinput_touchscreen(1);
set_uinput_abs(1);
if (q && sscanf(q+1, "%dx%d", &gw, &gh) == 2) {
abs_x = gw;
abs_y = gh;
}
} else if (strstr(p, "abs") == p) {
int gw, gh;
q = strchr(p, '=');
set_uinput_abs(1);
if (q && sscanf(q+1, "%dx%d", &gw, &gh) == 2) {
abs_x = gw;
abs_y = gh;
}
} else { } else {
rfbLog("invalid UINPUT option: %s\n", p); rfbLog("invalid UINPUT option: %s\n", p);
clean_up_exit(1); clean_up_exit(1);
...@@ -373,6 +452,36 @@ static void ptr_move(int dx, int dy) { ...@@ -373,6 +452,36 @@ static void ptr_move(int dx, int dy) {
#endif #endif
} }
static void ptr_abs(int x, int y) {
#ifdef UINPUT_OK
struct input_event ev;
if (injectable && strchr(injectable, 'M') == NULL) {
return;
}
memset(&ev, 0, sizeof(ev));
if (db) fprintf(stderr, "ptr_abs(%d, %d)\n", x, y);
gettimeofday(&ev.time, NULL);
ev.type = EV_ABS;
ev.code = ABS_Y;
ev.value = y;
write(fd, &ev, sizeof(ev));
ev.type = EV_ABS;
ev.code = ABS_X;
ev.value = x;
write(fd, &ev, sizeof(ev));
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
write(fd, &ev, sizeof(ev));
#endif
}
static int inside_thresh(int dx, int dy, int thr) { static int inside_thresh(int dx, int dy, int thr) {
if (thresh_or) { if (thresh_or) {
/* this is peeking at qt-embedded qmouse_qws.cpp */ /* this is peeking at qt-embedded qmouse_qws.cpp */
...@@ -528,7 +637,10 @@ static void button_click(int down, int btn) { ...@@ -528,7 +637,10 @@ static void button_click(int down, int btn) {
ev.type = EV_KEY; ev.type = EV_KEY;
ev.value = down; ev.value = down;
if (btn == 1) { if (uinput_touchscreen) {
ev.code = BTN_TOUCH;
if (db) fprintf(stderr, "set code to BTN_TOUCH\n");
} else if (btn == 1) {
ev.code = BTN_LEFT; ev.code = BTN_LEFT;
} else if (btn == 2) { } else if (btn == 2) {
ev.code = BTN_MIDDLE; ev.code = BTN_MIDDLE;
...@@ -583,7 +695,7 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) { ...@@ -583,7 +695,7 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
do_reset = 1; do_reset = 1;
if (mask || bmask) { if (mask || bmask) {
do_reset = 0; /* do not do reset if moust button down */ do_reset = 0; /* do not do reset if mouse button down */
} else if (! input.motion) { } else if (! input.motion) {
do_reset = 0; do_reset = 0;
} else if (now < last_zero + zero_delay) { } else if (now < last_zero + zero_delay) {
...@@ -600,6 +712,18 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) { ...@@ -600,6 +712,18 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
if (uinput_always && !mask && !bmask && input.motion) { if (uinput_always && !mask && !bmask && input.motion) {
do_reset = 1; do_reset = 1;
} }
if (uinput_abs) {
#if 0
/* this is a bad idea... need to do something else */
if (do_reset) {
ptr_abs(dpy_x, dpy_y);
usleep(10*1000);
ptr_abs(x, y);
usleep(10*1000);
}
#endif
do_reset = 0;
}
if (do_reset) { if (do_reset) {
static int first = 1; static int first = 1;
...@@ -696,7 +820,11 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) { ...@@ -696,7 +820,11 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
if (input.motion) { if (input.motion) {
if (x != last_x || y != last_y) { if (x != last_x || y != last_y) {
if (uinput_abs) {
ptr_abs(x, y);
} else {
ptr_rel(x - last_x, y - last_y); ptr_rel(x - last_x, y - last_y);
}
last_x = x; last_x = x;
last_y = y; last_y = y;
} }
......
...@@ -9,10 +9,14 @@ extern int set_uinput_accel(char *str); ...@@ -9,10 +9,14 @@ extern int set_uinput_accel(char *str);
extern int set_uinput_thresh(char *str); extern int set_uinput_thresh(char *str);
extern void set_uinput_reset(int ms); extern void set_uinput_reset(int ms);
extern void set_uinput_always(int); extern void set_uinput_always(int);
extern void set_uinput_touchscreen(int);
extern void set_uinput_abs(int);
extern char *get_uinput_accel(); extern char *get_uinput_accel();
extern char *get_uinput_thresh(); extern char *get_uinput_thresh();
extern int get_uinput_reset(); extern int get_uinput_reset();
extern int get_uinput_always(); extern int get_uinput_always();
extern int get_uinput_touchscreen();
extern int get_uinput_abs();
extern void parse_uinput_str(char *str); extern void parse_uinput_str(char *str);
extern void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client); extern void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client);
extern void uinput_key_command(int down, int keysym, rfbClientPtr client); extern void uinput_key_command(int down, int keysym, rfbClientPtr client);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.TH X11VNC "1" "August 2006" "x11vnc " "User Commands" .TH X11VNC "1" "August 2006" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.8.3, lastmod: 2006-08-02 version: 0.8.3, lastmod: 2006-08-10
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
...@@ -740,34 +740,38 @@ In the case of \fB-unixpw\fR (but not \fB-unixpw_nis),\fR then the ...@@ -740,34 +740,38 @@ In the case of \fB-unixpw\fR (but not \fB-unixpw_nis),\fR then the
above command is run as the user who just authenticated above command is run as the user who just authenticated
via the login and password prompt. via the login and password prompt.
.IP .IP
Also in the case of \fB-unixpw,\fR the user logging in Also in the case of \fB-unixpw,\fR the user logging in can
can place a colon at the end of his username and place a colon at the end of his username and supply
supply a few options: scale=, scale_cursor= (or sc=), a few options: scale=, scale_cursor= (or sc=), solid
solid (or so), id=, clear_mods (or cm), clear_keys (or so), id=, clear_mods (or cm), clear_keys (or ck),
(or ck), repeat, speeds= (or sp=), readtimeout= repeat, speeds= (or sp=), readtimeout= (or rd=), or
(or rd=), or rotate= (or ro=) separated by commas if there is more than one. rotate= (or ro=) separated by commas if there is more
After the user logs in successfully, these options will than one. After the user logs in successfully, these
be applied to the VNC screen. For example, options will be applied to the VNC screen. For example,
.IP .IP
login: fred:scale=3/4,sc=1,repeat login: fred:scale=3/4,sc=1,repeat
Password: ... Password: ...
.IP .IP
login: runge:sp=modem,rd=120,solid=root: login: runge:sp=modem,rd=120,solid
.IP .IP
for convenience m/n implies scale= e.g. fred:3/4 for convenience m/n implies scale= e.g. fred:3/4 If you
To disable this set the environment variable type and enter your password incorrectly, to retrieve
X11VNC_NO_UNIXPW_OPTS=1. To set any other options, your long "login:" line press the Up arrow once
the user can use the gui (x11vnc \fB-gui\fR connect) or the (before typing anything else).
remote control method (x11vnc \fB-R\fR opt:val) during his
VNC session.
.IP .IP
So the combination of \fB-display\fR WAIT:cmd=... and To disable the option setting set the environment
\fB-unixpw\fR allows automatic pairing of an unix variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.
authenticated VNC user with his desktop. This could To set any other options, the user can use the gui
be very useful on SunRays and also any system where (x11vnc \fB-gui\fR connect) or the remote control method
multiple users share a given machine. The user does (x11vnc \fB-R\fR opt:val) during his VNC session.
not need to remember special ports or passwords set up .IP
for his desktop and VNC. The combination of \fB-display\fR WAIT:cmd=... and \fB-unixpw\fR
allows automatic pairing of an unix authenticated VNC
user with his desktop. This could be very useful on
SunRays and also any system where multiple users share
a given machine. The user does not need to remember
special ports or passwords set up for his desktop
and VNC.
.IP .IP
A nice way to use WAIT:cmd=... is out of A nice way to use WAIT:cmd=... is out of
.IR inetd (8) .IR inetd (8)
...@@ -1340,7 +1344,7 @@ adds a few seconds delay to each connection and can be ...@@ -1340,7 +1344,7 @@ adds a few seconds delay to each connection and can be
unreliable (especially if the user takes much time to unreliable (especially if the user takes much time to
ponder the Certificate dialogs in his browser, Java VM, ponder the Certificate dialogs in his browser, Java VM,
or VNC Viewer applet. That's right 3 separate "Are or VNC Viewer applet. That's right 3 separate "Are
you sure you want to connect" dialogs!) you sure you want to connect?" dialogs!)
.IP .IP
So use the \fB-https\fR option to provide a separate, more So use the \fB-https\fR option to provide a separate, more
reliable HTTPS port that x11vnc will listen on. If reliable HTTPS port that x11vnc will listen on. If
...@@ -3182,6 +3186,16 @@ in 1 jump), This correction seems to be needed but can ...@@ -3182,6 +3186,16 @@ in 1 jump), This correction seems to be needed but can
cause jerkiness or unexpected behavior with menus, etc. cause jerkiness or unexpected behavior with menus, etc.
Use reset=0 to disable. Use reset=0 to disable.
.IP .IP
If the uinput device has an absolute pointer (as opposed
to a normal mouse that is a relative pointer) you can
specify the option "abs". Note that a touchpad
on a laptop is an absolute device t some degree.
This (usually) avoids all the problems with mouse
acceleration. If x11vnc has trouble deducing the size
of the device, use "abs=WxH". Furthermore, if the
device is a touchscreen (assumed to have an absolute
pointer) use "touch" or "touch=WxH".
.IP
If you set the env. var X11VNC_UINPUT_THRESHOLDS then If you set the env. var X11VNC_UINPUT_THRESHOLDS then
the thresh=n mode will be enabled. It it currently the thresh=n mode will be enabled. It it currently
not working well. If |dx| <= thresh and |dy| < thresh not working well. If |dx| <= thresh and |dy| < thresh
......
...@@ -3234,14 +3234,18 @@ int main(int argc, char* argv[]) { ...@@ -3234,14 +3234,18 @@ int main(int argc, char* argv[]) {
rfb_desktop_name = strdup(argv_vnc[argc_vnc-1]); rfb_desktop_name = strdup(argv_vnc[argc_vnc-1]);
} }
initialize_pipeinput();
/* /*
* Create the XImage corresponding to the display framebuffer. * Create the XImage corresponding to the display framebuffer.
*/ */
fb0 = initialize_xdisplay_fb(); fb0 = initialize_xdisplay_fb();
/*
* In some cases (UINPUT touchscreens) we need the dpy_x dpy_y
* to initialize pipeinput. So we do it after fb is created.
*/
initialize_pipeinput();
/* /*
* n.b. we do not have to X_LOCK any X11 calls until watch_loop() * n.b. we do not have to X_LOCK any X11 calls until watch_loop()
* is called since we are single-threaded until then. * is called since we are single-threaded until then.
......
...@@ -345,6 +345,7 @@ extern Visual *default_visual; /* the default visual (unless -visual) */ ...@@ -345,6 +345,7 @@ extern Visual *default_visual; /* the default visual (unless -visual) */
extern int bpp, depth; extern int bpp, depth;
extern int indexed_color; extern int indexed_color;
extern int dpy_x, dpy_y; /* size of display */ extern int dpy_x, dpy_y; /* size of display */
extern int fb_x, fb_y, fb_b; /* fb size and bpp guesses at display */
extern int off_x, off_y; /* offsets for -sid */ extern int off_x, off_y; /* offsets for -sid */
extern int wdpy_x, wdpy_y; /* for actual sizes in case of -clip */ extern int wdpy_x, wdpy_y; /* for actual sizes in case of -clip */
extern int cdpy_x, cdpy_y, coff_x, coff_y; /* the -clip params */ extern int cdpy_x, cdpy_y, coff_x, coff_y; /* the -clip params */
......
...@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; ...@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.8.3 lastmod: 2006-08-02"; char lastmod[] = "0.8.3 lastmod: 2006-08-10";
/* X display info */ /* X display info */
...@@ -27,7 +27,8 @@ Window window = None, rootwin = None; /* polled window, root window (usu. same) ...@@ -27,7 +27,8 @@ Window window = None, rootwin = None; /* polled window, root window (usu. same)
Visual *default_visual = NULL; /* the default visual (unless -visual) */ Visual *default_visual = NULL; /* the default visual (unless -visual) */
int bpp = 0, depth = 0; int bpp = 0, depth = 0;
int indexed_color = 0; int indexed_color = 0;
int dpy_x, dpy_y; /* size of display */ int dpy_x = 0, dpy_y = 0; /* size of display */
int fb_x = 0, fb_y = 0, fb_b = 0; /* fb size and bpp guesses at display */
int off_x, off_y; /* offsets for -sid */ int off_x, off_y; /* offsets for -sid */
int wdpy_x, wdpy_y; /* for actual sizes in case of -clip */ int wdpy_x, wdpy_y; /* for actual sizes in case of -clip */
int cdpy_x, cdpy_y, coff_x, coff_y; /* the -clip params */ int cdpy_x, cdpy_y, coff_x, coff_y; /* the -clip params */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment