diff options
author | runge <runge> | 2006-05-07 00:50:13 +0000 |
---|---|---|
committer | runge <runge> | 2006-05-07 00:50:13 +0000 |
commit | 279f35495a122c9892198545f83e03c6fc50fa08 (patch) | |
tree | 7ce00691a9f77432cead7a5f4ae702fc62878019 /x11vnc | |
parent | 0d734ad8967eafab1fb058280a0db04e7470e569 (diff) | |
download | libtdevnc-279f35495a122c9892198545f83e03c6fc50fa08.tar.gz libtdevnc-279f35495a122c9892198545f83e03c6fc50fa08.zip |
x11vnc: support for video4linux webcams & tv-tuners, -24to32 bpp option, -rawfb console.
Diffstat (limited to 'x11vnc')
44 files changed, 4962 insertions, 1359 deletions
diff --git a/x11vnc/8to24.c b/x11vnc/8to24.c index 01d9316..5304a52 100644 --- a/x11vnc/8to24.c +++ b/x11vnc/8to24.c @@ -70,6 +70,8 @@ static void set_root_cmap(void) { static XColor color[NCOLOR]; int redo = 0; + RAWFB_RET_VOID + if (now > last_set + 10) { redo = 1; } @@ -134,6 +136,8 @@ static int check_pointer_in_depth24(void) { c = window; + RAWFB_RET(0) + if (now > last_keyboard_time + 1.0 && now > last_pointer_time + 1.0) { return 0; } @@ -251,6 +255,8 @@ void check_for_multivis(void) { double now = dnow(); double delay; + RAWFB_RET_VOID + if (now > last_parse + 1.0) { last_parse = now; parse_cmap8to24(); @@ -743,6 +749,7 @@ if (db24 > 1) fprintf(stderr, " ------------ 0x%lx i=%d\n", windows_8bp } static XImage *p_xi(XImage *xi, Visual *visual, int win_depth, int *w) { + RAWFB_RET(NULL) if (xi == NULL || *w < dpy_x) { char *d; if (xi) { @@ -782,6 +789,8 @@ static int poll_line(int x1, int x2, int y1, int n, sraRegionPtr mod) { int mx1, mx2, my1, my2; int ns = NSCAN/2; + RAWFB_RET(1) + if (win == None) { return 1; } @@ -1269,6 +1278,8 @@ static int get_cmap(int j, Colormap cmap) { int i, ncells; XErrorHandler old_handler = NULL; + RAWFB_RET(0) + if (0) { /* not working properly for depth 24... */ X_LOCK; @@ -1401,7 +1412,7 @@ static XImage *cmap_xi(XImage *xi, Window win, int win_depth) { if (xi) { XDestroyImage(xi); } - if (! valid_window(win, &attr, 1)) { + if (! dpy || ! valid_window(win, &attr, 1)) { return (XImage *) NULL; } if (attr.depth != win_depth) { @@ -1434,6 +1445,8 @@ static void transform_rect(sraRect rect, Window win, int win_depth, int cm) { if (db24 > 1) fprintf(stderr, "transform %4d %4d %4d %4d cm: %d\n", rect.x1, rect.y1, rect.x2, rect.y2, cm); + RAWFB_RET_VOID + /* now transform the pixels in this rectangle: */ n_off = main_bytes_per_line * rect.y1 + pixelsize * rect.x1; @@ -1653,6 +1666,8 @@ void bpp8to24(int x1, int y1, int x2, int y2) { double now; double dt, d0 = 0.0, t2; + RAWFB_RET_VOID + if (! cmap8to24 || ! cmap8to24_fb) { /* hmmm, why were we called? */ return; @@ -1877,6 +1892,8 @@ void mark_8bpp(int mode) { int i, cnt = 0; Window top = None; + RAWFB_RET_VOID + if (! cmap8to24 || !cmap8to24_fb) { return; } diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index 106dae0..4206d3f 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -1,3 +1,11 @@ +2006-05-06 Karl Runge <runge@karlrunge.com> + * x11vnc: improved support for webcams and tv tuners with + video4linux /dev/video: -rawfb video, -freqtab etc. + Convenience option for linux VT's: -rawfb cons (LinuxVNC + method). -pipeinput builtins for video and console. + -24to32 option to avoid 24bpp problems. "snap:" method for + -rawfb. + 2006-04-26 Karl Runge <runge@karlrunge.com> * x11vnc: skip exit in check_openssl() if not compiled with libssl. set SKIP_HELP (again) in small footprint builds. diff --git a/x11vnc/Makefile.am b/x11vnc/Makefile.am index 4c6f3ef..0362a43 100644 --- a/x11vnc/Makefile.am +++ b/x11vnc/Makefile.am @@ -13,7 +13,7 @@ endif if HAVE_X bin_PROGRAMS=x11vnc -x11vnc_SOURCES = 8to24.c cleanup.c connections.c cursor.c gui.c help.c inet.c keyboard.c options.c pm.c pointer.c rates.c remote.c scan.c screen.c selection.c solid.c sslcmds.c sslhelper.c unixpw.c user.c userinput.c util.c win_utils.c x11vnc.c x11vnc_defs.c xdamage.c xevents.c xinerama.c xkb_bell.c xrandr.c xrecord.c xwrappers.c 8to24.h allowed_input_t.h blackout_t.h cleanup.h connections.h cursor.h enums.h gui.h help.h inet.h keyboard.h options.h params.h pm.h pointer.h rates.h remote.h scan.h screen.h scrollevent_t.h selection.h solid.h sslcmds.h sslhelper.h ssltools.h tkx11vnc.h unixpw.h user.h userinput.h util.h win_utils.h winattr_t.h x11vnc.h xdamage.h xevents.h xinerama.h xkb_bell.h xrandr.h xrecord.h xwrappers.h +x11vnc_SOURCES = 8to24.c cleanup.c connections.c cursor.c gui.c help.c inet.c keyboard.c linuxfb.c options.c pm.c pointer.c rates.c remote.c scan.c screen.c selection.c solid.c sslcmds.c sslhelper.c unixpw.c user.c userinput.c util.c v4l.c win_utils.c x11vnc.c x11vnc_defs.c xdamage.c xevents.c xinerama.c xkb_bell.c xrandr.c xrecord.c xwrappers.c 8to24.h allowed_input_t.h blackout_t.h cleanup.h connections.h cursor.h enums.h gui.h help.h inet.h keyboard.h linuxfb.h options.h params.h pm.h pointer.h rates.h remote.h scan.h screen.h scrollevent_t.h selection.h solid.h sslcmds.h sslhelper.h ssltools.h tkx11vnc.h unixpw.h user.h userinput.h util.h v4l.h win_utils.h winattr_t.h x11vnc.h xdamage.h xevents.h xinerama.h xkb_bell.h xrandr.h xrecord.h xwrappers.h INCLUDES=@X_CFLAGS@ x11vnc_LDADD=$(LDADD) @X_LIBS@ $(LD_CYGIPC) endif diff --git a/x11vnc/README b/x11vnc/README index 5b53611..a8a3e1f 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Wed Apr 26 11:25:58 EDT 2006 +x11vnc README file Date: Sat May 6 20:35:41 EDT 2006 The following information is taken from these URLs: @@ -23,7 +23,8 @@ x11vnc: a VNC server for real X displays x11vnc allows one to remotely view and interact with real X displays (i.e. a display corresponding to a physical monitor, keyboard, and mouse) with any VNC viewer. In this way it plays the role for Unix/X11 - that WinVNC plays for Windows. + that WinVNC plays for Windows. It has also been extended to work with + [7]webcams and tv tuner capture devices. I wrote x11vnc because x0rfbserver was basically impossible to build on Solaris and had poor performance. The primary x0rfbserver build @@ -32,8 +33,8 @@ x11vnc: a VNC server for real X displays enhancements to improve the interactive response, add esoteric features, etc. - This page and the [7]FAQ contain a lot of information [8][*] and - solutions to many problems, but please feel free to [9]contact me if + This page and the [8]FAQ contain a lot of information [9][*] and + solutions to many problems, but please feel free to [10]contact me if you have problems or questions. Background: @@ -45,10 +46,10 @@ x11vnc: a VNC server for real X displays framebuffer (RFB) protocol Some VNC links: - * [10]http://www.realvnc.com - * [11]http://www.tightvnc.com - * [12]http://www.ultravnc.com/ - * [13]http://www.redstonesoftware.com/ + * [11]http://www.realvnc.com + * [12]http://www.tightvnc.com + * [13]http://www.ultravnc.com/ + * [14]http://www.redstonesoftware.com/ For Unix, the traditional VNC implementation includes a virtual X11 server Xvnc (usually launched via the vncserver command) that is not @@ -86,9 +87,9 @@ x11vnc: a VNC server for real X displays display you wish to view is "far-away.east:0" and the workstation you are presently working at is "sitting-here.west". - Step 0. Download x11vnc ([14]see below) and have it available to run + Step 0. Download x11vnc ([15]see below) and have it available to run on far-away.east. Similarly, have a VNC viewer (e.g. vncviewer) ready - to run on sitting-here.west. We recommend [15]TightVNC Viewers. + to run on sitting-here.west. We recommend [16]TightVNC Viewers. Step 1. By some means log in to far-away.east and get a command shell running there. You can use ssh, rlogin, telnet, or any other method to @@ -107,11 +108,11 @@ x11vnc: a VNC server for real X displays display (i.e. no viewer clients yet). Common Gotcha: To get X11 permissions right, you may also need to set - the XAUTHORITY environment variable (or use the [16]-auth option) to + the XAUTHORITY environment variable (or use the [17]-auth option) to point to the correct MIT-MAGIC-COOKIE file (e.g. /home/joe/.Xauthority). If x11vnc does not have the authority to connect to the display it exits immediately. More on how to fix this - [17]below. + [18]below. If you suspect an X11 permissions problem do this simple test: while sitting at the physical X display open a terminal window @@ -119,7 +120,7 @@ x11vnc: a VNC server for real X displays successfully in that terminal without any need for command line options. If that works OK then you know X11 permissions are the only thing preventing it from working when you try to start x11vnc via a - remote shell. Then fix this with the tips [18]below. + remote shell. Then fix this with the tips [19]below. When x11vnc starts up there will then be much chatter printed out, until it finally says something like: @@ -138,8 +139,8 @@ x11vnc: a VNC server for real X displays viewers for Unix, Windows, MacOS, Java-enabled web browsers, and even for PDA's like the Palm Pilot! You can use any of them to connect to x11vnc (see the above VNC links under "Background:" on how to obtain a - viewer for your platform or see [19]this FAQ. For Solaris, vncviewer - is available in the [20]Companion CD package SFWvnc). + viewer for your platform or see [20]this FAQ. For Solaris, vncviewer + is available in the [21]Companion CD package SFWvnc). In this example we'll use the Unix vncviewer program on sitting-here by typing the following command in a second terminal window: @@ -149,13 +150,13 @@ x11vnc: a VNC server for real X displays That should pop up a viewer window on sitting-here.west showing and allowing interaction with the far-away.east:0 X11 desktop. Pretty nifty! When finished, exit the viewer: the remote x11vnc process will - shutdown automatically (or you can use the [21]-forever option to have + shutdown automatically (or you can use the [22]-forever option to have it wait for additional viewer connections). Shortcut: Of course if you left x11vnc running on far-away.east:0 in a - terminal window with the [22]-forever option or as a [23]service, + terminal window with the [23]-forever option or as a [24]service, you'd only have to do Step 3 as you moved around. Be sure to use a VNC - [24]Password or [25]other measures if you do that. + [25]Password or [26]other measures if you do that. Desktop Sharing: The above more or less assumed nobody was sitting at @@ -171,7 +172,7 @@ x11vnc: a VNC server for real X displays For these cases it should be obvious how it is done. The above steps will work, but more easily the user sitting at far-away.east:0 simply starts up x11vnc from a terminal window, after which the guests would - start their VNC viewers. For this usage mode the "[26]-connect + start their VNC viewers. For this usage mode the "[27]-connect host1,host2" option may be of use automatically connect to vncviewers in "-listen" mode on the list of hosts. _________________________________________________________________ @@ -200,13 +201,13 @@ splay :0' Note that "x11vnc -localhost ..." limits incoming vncviewer connections to only those from the same machine. This is very natural for ssh tunnelling (the redirection appears to come from the same - machine). Use of a [27]VNC password is also strongly recommended. + machine). Use of a [28]VNC password is also strongly recommended. Some VNC viewers will do the ssh tunnelling for you automatically, the TightVNC vncviewer does this when the "-via far-away.east" option is supplied to it (this requires x11vnc to be already running on - far-away.east or having it started by [28]inetd(1)). See the 3rd - script example [29]below for more info. + far-away.east or having it started by [29]inetd(1)). See the 3rd + script example [30]below for more info. If the machine you SSH into is not the same machine with the X display you wish to view (e.g. your company provides incoming SSH access to a @@ -215,7 +216,7 @@ splay :0' (ssh, rsh, etc.) to the workstation machine 'otherhost' and then start up x11vnc on it (if it isn't already running). For an automatic way to use a gateway and have all the network traffic encrypted (including - inside the firewall) see [30]chaining ssh's + inside the firewall) see [31]chaining ssh's _________________________________________________________________ @@ -224,7 +225,7 @@ splay :0' above port and display numbers may change a bit (e.g. -> 5901 and :1). However, if you "know" port 5900 will be free on the local and remote machines, you can easily automate the above two steps by using the - x11vnc option [31]-bg (forks into background after connection to the + x11vnc option [32]-bg (forks into background after connection to the display is set up) or using the -f option of ssh. Some example scripts are shown below. _________________________________________________________________ @@ -255,7 +256,7 @@ done #2. Another method is to start the VNC viewer in listen mode "vncviewer -listen" and have x11vnc initiate a reverse connection - using the [32]-connect option: + using the [33]-connect option: #!/bin/sh # usage: x11vnc_ssh <host>:<xdisplay> # e.g.: x11vnc_ssh snoopy.peanuts.com:0 @@ -297,7 +298,7 @@ export VNC_VIA_CMD vncviewer -via $host localhost:0 # must be TightVNC vncviewer. Of course if you already have the x11vnc running waiting for - connections (or have it started out of [33]inetd(1)), you can simply + connections (or have it started out of [34]inetd(1)), you can simply use the TightVNC "vncviewer -via gateway host:port" in its default mode to provide secure ssh tunnelling. _________________________________________________________________ @@ -305,11 +306,11 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. VNC password file: Also note in the #1. example script that the - [34]option "-rfbauth .vnc/passwd" provides additional protection by + [35]option "-rfbauth .vnc/passwd" provides additional protection by requiring a VNC password for every VNC viewer that connects. The - vncpasswd or storepasswd programs, or the x11vnc [35]-storepasswd + vncpasswd or storepasswd programs, or the x11vnc [36]-storepasswd option can be used to create the password file. x11vnc also has the - slightly less secure [36]-passwdfile and "-passwd XXXXX" [37]options + slightly less secure [37]-passwdfile and "-passwd XXXXX" [38]options to specify passwords. Very Important: It is up to YOU to tell x11vnc to use password @@ -317,47 +318,47 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. automatically or force you to. The same goes for encrypting the channel between the viewer and x11vnc: it is up to you to use ssh, stunnel, -ssl mode, a VPN, etc. For additional safety, also look into - the -allow and -localhost [38]options and building x11vnc with - [39]tcp_wrappers support to limit host access. + the -allow and -localhost [39]options and building x11vnc with + [40]tcp_wrappers support to limit host access. _________________________________________________________________ Tunnelling x11vnc via SSL: One can also encrypt the VNC traffic using an SSL tunnel such as - [40]stunnel or using the built-in (Mar/2006) [41]-ssl openssl mode. A + [41]stunnel or using the built-in (Mar/2006) [42]-ssl openssl mode. A SSL-enabled Java applet VNC Viewer is also provided (and https can be used to download it). Although not as ubiquitous as ssh, SSL tunnelling still provides a - useful alternative. See [42]this FAQ on -ssl and -stunnel modes for + useful alternative. See [43]this FAQ on -ssl and -stunnel modes for details and examples. _________________________________________________________________ Downloading x11vnc: - x11vnc is a contributed program to the [43]LibVNCServer project at + x11vnc is a contributed program to the [44]LibVNCServer project at SourceForge.net. I use libvncserver for all of the VNC aspects; I couldn't have done without it. The full source code may be found and downloaded (either file-release tarball or CVS tree) from the above - link. As of Feb 2006, the [44]x11vnc-0.8.tar.gz source package is - released (recommended download). The [45]x11vnc 0.8 release notes. + link. As of Feb 2006, the [45]x11vnc-0.8.tar.gz source package is + released (recommended download). The [46]x11vnc 0.8 release notes. The x11vnc package is the subset of the libvncserver package needed to build the x11vnc program. Also, you can get a copy of my latest, - bleeding edge [46]x11vnc-0.8.1.tar.gz tarball to build the most up to + bleeding edge [47]x11vnc-0.8.1.tar.gz tarball to build the most up to date one. - Precompiled Binaries/Packages: See the [47]FAQ below for information + Precompiled Binaries/Packages: See the [48]FAQ below for information about where you might obtain a precompiled x11vnc binary from 3rd parties and some ones I create. To obtain VNC viewers for the viewing side (Windows, Mac OS, or Unix) try these links: - * [48]http://www.tightvnc.com/download.html - * [49]http://www.realvnc.com/download-free.html - * [50]http://sourceforge.net/projects/cotvnc/ - * [51]http://www.ultravnc.com/ + * [49]http://www.tightvnc.com/download.html + * [50]http://www.realvnc.com/download-free.html + * [51]http://sourceforge.net/projects/cotvnc/ + * [52]http://www.ultravnc.com/ More tools: Here is a rsh/ssh wrapper script rx11vnc that attempts to @@ -368,8 +369,8 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. rx11vnc.pl that attempts to tunnel the vnc traffic through an ssh port redirection (and does not assume port 5900 is free). Have a look at them to see what they do and customize as needed: - * [52]rx11vnc wrapper script - * [53]rx11vnc.pl wrapper script to tunnel traffic thru ssh + * [53]rx11vnc wrapper script + * [54]rx11vnc.pl wrapper script to tunnel traffic thru ssh _________________________________________________________________ @@ -400,8 +401,8 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. Note: Currently gcc is required to build libvncserver. In some cases it will build with non-gcc compilers, but the resulting binary sometimes fails to run properly. For Solaris pre-built gcc binaries - are at [54]http://www.sunfreeware.com/. Some Solaris pre-built x11vnc - binaries are [55]here. + are at [55]http://www.sunfreeware.com/. Some Solaris pre-built x11vnc + binaries are [56]here. However, one user reports it does work fine when built with Sun Studio 10, so YMMV. In fact, here is a little build script to do this on @@ -421,10 +422,10 @@ export MAKE AM_CFLAGS $MAKE In general you can use the "make -e" trick if you don't like - libvncserver's choice of AM_CFLAGS. See the [56]build scripts below + libvncserver's choice of AM_CFLAGS. See the [57]build scripts below for more ideas. - You can find information on [57]Misc. Build problems here. + You can find information on [58]Misc. Build problems here. _________________________________________________________________ @@ -462,9 +463,9 @@ r/sfw; make' If your system does not have these libraries at all you can get the source for the libraries to build them: libjpeg is available at - [58]ftp://ftp.uu.net/graphics/jpeg/ and zlib at - [59]http://www.gzip.org/zlib/. See also - [60]http://www.sunfreeware.com/ for Solaris binary packages of these + [59]ftp://ftp.uu.net/graphics/jpeg/ and zlib at + [60]http://www.gzip.org/zlib/. See also + [61]http://www.sunfreeware.com/ for Solaris binary packages of these libraries as well as for gcc. Normally they will install into /usr/local but you can install them anywhere with the --prefix=/path/to/anywhere, etc. @@ -535,7 +536,7 @@ ls -l ./x11vnc/x11vnc script. If you need to build on Solaris 2.5.1 or earlier or other older Unix - OS's, see [61]this workaround FAQ. + OS's, see [62]this workaround FAQ. Building on FreeBSD, OpenBSD, ...: The jpeg libraries seem to be in @@ -576,64 +577,77 @@ make Spring 2006. The version 0.8.1 beta tarball is kept here: - [62]x11vnc-0.8.1.tar.gz + [63]x11vnc-0.8.1.tar.gz There are also some Linux, Solaris, and other OS test binaries - [63]here. Please kick the tires and report bugs, performance - regressions, undesired behavior, etc. to [64]me. + [64]here. Please kick the tires and report bugs, performance + regressions, undesired behavior, etc. to [65]me. Here are some features that will appear in the 0.8.1 release: - * The [65]-unixpw option supports Unix username and password - authentication (a variant is the [66]-unixpw_nis option that works - in NIS environments). The [67]-ssl or [68]-localhost + - [69]-stunnel options are enforced in this mode to prevent password + * The [66]-unixpw option supports Unix username and password + authentication (a variant is the [67]-unixpw_nis option that works + in NIS environments). The [68]-ssl or [69]-localhost + + [70]-stunnel options are enforced in this mode to prevent password sniffing. As a convenience, the -ssl or -stunnel requirements are lifted if a SSH tunnel can be deduced (but -localhost still applies). - * The [70]-ssl option provides SSL encryption and authentication - natively via the [71]www.openssl.org library. One can use from a + * The [71]-ssl option provides SSL encryption and authentication + natively via the [72]www.openssl.org library. One can use from a simple self-signed certificate server certificate up to full CA and client certificate authentication schemes. - * The [72]-stunnel option starts up a SSL tunnel server stunnel + * The [73]-stunnel option starts up a SSL tunnel server stunnel (that must be installed separately on the system: - [73]www.stunnel.org) to allow only encrypted SSL connections from + [74]www.stunnel.org) to allow only encrypted SSL connections from the network. - * The [74]-sslverify option allows for authenticating VNC clients + * The [75]-sslverify option allows for authenticating VNC clients via their certificates in either -ssl or -stunnel modes. * An SSL enabled Java applet VNC Viewer applet is provided in classes/ssl/VncViewer.jar. It may also be loaded into the web browser via https (http over SSL) in addition to http. (via the - VNC port or also by the separate [75]-https port option). - * The [76]-usepw option will try to use your existing ~/.vnc/passwd + VNC port or also by the separate [76]-https port option). A + wrapper shell script [77]ssl_vncviewer is also provided that sets + up a stunnel client-side tunnel on Unix systems. + * The [78]-usepw option will try to use your existing ~/.vnc/passwd or ~/.vnc/passwfile passwords or otherwise prompt you to create one (the server exits unless a password file is found and used). + * Improved support for Webcams and TV tuner devices (/dev/video) + with the [79]-rawfb option. E.g. "-rawfb video0" will autodetect + the video WxHxB (requires Video4Linux buildtime or the v4l-info + utility). Use "-rawfb video -pipeinput VID" for a simple keystroke + utility to configure the capture device. + * Convenience utility [80]-rawfb cons to connect to the linux + console (/dev/fb0) and inject keystrokes into it (/dev/ttyX). Like + LinuxVNC or -pipeinput vcinject.pl, but now built in. + * The [81]-24to32 option provides automatic translation from 24bpp + to 32bpp framebuffers to avoid problems with viewers, etc (often + needed for webcams). * The X CLIPBOARD selection is now managed in addition to PRIMARY. - Use [77]-noclipboard and [78]-nosetclipboard for the previous + Use [82]-noclipboard and [83]-nosetclipboard for the previous PRIMARY-only behavior. - * The [79]-xinerama option is now on by default. Use -noxinerama + * The [84]-xinerama option is now on by default. Use -noxinerama option to disable. Here are the release notes for the recent 0.8 release: * TightVNC file transfer added to libvncserver by Rohit Kumar is - enabled (use [80]-nofilexfer to disable). - * The [81]-passwdfile option has been enhanced to handle any number + enabled (use [85]-nofilexfer to disable). + * The [86]-passwdfile option has been enhanced to handle any number of full-access and view only passwords in an easy to maintain format. Automatic rereading or file removal can be enabled. - * The [82]-8to24 option enables some multi-depth viewing on systems - that don't support [83]-overlay. The 8bpp regions are transformed + * The [87]-8to24 option enables some multi-depth viewing on systems + that don't support [88]-overlay. The 8bpp regions are transformed to depth 24 TrueColor. - * The [84]-loop option will run x11vnc in an outer loop restarting + * The [89]-loop option will run x11vnc in an outer loop restarting each time (useful for situations where the X server restarts often). - * The [85]-afteraccept option is like [86]-accept however it enables + * The [90]-afteraccept option is like [91]-accept however it enables running a user supplied command after client authentication has taken place. The RFB_* environment variables have been extended. - * The [87]-slow_fb allows for slow polling for special purpose + * The [92]-slow_fb allows for slow polling for special purpose applications (e.g. video). - * [88]-blackout noptr,WxH+X+Y,... will prevent the pointer from + * [93]-blackout noptr,WxH+X+Y,... will prevent the pointer from going into a blacked out region. * The x11vnc source code has gone through a major reorganization. The build has been enhanced and many bugs fixed. @@ -641,10 +655,10 @@ make Here are some notes about features added in 0.7.2. Checking/Testing them is still useful and appreciated! - Note that the [89]X DAMAGE feature will be on by default and so I + Note that the [94]X DAMAGE feature will be on by default and so I am interested if that causes any problems. I'd also like to have - the new [90]wireframe move/resize, the [91]wireframe copyrect - translation, and the [92]scroll detection+copyrect features all on + the new [95]wireframe move/resize, the [96]wireframe copyrect + translation, and the [97]scroll detection+copyrect features all on by default as well since when they work they give a great speedup! (CopyRect is a VNC encoding and is very fast because the viewer already has the image data that needs to be copied: e.g. it just @@ -679,11 +693,11 @@ make protocol.) I suggest using xsetroot, dtstyle or similar utility to set a solid background while using x11vnc. You can turn the pretty background image back on when you are using the display directly. - Update: As of Feb/2005 x11vnc has the [93]-solid [color] option that + Update: As of Feb/2005 x11vnc has the [98]-solid [color] option that works on recent GNOME, KDE, and CDE and also on classic X (background image is on the root window). - I also find the [94]TightVNC encoding gives the best response for my + I also find the [99]TightVNC encoding gives the best response for my usage (Unix <-> Unix over cable modem). One needs a tightvnc-aware vncviewer to take advantage of this encoding. @@ -695,16 +709,16 @@ make is X11's default listening port). Had port 5900 been taken by some other application, x11vnc would have next tried 5901. That would mean the viewer command above should be changed to vncviewer - far-away.east:1. You can force the port with the "[95]-rfbport NNNN" + far-away.east:1. You can force the port with the "[100]-rfbport NNNN" option where NNNN is the desired port number. If that port is already taken, x11vnc will exit immediately. (also see the "SunRay Gotcha" note below) Options: x11vnc has (far too) many features that may be activated - via its [96]command line options. Useful options are, e.g., -scale to + via its [101]command line options. Useful options are, e.g., -scale to do server-side scaling, and -rfbauth passwd-file to use VNC password protection (the vncpasswd or storepasswd programs, or the x11vnc - [97]-storepasswd option can be used to create the password file). + [102]-storepasswd option can be used to create the password file). Algorithm: How does x11vnc do it? Rather brute-forcedly: it continuously polls the X11 framebuffer for changes using @@ -731,17 +745,18 @@ make first testing out the programs. You get an interesting recursive/feedback effect where vncviewer images keep popping up each one contained in the previous one and slightly shifted a bit by the - window manager decorations. There will be an [98]even more interesting - effect if -scale is used. Also, if the XKEYBOARD is supported and the - XBell "beeps" once, you get an infinite loop of beeps going off. - Although all of this is mildly exciting it is not much use: you will - normally run and display the viewer on a different machine! + window manager decorations. There will be an [103]even more + interesting effect if -scale is used. Also, if the XKEYBOARD is + supported and the XBell "beeps" once, you get an infinite loop of + beeps going off. Although all of this is mildly exciting it is not + much use: you will normally run and display the viewer on a different + machine! _________________________________________________________________ Sun Ray Notes: - You can run x11vnc on your (connected or disconnected) [99]SunRay - session. Here are some [100]notes on SunRay usage with x11vnc. + You can run x11vnc on your (connected or disconnected) [104]SunRay + session. Here are some [105]notes on SunRay usage with x11vnc. _________________________________________________________________ @@ -753,7 +768,7 @@ make than you normally do to minimize the effects (e.g. do fullpage paging rather than line-by-line scrolling, and move windows in a single, quick motion). Recent work has provided the - [101]-scrollcopyrect and [102]-wireframe speedups using the + [106]-scrollcopyrect and [107]-wireframe speedups using the CopyRect VNC encoding and other things, but they only speed up certain activities, not all. * A rate limiting factor for x11vnc performance is that video @@ -800,14 +815,14 @@ make be of use for special purpose applications. Also, a faster and more accurate way is to use the "dummy" XFree86/Xorg device driver (or our Xdummy wrapper script). See - [103]this FAQ for details. + [108]this FAQ for details. * Somewhat surprisingly, the X11 mouse (cursor) shape is write-only and cannot be queried from the X server. So traditionally in x11vnc the cursor shape stays fixed at an arrow. (see the "-cursor - X" and "-cursor some" [104]options, however, for a partial hack + X" and "-cursor some" [109]options, however, for a partial hack for the root window, etc.). However, on Solaris using the SUN_OVL overlay extension, x11vnc can show the correct mouse cursor when - the [105]-overlay option is also supplied. A similar thing is done + the [110]-overlay option is also supplied. A similar thing is done on IRIX as well when -overlay is supplied. More generally, as of Dec/2004 x11vnc supports the new XFIXES extension (in Xorg and Solaris 10) to query the X server for the @@ -819,16 +834,16 @@ make the X server supports the XKEYBOARD extension. (Note that on Solaris XKEYBOARD is disabled by default. Passing +kb to Xsun enables it). - * The scroll detection algorithm for the [106]-scrollcopyrect option + * The scroll detection algorithm for the [111]-scrollcopyrect option can give choppy or bunched up transient output and occasionally painting errors. * Occasionally a patch of tiles will not get updated correctly. Evidently a timing related bug and difficult to reproduce... * Using -threads can expose some bugs in libvncserver. - Please feel free to [107]contact me if you have any questions, + Please feel free to [112]contact me if you have any questions, problems, or comments about x11vnc, etc. - Also, some people ask if they can make a donation, see [108]this link + Also, some people ask if they can make a donation, see [113]this link for that. _________________________________________________________________ @@ -837,320 +852,320 @@ make [Building and Starting] - [109]Q-1: I can't get x11vnc to start up. It says "XOpenDisplay failed + [114]Q-1: I can't get x11vnc to start up. It says "XOpenDisplay failed (null)" or "Xlib: connection to ":0.0" refused by server Xlib: No protocol specified" and then exits. What do I need to do? - [110]Q-2: I can't get x11vnc and/or libvncserver to compile. + [115]Q-2: I can't get x11vnc and/or libvncserver to compile. - [111]Q-3: I just built x11vnc successfully, but when I use it my + [116]Q-3: I just built x11vnc successfully, but when I use it my keystrokes and mouse button clicks are ignored (I am able to move the mouse though). - [112]Q-4: Help, I need to run x11vnc on Solaris 2.5.1 (or other old + [117]Q-4: Help, I need to run x11vnc on Solaris 2.5.1 (or other old Unix/Linux) and it doesn't compile! - [113]Q-5: Where can I get a precompiled x11vnc binary for my Operating + [118]Q-5: Where can I get a precompiled x11vnc binary for my Operating System? - [114]Q-6: Where can I get a VNC Viewer binary (or source code) for the + [119]Q-6: Where can I get a VNC Viewer binary (or source code) for the Operating System I will be viewing from? - [115]Q-7: How can I see all of x11vnc's command line options and + [120]Q-7: How can I see all of x11vnc's command line options and documentation on how to use them? - [116]Q-8: I don't like typing arcane command line options every time I + [121]Q-8: I don't like typing arcane command line options every time I start x11vnc. What can I do? Is there a config file? Or a GUI? - [117]Q-9: How can I get the GUI to run in the System Tray, or at least + [122]Q-9: How can I get the GUI to run in the System Tray, or at least be a smaller, simpler icon? - [118]Q-10: Can I make x11vnc more quiet and also go into the + [123]Q-10: Can I make x11vnc more quiet and also go into the background after starting up? - [119]Q-11: Sometimes when a VNC viewer dies abruptly, x11vnc also dies + [124]Q-11: Sometimes when a VNC viewer dies abruptly, x11vnc also dies with the error message like: "Broken pipe". I'm using the -forever mode and I want x11vnc to keep running. - [120]Q-12: Are there any build-time customizations possible, e.g. + [125]Q-12: Are there any build-time customizations possible, e.g. change defaults, create a smaller binary, etc? [Win2VNC Related] - [121]Q-13: I have two separate machine displays in front of me, one + [126]Q-13: I have two separate machine displays in front of me, one Windows the other X11: can I use x11vnc in combination with Win2VNC in dual-screen mode to pass the keystrokes and mouse motions to the X11 display? - [122]Q-14: I am running Win2VNC on my Windows machine and "x11vnc + [127]Q-14: I am running Win2VNC on my Windows machine and "x11vnc -nofb" on Unix to pass keyboard and mouse to the Unix monitor. Whenever I start Win2VNC it quickly disconnects and x11vnc says: rfbProcessClientNormalMessage: read: Connection reset by peer [Color Issues] - [123]Q-15: The X display I run x11vnc on is only 8 bits per pixel + [128]Q-15: The X display I run x11vnc on is only 8 bits per pixel (bpp) PseudoColor (i.e. only 256 distinct colors). The x11vnc colors may start out OK, but after a while they are incorrect in certain windows. - [124]Q-16: Color problems: Why are the colors for some windows + [129]Q-16: Color problems: Why are the colors for some windows incorrect in x11vnc? BTW, my X display has nice overlay/multi-depth visuals of different color depths: e.g. there are both depth 8 and 24 visuals available at the same time. - [125]Q-17: How do I figure out the window id to supply to the -id + [130]Q-17: How do I figure out the window id to supply to the -id windowid option? - [126]Q-18: Why don't menus or other transient windows come up when I + [131]Q-18: Why don't menus or other transient windows come up when I am using the -id windowid option to view a single application window? - [127]Q-19: My X display is depth 24 at 24bpp (instead of the normal + [132]Q-19: My X display is depth 24 at 24bpp (instead of the normal depth 24 at 32bpp). I'm having lots of color and visual problems with x11vnc and/or vncviewer. What's up? [Xterminals] - [128]Q-20: Can I use x11vnc to view and interact with an Xterminal + [133]Q-20: Can I use x11vnc to view and interact with an Xterminal (e.g. NCD) that is not running UNIX and so x11vnc cannot be run on it directly? - [129]Q-21: How do I get my X permissions (MIT-MAGIC-COOKIE file) + [134]Q-21: How do I get my X permissions (MIT-MAGIC-COOKIE file) correct for a Unix/Linux machine acting as an Xterminal? [Sun Rays] - [130]Q-22: I'm having trouble using x11vnc with my Sun Ray session. + [135]Q-22: I'm having trouble using x11vnc with my Sun Ray session. [Remote Control] - [131]Q-23: How do I stop x11vnc once it is running in the background? + [136]Q-23: How do I stop x11vnc once it is running in the background? - [132]Q-24: Can I change settings in x11vnc without having to restart + [137]Q-24: Can I change settings in x11vnc without having to restart it? Can I remote control it? [Security and Permissions] - [133]Q-25: How do I create a VNC password for use with x11vnc? + [138]Q-25: How do I create a VNC password for use with x11vnc? - [134]Q-26: Can I make it so -storepasswd doesn't show my password on + [139]Q-26: Can I make it so -storepasswd doesn't show my password on the screen? - [135]Q-27: Can I have two passwords for VNC viewers, one for full + [140]Q-27: Can I have two passwords for VNC viewers, one for full access and the other for view-only access to the display? - [136]Q-28: Can I have as many full-access and view-only passwords as I + [141]Q-28: Can I have as many full-access and view-only passwords as I like? - [137]Q-29: Does x11vnc support Unix usernames and passwords? Can I + [142]Q-29: Does x11vnc support Unix usernames and passwords? Can I further limit the set of Unix usernames who can connect to the VNC desktop? - [138]Q-30: Why does x11vnc exit as soon as the VNC viewer disconnects? + [143]Q-30: Why does x11vnc exit as soon as the VNC viewer disconnects? And why doesn't it allow more than one VNC viewer to connect at the same time? - [139]Q-31: Can I limit which machines incoming VNC clients can connect + [144]Q-31: Can I limit which machines incoming VNC clients can connect from? - [140]Q-32: How do I build x11vnc/libvncserver with libwrap + [145]Q-32: How do I build x11vnc/libvncserver with libwrap (tcp_wrappers) support? - [141]Q-33: Can I have x11vnc only listen on one network interface + [146]Q-33: Can I have x11vnc only listen on one network interface (e.g. internal LAN) rather than having it listen on all network interfaces and relying on -allow to filter unwanted connections out? - [142]Q-34: Now that -localhost implies listening only on the loopback + [147]Q-34: Now that -localhost implies listening only on the loopback interface, how I can occasionally allow in a non-localhost via the -R allowonce remote control command? - [143]Q-35: Can I fine tune what types of user input are allowed? E.g. + [148]Q-35: Can I fine tune what types of user input are allowed? E.g. have some users just be able to move the mouse, but not click or type anything? - [144]Q-36: Can I prompt the user at the local X display whether the + [149]Q-36: Can I prompt the user at the local X display whether the incoming VNC client should be accepted or not? Can I decide to make some clients view-only? How about running an arbitrary program to make the decisions? - [145]Q-37: I start x11vnc as root because it is launched via inetd(1) + [150]Q-37: I start x11vnc as root because it is launched via inetd(1) or a display manager like gdm(1). Can I have x11vnc later switch to a different user? - [146]Q-38: I use a screen-lock when I leave my workstation (e.g. + [151]Q-38: I use a screen-lock when I leave my workstation (e.g. xscreensaver or xlock). When I remotely access my workstation desktop via x11vnc I can unlock the desktop fine, but I am worried people will see my activities on the physical monitor. What can I do to prevent this, or at least make it more difficult? - [147]Q-39: Can I have x11vnc automatically lock the screen when I + [152]Q-39: Can I have x11vnc automatically lock the screen when I disconnect the VNC viewer? [Encrypted Connections] - [148]Q-40: How can I tunnel my connection to x11vnc via an encrypted + [153]Q-40: How can I tunnel my connection to x11vnc via an encrypted SSH channel between two Unix machines? - [149]Q-41: How can I tunnel my connection to x11vnc via an encrypted + [154]Q-41: How can I tunnel my connection to x11vnc via an encrypted SSH channel from Windows using an SSH client like Putty? - [150]Q-42: How can I tunnel my connection to x11vnc via an encrypted + [155]Q-42: How can I tunnel my connection to x11vnc via an encrypted SSL channel using an external tool like stunnel? - [151]Q-43: Does x11vnc have built-in SSL tunneling? + [156]Q-43: Does x11vnc have built-in SSL tunneling? - [152]Q-44: How do I use VNC Viewers with built-in SSL tunneling? + [157]Q-44: How do I use VNC Viewers with built-in SSL tunneling? - [153]Q-45: How do I use VNC Viewers with built-in SSL tunneling when + [158]Q-45: How do I use VNC Viewers with built-in SSL tunneling when going through a Web Proxy? - [154]Q-46: Can Apache web server act as a gateway for users to connect + [159]Q-46: Can Apache web server act as a gateway for users to connect via SSL from the Internet with a Web browser to x11vnc running on their workstations behind a firewall? - [155]Q-47: Can I create and use my own SSL Certificate Authority (CA) + [160]Q-47: Can I create and use my own SSL Certificate Authority (CA) with x11vnc? [Display Managers and Services] - [156]Q-48: How can I run x11vnc as a "service" that is always + [161]Q-48: How can I run x11vnc as a "service" that is always available? - [157]Q-49: How can I use x11vnc to connect to an X login screen like + [162]Q-49: How can I use x11vnc to connect to an X login screen like xdm, GNOME gdm, KDE kdm, or CDE dtlogin? (i.e. nobody is logged into an X session yet). - [158]Q-50: Can I run x11vnc out of inetd(1)? How about xinetd(1)? + [163]Q-50: Can I run x11vnc out of inetd(1)? How about xinetd(1)? - [159]Q-51: Can I have x11vnc restart itself after it terminates? + [164]Q-51: Can I have x11vnc restart itself after it terminates? - [160]Q-52: How do I make x11vnc work with the Java VNC viewer applet + [165]Q-52: How do I make x11vnc work with the Java VNC viewer applet in a web browser? - [161]Q-53: Are reverse connections (i.e. the VNC server connecting to + [166]Q-53: Are reverse connections (i.e. the VNC server connecting to the VNC viewer) using "vncviewer -listen" and vncconnect(1) supported? - [162]Q-54: Can I use x11vnc as a replacement for Xvnc? (i.e. not for a + [167]Q-54: Can I use x11vnc as a replacement for Xvnc? (i.e. not for a real display, but for a virtual one I keep around). - [163]Q-55: How can I use x11vnc on "headless" machines? Why might I + [168]Q-55: How can I use x11vnc on "headless" machines? Why might I want to? [Resource Usage and Performance] - [164]Q-56: I have lots of memory, but why does x11vnc fail with + [169]Q-56: I have lots of memory, but why does x11vnc fail with shmget: No space left on device or Minor opcode of failed request: 1 (X_ShmAttach)? - [165]Q-57: How can I make x11vnc use less system resources? + [170]Q-57: How can I make x11vnc use less system resources? - [166]Q-58: How can I make x11vnc use MORE system resources? + [171]Q-58: How can I make x11vnc use MORE system resources? - [167]Q-59: I use x11vnc over a slow link with high latency (e.g. + [172]Q-59: I use x11vnc over a slow link with high latency (e.g. dialup modem), is there anything I can do to speed things up? - [168]Q-60: Does x11vnc support the X DAMAGE Xserver extension to find + [173]Q-60: Does x11vnc support the X DAMAGE Xserver extension to find modified regions of the screen quickly and efficiently? - [169]Q-61: When I drag windows around with the mouse or scroll up and + [174]Q-61: When I drag windows around with the mouse or scroll up and down things really bog down (unless I do the drag in a single, quick motion). Is there anything to do to improve things? - [170]Q-62: Why not do something like wireframe animations to avoid the + [175]Q-62: Why not do something like wireframe animations to avoid the windows "lurching" when being moved or resized? - [171]Q-63: Can x11vnc try to apply heuristics to detect when an window + [176]Q-63: Can x11vnc try to apply heuristics to detect when an window is scrolling its contents and use the CopyRect encoding for a speedup? [Mouse Cursor Shapes] - [172]Q-64: Why isn't the mouse cursor shape (the little icon shape + [177]Q-64: Why isn't the mouse cursor shape (the little icon shape where the mouse pointer is) correct as I move from window to window? - [173]Q-65: When using XFIXES cursorshape mode, some of the cursors + [178]Q-65: When using XFIXES cursorshape mode, some of the cursors look really bad with extra black borders around the cursor and other cruft. How can I improve their appearance? - [174]Q-66: In XFIXES mode, are there any hacks to handle cursor + [179]Q-66: In XFIXES mode, are there any hacks to handle cursor transparency ("alpha channel") exactly? [Mouse Pointer] - [175]Q-67: Why does the mouse arrow just stay in one corner in my + [180]Q-67: Why does the mouse arrow just stay in one corner in my vncviewer, whereas my cursor (that does move) is just a dot? - [176]Q-68: Can I take advantage of the TightVNC extension to the VNC + [181]Q-68: Can I take advantage of the TightVNC extension to the VNC protocol where Cursor Positions Updates are sent back to all connected clients (i.e. passive viewers can see the mouse cursor being moved around by another viewer)? - [177]Q-69: Is it possible to swap the mouse buttons (e.g. left-handed + [182]Q-69: Is it possible to swap the mouse buttons (e.g. left-handed operation), or arbitrarily remap them? How about mapping button clicks to keystrokes, e.g. to partially emulate Mouse wheel scrolling? [Keyboard Issues] - [178]Q-70: How can I get my AltGr and Shift modifiers to work between + [183]Q-70: How can I get my AltGr and Shift modifiers to work between keyboards for different languages? - [179]Q-71: When I try to type a "<" (i.e. less than) instead I get ">" + [184]Q-71: When I try to type a "<" (i.e. less than) instead I get ">" (i.e. greater than)! Strangely, typing ">" works OK!! - [180]Q-72: When I try to type a "<" (i.e. less than) instead I get + [185]Q-72: When I try to type a "<" (i.e. less than) instead I get "<," (i.e. an extra comma). - [181]Q-73: I'm using an "international" keyboard (e.g. German "de", or + [186]Q-73: I'm using an "international" keyboard (e.g. German "de", or Danish "dk") and the -modtweak mode works well if the VNC viewer is run on a Unix/Linux machine with a similar keyboard. But if I run the VNC viewer on Unix/Linux with a different keyboard (e.g. "us") or Windows with any keyboard, I can't type some keys like: "@", "$", "<", ">", etc. How can I fix this? - [182]Q-74: When typing I sometimes get double, triple, or more of my + [187]Q-74: When typing I sometimes get double, triple, or more of my keystrokes repeated. I'm sure I only typed them once, what can I do? - [183]Q-75: The x11vnc -norepeat mode is in effect, but I still get + [188]Q-75: The x11vnc -norepeat mode is in effect, but I still get repeated keystrokes!! - [184]Q-76: The machine where I run x11vnc has an AltGr key, but the + [189]Q-76: The machine where I run x11vnc has an AltGr key, but the local machine where I run the VNC viewer does not. Is there a way I can map a local unused key to send an AltGr? How about a Compose key as well? - [185]Q-77: I have a Sun machine I run x11vnc on. Its Sun keyboard has + [190]Q-77: I have a Sun machine I run x11vnc on. Its Sun keyboard has just one Alt key labelled "Alt" and two Meta keys labelled with little diamonds. The machine where I run the VNC viewer only has Alt keys. How can I send a Meta keypress? (e.g. emacs needs this) - [186]Q-78: Can I map a keystroke to a mouse button click on the remote + [191]Q-78: Can I map a keystroke to a mouse button click on the remote machine? [Screen Related Issues and Features] - [187]Q-79: The remote display is larger (in number of pixels) than the + [192]Q-79: The remote display is larger (in number of pixels) than the local display I am running the vncviewer on. I don't like the vncviewer scrollbars, what I can do? - [188]Q-80: Does x11vnc support server-side framebuffer scaling? (E.g. + [193]Q-80: Does x11vnc support server-side framebuffer scaling? (E.g. to make the desktop smaller). - [189]Q-81: Does x11vnc work with Xinerama? (i.e. multiple monitors + [194]Q-81: Does x11vnc work with Xinerama? (i.e. multiple monitors joined together to form one big, single screen). - [190]Q-82: Can I use x11vnc on a multi-headed display that is not + [195]Q-82: Can I use x11vnc on a multi-headed display that is not Xinerama (i.e. separate screens :0.0, :0.1, ... for each monitor)? - [191]Q-83: Can x11vnc show only a portion of the display? (E.g. for a + [196]Q-83: Can x11vnc show only a portion of the display? (E.g. for a special purpose rfb application). - [192]Q-84: Does x11vnc support the XRANDR (X Resize, Rotate and + [197]Q-84: Does x11vnc support the XRANDR (X Resize, Rotate and Reflection) extension? Whenever I rotate or resize the screen x11vnc just seems to crash. - [193]Q-85: Why is the view in my VNC viewer completely black? Or why + [198]Q-85: Why is the view in my VNC viewer completely black? Or why is everything flashing around randomly? - [194]Q-86: I use Linux Virtual Consoles (VC's) to implement 'Fast User + [199]Q-86: I use Linux Virtual Consoles (VC's) to implement 'Fast User Switching' between users' sessions (e.g. Betty is on Ctrl-Alt-F7, Bobby is on Ctrl-Alt-F8, and Sid is on Ctrl-Alt-F1: they use those keystrokes to switch between their sessions). How come the view in a @@ -1158,12 +1173,15 @@ make otherwise all messed up unless the X session x11vnc is attached to is in the active VC? - [195]Q-87: Can I use x11vnc to view my VMWare session remotely? + [200]Q-87: Can I use x11vnc to view my VMWare session remotely? - [196]Q-88: Can non-X devices (e.g. a raw framebuffer) be viewed and/or - controlled by x11vnc? + [201]Q-88: Can non-X devices (e.g. a raw framebuffer) be viewed (and + even controlled) with VNC via x11vnc? - [197]Q-89: I am using x11vnc where my local machine has "popup/hidden + [202]Q-89: Can I export via VNC a Webcam or TV tuner framebuffer using + x11vnc? + + [203]Q-90: I am using x11vnc where my local machine has "popup/hidden taskbars" (e.g. GNOME or MacOS X) and the remote display where x11vnc runs also has "popup/hidden taskbars" (e.g. GNOME). When I move the mouse to the edge of the screen where the popups happen, the taskbars @@ -1171,15 +1189,15 @@ make [Misc: Clipboard, File Transfer, Beeps, Thanks, etc.] - [198]Q-90: Does the Clipboard/Selection get transferred between the + [204]Q-91: Does the Clipboard/Selection get transferred between the vncviewer and the X display? - [199]Q-91: Can I transfer files back and forth with x11vnc? + [205]Q-92: Can I transfer files back and forth with x11vnc? - [200]Q-92: Why don't I hear the "Beeps" in my X session (e.g. when + [206]Q-93: Why don't I hear the "Beeps" in my X session (e.g. when typing tput bel in an xterm)? - [201]Q-93: Thanks for your program and for your help! Can I make a + [207]Q-94: Thanks for your program and for your help! Can I make a donation? _________________________________________________________________ @@ -1192,7 +1210,7 @@ make For the former error, you need to specify the X display to connect to (it also needs to be on the same machine the x11vnc process is to run - on). Set your DISPLAY environment variable or use the [202]-display + on). Set your DISPLAY environment variable or use the [208]-display option to specify it. Nearly always the correct value will be ":0" @@ -1209,7 +1227,7 @@ make How to Solve: See the xauth(1), Xsecurity(7), and xhost(1) man pages for much info on X11 permissions. For example, you may need to set - your XAUTHORITY environment variable or use the [203]-auth option to + your XAUTHORITY environment variable or use the [209]-auth option to point to the correct MIT-MAGIC-COOKIE file (e.g. /home/joe/.Xauthority or /var/gdm/:0.Xauth or /var/lib/kdm/A:0-crWk72K or /tmp/.gdmzndVlR), or simply be sure you run x11vnc as the correct user (i.e. the user @@ -1231,7 +1249,7 @@ make x11vnc -display :0 -auth /var/gdm/:0.Xauth (this is for the display manager gdm and requires root permission to - read the gdm cookie file, see [204]this faq for other display manager + read the gdm cookie file, see [210]this faq for other display manager cookie file names). While running x11vnc as root, remember it comes with no warranty ;-). @@ -1241,7 +1259,7 @@ make (from the same machine). The person could then type "xhost -localhost" after x11vnc has connected to go back to the default permissions. Also, for some situations the "-users lurk=" option may be of use - (please read the documentation on the [205]-users option). + (please read the documentation on the [211]-users option). To test out your X11 permissions from a remote shell, set DISPLAY and possibly XAUTHORITY (see your shell's man page, bash(1), tcsh(1), on @@ -1353,7 +1371,7 @@ h earlier and perhaps non-Solaris): First use the environment settings (CPPFLAGS, LDFLAGS, etc.) in the - above [206]Solaris build script to run the configure command. That + above [212]Solaris build script to run the configure command. That should succeed without failure. Then you have to hand edit the autogenerated rfb/rfbconfig.h file in the source tree, and just before the last #endif at the bottom of that file insert these workaround @@ -1379,7 +1397,7 @@ typedef unsigned int in_addr_t; on other older OS (Solaris, Linux, ...) releases. Here are some notes for similar steps that need to be done to build on - [207]SunOS 4.x + [213]SunOS 4.x Please let us know if you had to use the above workaround (and whether it worked or not). If there is enough demand we will try to push clean @@ -1389,25 +1407,25 @@ typedef unsigned int in_addr_t; Q-5: Where can I get a precompiled x11vnc binary for my Operating System? - Hopefully the [208]build steps above and [209]FAQ provide enough info + Hopefully the [214]build steps above and [215]FAQ provide enough info for a painless compile for most environments. Please report problems with the x11vnc configure, make, etc. on your system (if your system is known to compile other GNU packages successfully). There are precompiled x11vnc binaries built by other groups that are available at the following locations: - Debian: (.deb) [210]http://packages.debian.org/x11vnc + Debian: (.deb) [216]http://packages.debian.org/x11vnc - Slackware: (.tgz) [211]http://www.linuxpackages.net/ Redhat/Fedora: - (.rpm) [212]http://dag.wieers.com/packages/x11vnc/ - [213]http://dries.ulyssis.org/rpm/packages/x11vnc SuSE: (.rpm) - [214]http://linux01.gwdg.de/~pbleser/ Solaris: (pkg) - [215]http://www.sunfreeware.com/ Nokia 770 (.deb) - [216]http://mike.saunby.net/770/x11vnc/ Sharp Zaurus - [217]http://www.pdaxrom.org/ and [218]http://www.focv.com/ + Slackware: (.tgz) [217]http://www.linuxpackages.net/ Redhat/Fedora: + (.rpm) [218]http://dag.wieers.com/packages/x11vnc/ + [219]http://dries.ulyssis.org/rpm/packages/x11vnc SuSE: (.rpm) + [220]http://linux01.gwdg.de/~pbleser/ Solaris: (pkg) + [221]http://www.sunfreeware.com/ Nokia 770 (.deb) + [222]http://mike.saunby.net/770/x11vnc/ Sharp Zaurus + [223]http://www.pdaxrom.org/ and [224]http://www.focv.com/ If the above binaries don't work and building x11vnc on your OS fails - (and all else fails!) you can try one of [219]my collection of + (and all else fails!) you can try one of [225]my collection of binaries for various OS's and x11vnc releases. As a general note, the x11vnc program is simple enough you don't @@ -1428,10 +1446,10 @@ typedef unsigned int in_addr_t; To obtain VNC viewers for the viewing side (Windows, Mac OS, or Unix) try here: - * [220]http://www.tightvnc.com/download.html - * [221]http://www.realvnc.com/download-free.html - * [222]http://sourceforge.net/projects/cotvnc/ - * [223]http://www.ultravnc.com/ + * [226]http://www.tightvnc.com/download.html + * [227]http://www.realvnc.com/download-free.html + * [228]http://sourceforge.net/projects/cotvnc/ + * [229]http://www.ultravnc.com/ Q-7: How can I see all of x11vnc's command line options and @@ -1439,7 +1457,7 @@ typedef unsigned int in_addr_t; Run: x11vnc -opts to list just the option names or run: x11vnc -help for long descriptions about each option. The output is listed - [224]here as well. + [230]here as well. Q-8: I don't like typing arcane command line options every time I @@ -1469,10 +1487,10 @@ display :0 remote-control functionality ("-R") that was added. The /usr/bin/wish program is needed for operation. The gui is not particularly user-friendly, it just provides a point and click mode to set all the - many x11vnc parameters and obtain help on them. See the [225]-gui + many x11vnc parameters and obtain help on them. See the [231]-gui option for more info. Examples: "x11vnc ... -gui" and "x11vnc ... -gui other:0" in the latter case the gui is displayed on other:0, not the X - display x11vnc is polling. There is also a "[226]-gui tray" system + display x11vnc is polling. There is also a "[232]-gui tray" system tray mode. @@ -1500,11 +1518,11 @@ display :0 Q-10: Can I make x11vnc more quiet and also go into the background after starting up? - Use the [227]-q and [228]-bg options, respectively. (also: -quiet is + Use the [233]-q and [234]-bg options, respectively. (also: -quiet is an alias for -q) Note that under -bg the stderr messages will be lost unless you use - the "[229]-o logfile" option. + the "[235]-o logfile" option. Q-11: Sometimes when a VNC viewer dies abruptly, x11vnc also dies with @@ -1525,7 +1543,7 @@ display :0 There are some options. They are enabled by adding something like -Dxxxx=1 to the CPPFLAGS environment variable before running configure - (see the [230]build notes for general background). + (see the [236]build notes for general background). /* * Mar/2006 * Build-time customization via CPPFLAGS. @@ -1596,21 +1614,21 @@ display :0 dual-screen mode to pass the keystrokes and mouse motions to the X11 display? - Yes, for best response start up x11vnc with the "[231]-nofb" option + Yes, for best response start up x11vnc with the "[237]-nofb" option (disables framebuffer polling, and does other optimizations) on the secondary display (X11) machine. Then start up Win2VNC on the primary display (Windows) referring it to the secondary display. - This will also work X11 to X11 using [232]x2vnc, however you would + This will also work X11 to X11 using [238]x2vnc, however you would probably just want to avoid VNC and use x2x for that. For reference, here are some links to Win2VNC-like programs for multiple monitor setups: - * [233]Original Win2VNC - * [234]Enhanced Win2VNC and [235]sourceforge link - * [236]x2vnc - * [237]x2x also [238]here - * [239]zvnc (MorphOS) + * [239]Original Win2VNC + * [240]Enhanced Win2VNC and [241]sourceforge link + * [242]x2vnc + * [243]x2x also [244]here + * [245]zvnc (MorphOS) All of them will work with x11vnc (except x2x where it is not needed). @@ -1630,7 +1648,7 @@ display :0 on your display to be depth 24 TrueColor? Sun machines often have 8+24 overlay/multi-depth visuals, and you can make the default visual depth 24 TrueColor (see fbconfig(1) and Xsun(1)). 2) As of Feb/2004 x11vnc - has the [240]-visual option to allow you to force the framebuffer + has the [246]-visual option to allow you to force the framebuffer visual to whatever you want (this usually messes up the colors unless you are very clever). In this case, the option provides a convenient workaround for the Win2VNC bug: @@ -1645,7 +1663,7 @@ display :0 PseudoColor (i.e. only 256 distinct colors). The x11vnc colors may start out OK, but after a while they are incorrect in certain windows. - Use the [241]-flashcmap option to have x11vnc watch for changes in the + Use the [247]-flashcmap option to have x11vnc watch for changes in the colormap, and propagate those changes back to connected clients. This can be slow (since the whole screen must be updated over the network whenever the colormap changes). This flashing colormap behavior often @@ -1654,13 +1672,13 @@ display :0 example of this. Consider reconfiguring the system to 16 bpp or depth 24 TrueColor if at all possible. - Also note the option [242]-8to24 (Jan/2006) can often remove the need + Also note the option [248]-8to24 (Jan/2006) can often remove the need for flashing the colormap. Everything is dynamically transformed to depth 24 at 32 bpp using the colormaps. There may be painting errors however (see the following FAQ for tips on reducing and correcting them). - In some rare cases the [243]-notruecolor option has corrected colors + In some rare cases the [249]-notruecolor option has corrected colors on 8bpp displays. The red, green, and blue masks were non-zero in 8bpp PseudoColor on an obscure setup, and this option corrected the problems. @@ -1671,13 +1689,13 @@ display :0 different color depths: e.g. there are both depth 8 and 24 visuals available at the same time. - You may want to review the [244]previous question regarding 8 bpp + You may want to review the [250]previous question regarding 8 bpp PseudoColor. - On some hardware (Sun/SPARC and SGI), the [245]-overlay option + On some hardware (Sun/SPARC and SGI), the [251]-overlay option discussed a couple paragraphs down may solve this for you (you may want to skip to it directly). On other hardware the less robust - [246]-8to24 option may help (also discussed below). + [252]-8to24 option may help (also discussed below). Run xdpyinfo(1) to see what the default visual is and what the depths of the other visuals are. Does the default visual have a depth of 8 @@ -1713,7 +1731,7 @@ TrueColor defdepth 24 The -overlay mode: Another option is if the system with overlay visuals is a Sun system running Solaris or SGI running IRIX you can - use the [247]-overlay x11vnc option (Aug/2004) to have x11vnc use the + use the [253]-overlay x11vnc option (Aug/2004) to have x11vnc use the Solaris XReadScreen(3X11) function to poll the "true view" of the whole screen at depth 24 TrueColor. XReadDisplay(3X11) is used on IRIX. This is useful for Legacy applications (older versions of @@ -1738,7 +1756,7 @@ TrueColor defdepth 24 Xsun, e.g. in your /etc/dt/config/Xservers file). - The -8to24 mode: The [248]-8to24 x11vnc option (Jan/2006) is a kludge + The -8to24 mode: The [254]-8to24 x11vnc option (Jan/2006) is a kludge to try to dynamically rewrite the pixel values so that the 8bpp part of the screen is mapped onto depth 24 TrueColor. This is less robust than the -overlay mode because it is done by x11vnc outside of the X @@ -1752,11 +1770,11 @@ TrueColor defdepth 24 32bpp view is exported via VNC. Even on pure 8bpp displays it can be used as an alternative to - [249]-flashcmap to avoid color flashing completely. + [255]-flashcmap to avoid color flashing completely. This scheme is approximate and can often lead to painting errors. You can manually correct most painting errors by pressing 3 Alt_L's in a - row, or by using something like: [250]-fixscreen V=3.0 to + row, or by using something like: [256]-fixscreen V=3.0 to automatically refresh the screen every 3 seconds. Also -fixscreen 8=3.0 has been added to just refresh the non-default visual parts of the screen. @@ -1769,23 +1787,23 @@ TrueColor defdepth 24 nogetimage can give a nice speedup if the default depth 24 X server supports hiding the 8bpp bits in bits 25-32 of the framebuffer data. On very slow machines -8to24 poll=0.2,cachewin=5.0 gives an useful - speedup. See the [251]-8to24 help description for information on + speedup. See the [257]-8to24 help description for information on tunable parameters, etc. Colors still not working correctly? Run xwininfo on the application with the incorrect colors to verify that the depth of its visual is different from the default visual depth (gotten from xdpyinfo). One - possible workaround in this case is to use the [252]-id option to + possible workaround in this case is to use the [258]-id option to point x11vnc at the application window itself. If the application is complicated (lots of toplevel windows and popup menus) this may not be acceptable, and may even crash x11vnc (but not the application). It is theoretically possible to solve this problem in general (see xwd(1) for example), but it does not seem trivial or sufficiently fast - for x11vnc to be able to do so in real time. The [253]-8to24 method + for x11vnc to be able to do so in real time. The [259]-8to24 method does this approximately and is somewhat usable. Fortunately the - [254]-overlay option works for Solaris machines with overlay visuals + [260]-overlay option works for Solaris machines with overlay visuals where most of this problem occurs. @@ -1796,9 +1814,9 @@ TrueColor defdepth 24 the desired application window. After clicking, it will print out much information, including the window id (e.g. 0x6000010). Also, the visual and depth of the window printed out is often useful in - debugging x11vnc [255]color problems. + debugging x11vnc [261]color problems. - Also, as of Dec/2004 you can use "[256]-id pick" to have x11vnc run + Also, as of Dec/2004 you can use "[262]-id pick" to have x11vnc run xwininfo(1) for you and after you click the window it extracts the windowid. Besides "pick" there is also "id:root" to allow you to go back to root window when doing remote-control. @@ -1816,7 +1834,7 @@ TrueColor defdepth 24 you should be able to see these transient windows. If things are not working and you still want to do the single window - polling, try the [257]-sid windowid option ("shifted" windowid). + polling, try the [263]-sid windowid option ("shifted" windowid). Q-19: My X display is depth 24 at 24bpp (instead of the normal depth @@ -1851,6 +1869,10 @@ TrueColor defdepth 24 handle 24bpp from the server, so you may want to use those. They evidently request 32 bpp and libvncserver obliges. + Update: as of Apr/2006 you can use the [264]-24to32 option to have + x11vnc dynamically transform the 24bpp pixel data to 32bpp. This extra + transformation could slow things down further. + Now coming the opposite direction if you are running the vncviewer on the 24bpp display, TightVNC will fail with "Can't cope with 24 bits-per-pixel. Sorry." and RealVNC will fail with "main: Error: @@ -1866,15 +1888,15 @@ TrueColor defdepth 24 since you will be polling the X display over the network as opposed to over the local hardware. To do this, run x11vnc on a UNIX machine as close as possible network-wise (e.g. same switch) to the Xterminal - machine. Use the [258]-display option to point the display to that of + machine. Use the [265]-display option to point the display to that of the Xterminal (you'll of course need basic X11 permission to do that) - and also supply the [259]-noshm option (this enables the polling over + and also supply the [266]-noshm option (this enables the polling over the network). The response will likely be sluggish (maybe only one "frame" per second). This mode is not recommended except for "quick checks" of hard to get to X servers. Use something like "-wait 150" to cut down - on the polling rate. You may also need [260]-flipbyteorder if the + on the polling rate. You may also need [267]-flipbyteorder if the colors get messed up due to endian byte order differences. Q-21: How do I get my X permissions (MIT-MAGIC-COOKIE file) correct @@ -1898,7 +1920,7 @@ TrueColor defdepth 24 copied to the Xterminal. If $HOME/.Xauthority is exported via NFS (this is insecure of course, but has been going on for decades), then x11vnc can simply pick it up via NFS (you may need to use the - [261]-auth option to point to the correct file). Other options include + [268]-auth option to point to the correct file). Other options include copying the auth file using scp, or something like: central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge - @@ -1910,7 +1932,7 @@ TrueColor defdepth 24 details. If the display name in the cookie file needs to be changed between the - two hosts, see [262]this note on the "xauth add ..." command. + two hosts, see [269]this note on the "xauth add ..." command. A less secure option is to run something like "xhost +127.0.0.1" while sitting at the Xterminal box to allow cookie-free local access for @@ -1924,7 +1946,7 @@ TrueColor defdepth 24 occasional app more efficiently locally on the Xterminal box (e.g. realplayer). - Not recommended, but as a last resort, you could have x11vnc [263]poll + Not recommended, but as a last resort, you could have x11vnc [270]poll the Xterminal Display over the network. For this you would run a "x11vnc -noshm ..." process on the central-server (and hope the network admin doesn't get angry...) @@ -1953,13 +1975,13 @@ TrueColor defdepth 24 Q-22: I'm having trouble using x11vnc with my Sun Ray session. - The [264]Sun Ray technology is a bit like "VNC done in hardware" (the + The [271]Sun Ray technology is a bit like "VNC done in hardware" (the Sun Ray terminal device, DTU, playing the role of the vncviewer). Completely independent of that, the SunRay user's session is still an X server that speaks the X11 protocol and so x11vnc simply talks to the X server part to export the SunRay desktop to any place in the world (i.e. not only to a Sun Ray terminal device), creating a sort of - "Soft Ray". Please see [265]this discussion of Sun Ray issues for + "Soft Ray". Please see [272]this discussion of Sun Ray issues for solutions to problems. [Remote Control] @@ -1967,17 +1989,17 @@ TrueColor defdepth 24 Q-23: How do I stop x11vnc once it is running in the background? As of Dec/2004 there is a remote control feature. It can change a huge - amount of things on the fly: see the [266]-remote and [267]-query + amount of things on the fly: see the [273]-remote and [274]-query options. To shut down the running x11vnc server just type "x11vnc -R stop". To disconnect all clients do "x11vnc -R disconnect:all", etc. - If the [268]-forever option has not been supplied, x11vnc will + If the [275]-forever option has not been supplied, x11vnc will automatically exit after the first client disconnects. In general you will have to kill the x11vnc process This can be done via: "kill NNNNN" (where NNNNN is the x11vnc process id number found from ps(1)), or "pkill x11vnc", or "killall x11vnc" (Linux only). - If you have not put x11vnc in the background via the [269]-bg option + If you have not put x11vnc in the background via the [276]-bg option or shell & operator, then simply press Ctrl-C in the shell where x11vnc is running to stop it. @@ -1987,15 +2009,15 @@ TrueColor defdepth 24 down state in the Xserver. Tapping the stuck key (either via a new x11vnc or at the physical console) will release it from the stuck state. If the keyboard seems to be acting strangely it is often fixed - by tapping Ctrl, Shift, and Alt. Alternatively, the [270]-clear_mods - option and [271]-clear_keys option can be used to release pressed keys + by tapping Ctrl, Shift, and Alt. Alternatively, the [277]-clear_mods + option and [278]-clear_keys option can be used to release pressed keys at startup and exit. Q-24: Can I change settings in x11vnc without having to restart it? Can I remote control it? - Look at the [272]-remote (same as -R) and [273]-query (same as -Q) + Look at the [279]-remote (same as -R) and [280]-query (same as -Q) options added in Dec/2004. They allow nearly everything to be changed dynamically and settings to be queried. Examples: "x11vnc -R shared", "x11vnc -R forever", "x11vnc -R scale:3/4", "x11vnc -Q modtweak", @@ -2006,7 +2028,7 @@ TrueColor defdepth 24 correctly for communication to be possible. There is also a simple Tcl/Tk gui based on this remote control - mechanism. See the [274]-gui option for more info. You will need to + mechanism. See the [281]-gui option for more info. You will need to have Tcl/Tk (i.e. /usr/bin/wish) installed for it to work. It can also run in the system tray: "-gui tray" or as a standalone icon window: "-gui icon". @@ -2021,12 +2043,12 @@ TrueColor defdepth 24 vncpasswd(1) program from those packages. As of Jun/2004 x11vnc supports the -storepasswd "pass" "file" - [275]option, which is the same functionality of storepasswd. Be sure + [282]option, which is the same functionality of storepasswd. Be sure to quote the "pass" if it contains shell meta characters, spaces, etc. Example: x11vnc -storepasswd 'sword*fish' $HOME/myvncpasswd - You then use the password via the x11vnc option: "[276]-rfbauth + You then use the password via the x11vnc option: "[283]-rfbauth $HOME/myvncpasswd" If you do not supply any arguments: @@ -2036,11 +2058,11 @@ TrueColor defdepth 24 keystrokes when entering the password will not be echoed to the screen). - x11vnc also has the [277]-passwdfile and -passwd/-viewpasswd plain + x11vnc also has the [284]-passwdfile and -passwd/-viewpasswd plain text (i.e. not obscured like the -rfbauth VNC passwords) password options. - You can use the [278]-usepw option to automatically use any password + You can use the [285]-usepw option to automatically use any password file you have in ~/.vnc/passwd or ~/.vnc/passwdfile (the latter is used with the -passwdfile option). @@ -2068,14 +2090,14 @@ TrueColor defdepth 24 Q-27: Can I have two passwords for VNC viewers, one for full access and the other for view-only access to the display? - Yes, as of May/2004 there is the [279]-viewpasswd option to supply the - view-only password. Note the full-access password option [280]-passwd + Yes, as of May/2004 there is the [286]-viewpasswd option to supply the + view-only password. Note the full-access password option [287]-passwd must be supplied at the same time. E.g.: -passwd sword -viewpasswd fish. To avoid specifying the passwords on the command line (where they could be observed via the ps(1) command by any user) you can use the - [281]-passwdfile option to specify a file containing plain text + [288]-passwdfile option to specify a file containing plain text passwords. Presumably this file is readable only by you, and ideally it is located on the machine x11vnc is run on (to avoid being snooped on over the network). The first line of this file is the full-access @@ -2083,7 +2105,7 @@ TrueColor defdepth 24 it is taken as the view-only password. (use "__EMPTY__" to supply an empty one). - View-only passwords currently do not work for the [282]-rfbauth + View-only passwords currently do not work for the [289]-rfbauth password option (standard VNC password storing mechanism). FWIW, note that although the output (usually placed in $HOME/.vnc/passwd) by the vncpasswd or storepasswd programs (or from x11vnc -storepasswd) looks @@ -2096,7 +2118,7 @@ TrueColor defdepth 24 Q-28: Can I have as many full-access and view-only passwords as I like? - Yes, as of Jan/2006 in the libvncserver CVS the [283]-passwdfile + Yes, as of Jan/2006 in the libvncserver CVS the [290]-passwdfile option has been extended to handle as many passwords as you like. You put the view-only passwords after a line __BEGIN_VIEWONLY__. @@ -2110,7 +2132,7 @@ TrueColor defdepth 24 Until the VNC protocol and libvncserver support this things will be approximate at best. - Update: as of Feb/2006 x11vnc has the [284]-unixpw option that does + Update: as of Feb/2006 x11vnc has the [291]-unixpw option that does this outside of the VNC protocol and libvncserver. The standard su(1) program is used to validate the user's password. A familiar "login:" and "Password:" dialog is presented to the user on a black screen @@ -2120,7 +2142,7 @@ TrueColor defdepth 24 A list of allowed Unix usernames may also be supplied along with per-user settings. - There is also the [285]-unixpw_nis option for non-shadow-password + There is also the [292]-unixpw_nis option for non-shadow-password (typically NIS environments, hence the name) systems where the traditional getpwnam() and crypt() functions are used instead of su(1). The encrypted user passwords must be accessible to the user @@ -2129,7 +2151,7 @@ TrueColor defdepth 24 shadow(5). Two settings are enforced in the -unixpw and -unixpw_nis modes to - provide extra security: the 1) [286]-localhost and 2) [287]-stunnel + provide extra security: the 1) [293]-localhost and 2) [294]-stunnel options. Without these one might send the Unix username and password data in clear text over the network which is a very bad idea. They can be relaxed if you want to provide encryption other than stunnel (the @@ -2147,13 +2169,13 @@ TrueColor defdepth 24 Previous discussion: One approximate method involves starting x11vnc - with the [288]-localhost option. This basically requires the viewer + with the [295]-localhost option. This basically requires the viewer user to log into the workstation where x11vnc is running via their Unix username and password, and then somehow set up a port redirection of his vncviewer connection to make it appear to emanate from the local machine. As discussed above, ssh is useful for this: "ssh -L 5900:localhost:5900 user@hostname ..." See the ssh wrapper scripts - mentioned [289]elsewhere on this page. [290]stunnel does this as well. + mentioned [296]elsewhere on this page. [297]stunnel does this as well. Of course a malicious user could allow other users to get in through his channel, but that is a problem with every method. Another thing to @@ -2164,7 +2186,7 @@ TrueColor defdepth 24 traditional way would be to further require a VNC password to supplied (-rfbauth, -passwd, etc) and only tell the people allowed in what the VNC password is. A scheme that avoids a second password involves using - the [291]-accept option that runs a program to examine the connection + the [298]-accept option that runs a program to examine the connection information to determine which user is connecting from the local machine. That may be difficult to do, but, for example, the program could use the ident service on the local machine (normally ident @@ -2203,15 +2225,15 @@ exit 1 # reject it These defaults are simple safety measures to avoid someone unknowingly leaving his X11 desktop exposed (to the internet, say) for long - periods of time. Use the [292]-forever option (aka -many) to have + periods of time. Use the [299]-forever option (aka -many) to have x11vnc wait for more connections after the first client disconnects. - Use the [293]-shared option to have x11vnc allow multiple clients to + Use the [300]-shared option to have x11vnc allow multiple clients to connect simultaneously. - Recommended additional safety measures include using ssh ([294]see + Recommended additional safety measures include using ssh ([301]see above), stunnel, or a VPN to authenticate and encrypt the viewer - connections or to at least use the -rfbauth passwd-file [295]option to - use VNC password protection (or [296]-passwdfile) It is up to YOU to + connections or to at least use the -rfbauth passwd-file [302]option to + use VNC password protection (or [303]-passwdfile) It is up to YOU to apply these security measures, they will not be done for you automatically. @@ -2219,7 +2241,7 @@ exit 1 # reject it Q-31: Can I limit which machines incoming VNC clients can connect from? - Yes, look at the [297]-allow and [298]-localhost options to limit + Yes, look at the [304]-allow and [305]-localhost options to limit connections by hostname or IP address. E.g. x11vnc -allow 192.168.0.1,192.168.0.2 @@ -2231,7 +2253,7 @@ exit 1 # reject it Note that -localhost is the same as "-allow 127.0.0.1" For more control, build libvncserver with libwrap support - [299](tcp_wrappers) and then use /etc/hosts.allow See hosts_access(5) + [306](tcp_wrappers) and then use /etc/hosts.allow See hosts_access(5) for complete details. @@ -2251,7 +2273,7 @@ exit 1 # reject it is "vnc", e.g.: vnc: 192.168.100.3 .example.com - Note that if you run x11vnc out of [300]inetd you do not need to build + Note that if you run x11vnc out of [307]inetd you do not need to build x11vnc with libwrap support because the /usr/sbin/tcpd reference in /etc/inetd.conf handles the tcp_wrappers stuff. @@ -2260,15 +2282,15 @@ exit 1 # reject it internal LAN) rather than having it listen on all network interfaces and relying on -allow to filter unwanted connections out? - As of Mar/2005 there is the "[301]-listen ipaddr" option that enables + As of Mar/2005 there is the "[308]-listen ipaddr" option that enables this. For ipaddr either supply the desired network interface's IP address (or use a hostname that resolves to it) or use the string "localhost". For additional filtering simultaneously use the - "[302]-allow host1,..." option to allow only specific hosts in. + "[309]-allow host1,..." option to allow only specific hosts in. This option is useful if you want to insure that no one can even begin a dialog with x11vnc from untrusted network interfaces (e.g. ppp0). - The option [303]-localhost now implies "-listen localhost" since that + The option [310]-localhost now implies "-listen localhost" since that is what most people expect it to do. @@ -2276,17 +2298,17 @@ exit 1 # reject it interface, how I can occasionally allow in a non-localhost via the -R allowonce remote control command? - To do this specify "[304]-allow localhost". Unlike [305]-localhost + To do this specify "[311]-allow localhost". Unlike [312]-localhost this will leave x11vnc listening on all interfaces (but of course only allowing in local connections, e.g. ssh redirs). Then you can later run "x11vnc -R allowonce:somehost" or use to gui to permit a one-shot connection from a remote host. Note that if you do a lot of changing of the listening interface - ([306]-listen option) via remote control or gui, you may need to also - manually adjust the [307]-allow list if you unexpectedly get into a + ([313]-listen option) via remote control or gui, you may need to also + manually adjust the [314]-allow list if you unexpectedly get into a state where the allow list cannot match any hosts that would be coming - in on the listening interface. If you just toggle [308]-localhost on + in on the listening interface. If you just toggle [315]-localhost on and off x11vnc should see to it that you never get into such a state. @@ -2294,7 +2316,7 @@ exit 1 # reject it some users just be able to move the mouse, but not click or type anything? - As of Feb/2005, the [309]-input option allows you to do this. "K", + As of Feb/2005, the [316]-input option allows you to do this. "K", "M", and "B" stand for Keystroke, Mouse-motion, and Button-clicks, respectively. The setting: "-input M" makes attached viewers only able to move the mouse. "-input KMB,M" lets normal clients do everything @@ -2309,7 +2331,7 @@ exit 1 # reject it some clients view-only? How about running an arbitrary program to make the decisions? - Yes, look at the "[310]-accept command" option, it allows you to + Yes, look at the "[317]-accept command" option, it allows you to specify an external command that is run for each new client. (use quotes around the command if it contains spaces, etc.). If the external command returns 0 the client is accepted, otherwise the @@ -2328,7 +2350,7 @@ exit 1 # reject it own simple popup window. To accept the client press "y" or click mouse on the "Yes" button. To reject the client press "n" or click mouse on the "No" button. To accept the client View-only, press "v" or click - mouse on the "View" button. If the [311]-viewonly option has been + mouse on the "View" button. If the [318]-viewonly option has been supplied, the "View" action will not be present: the whole display is view only in that case. @@ -2344,7 +2366,7 @@ exit 1 # reject it program to prompt the user whether the client should be accepted or not. This requires that you have xmessage installed and available via PATH. In case it is not already on your system, the xmessage program - is available at [312]ftp://ftp.x.org/ + is available at [319]ftp://ftp.x.org/ To include view-only decisions for the external commands, prefix the command something like this: "yes:0,no:*,view:3 mycommand ..." This @@ -2383,7 +2405,7 @@ elif [ $rc = 4 ]; then fi exit 1 - Stefan Radman has written a nice dtksh script [313]dtVncPopup for use + Stefan Radman has written a nice dtksh script [320]dtVncPopup for use in CDE environments to do the same sort of thing. Information on how to use it is found at the top of the file. He encourages you to provide feedback to him to help improve the script. @@ -2392,7 +2414,7 @@ exit 1 popup is being run, so attached clients will not receive screen updates, etc during this period. - To run a command when a client disconnects, use the "[314]-gone + To run a command when a client disconnects, use the "[321]-gone command" option. This is for the user's convenience only: the return code of the command is not interpreted by x11vnc. The same environment variables are set as in "-accept command" (except that RFB_MODE will @@ -2403,7 +2425,7 @@ exit 1 display manager like gdm(1). Can I have x11vnc later switch to a different user? - As of Feb/2005 x11vnc has the [315]-users option that allows things + As of Feb/2005 x11vnc has the [322]-users option that allows things like this. Please read the documentation on it (also in the x11vnc -help output) carefully for features and caveats. It's use can often decrease security unless care is taken. @@ -2428,7 +2450,7 @@ exit 1 In any event, as of Jun/2004 there is an experimental utility to make it more difficult for nosey people to see your x11vnc activities. The - source for it is [316]blockdpy.c The idea behind it is simple (but + source for it is [323]blockdpy.c The idea behind it is simple (but obviously not bulletproof): when a VNC client attaches to x11vnc put the display monitor in the DPMS "off" state, if the DPMS state ever changes immediately start up the screen-lock program. The x11vnc user @@ -2444,8 +2466,8 @@ exit 1 bulletproof. A really robust solution would likely require X server and perhaps even video hardware support. - The blockdpy utility is launched by the [317]-accept option and told - to exit via the [318]-gone option (the vnc client user should + The blockdpy utility is launched by the [324]-accept option and told + to exit via the [325]-gone option (the vnc client user should obviously re-lock the screen before disconnecting!). Instructions can be found in the source code for the utility at the above link. @@ -2453,7 +2475,7 @@ exit 1 Q-39: Can I have x11vnc automatically lock the screen when I disconnect the VNC viewer? - Yes, a user mentions he uses the [319]-gone option under CDE to run a + Yes, a user mentions he uses the [326]-gone option under CDE to run a screen lock program: x11vnc -display :0 -forever -gone 'dtaction LockDisplay' @@ -2462,7 +2484,7 @@ exit 1 x11vnc -display :0 -forever -gone 'kdesktop_lock' x11vnc -display :0 -forever -gone 'xlock &' - Here is a scheme using the [320]-afteraccept option (in version 0.7.3) + Here is a scheme using the [327]-afteraccept option (in version 0.7.3) to unlock the screen after the first valid VNC login and to lock the screen after the last valid VNC login disconnects: x11vnc -display :0 -forever -shared -afteraccept ./myxlocker -gone ./myxlocke @@ -2493,7 +2515,7 @@ fi Q-40: How can I tunnel my connection to x11vnc via an encrypted SSH channel between two Unix machines? - See the description earlier on this page on [321]how to tunnel VNC via + See the description earlier on this page on [328]how to tunnel VNC via SSH from Unix to Unix. A number of ways are described along with some issues you may encounter. @@ -2504,7 +2526,7 @@ fi Q-41: How can I tunnel my connection to x11vnc via an encrypted SSH channel from Windows using an SSH client like Putty? - [322]Above we described how to tunnel VNC via SSH from Unix to Unix, + [329]Above we described how to tunnel VNC via SSH from Unix to Unix, you may want to review it. To do this from Windows using Putty it would go something like this: * In the Putty dialog window under 'Session' enter the hostname or @@ -2527,8 +2549,8 @@ fi process in a BAT file including launching the VNC viewer by using the plink Putty utility. Send us the script if you get that working. - For extra protection feel free to run x11vnc with the [323]-localhost - and [324]-rfbauth/[325]-passwdfile options. + For extra protection feel free to run x11vnc with the [330]-localhost + and [331]-rfbauth/[332]-passwdfile options. If the machine you SSH into via Putty is not the same machine with the X display you wish to view (e.g. your company provides incoming SSH @@ -2536,11 +2558,11 @@ fi dialog setting to: 'Destination: otherhost:5900', Once logged in, you'll need to do a second login (ssh or rsh) to the workstation machine 'otherhost' and then start up x11vnc on it. This can also be - automated by [326]chaining ssh's. + automated by [333]chaining ssh's. - As discussed [327]above another option is to first start the VNC + As discussed [334]above another option is to first start the VNC viewer in "listen" mode, and then launch x11vnc with the - "[328]-connect localhost" option to establish the reverse connection. + "[335]-connect localhost" option to establish the reverse connection. In this case a Remote port redirection (not Local) is needed for port 5500 instead of 5900 (i.e. 'Source port: 5500' and 'Destination: localhost:5500' for a Remote connection). @@ -2550,7 +2572,7 @@ fi channel using an external tool like stunnel? It is possible to use a "lighter weight" encryption setup than SSH or - IPSEC. SSL tunnels such as [329]stunnel provide an encrypted channel + IPSEC. SSL tunnels such as [336]stunnel provide an encrypted channel without the need for Unix users, passwords, and key passphrases required for ssh (and at the other extreme can also provide a complete signed certificate chain of trust). OTOH, since SSH is usually @@ -2558,12 +2580,12 @@ fi frequently the path of least resistance (it also nicely manages public keys for you). - Update: As of Feb/2006 x11vnc has the options [330]-ssl, - [331]-stunnel, and [332]-sslverify to provide integrated SSL schemes. - They are discussed [333]in the Next FAQ (you may want to skip to it + Update: As of Feb/2006 x11vnc has the options [337]-ssl, + [338]-stunnel, and [339]-sslverify to provide integrated SSL schemes. + They are discussed [340]in the Next FAQ (you may want to skip to it now). - Here are some basic examples using [334]stunnel but the general idea + Here are some basic examples using [341]stunnel but the general idea for any SSL tunnel utility is the same: * Start up x11vnc and constrain it to listen on localhost. * Then start up the SSL tunnel running on the same machine to @@ -2587,7 +2609,7 @@ fi The above two commands are run on host "far-away.east". The stunnel.pem is the self-signed PEM file certificate created when - stunnel is built. One can also create certificates [335]signed by + stunnel is built. One can also create certificates [342]signed by Certificate Authorities or self-signed if desired using the x11vnc utilities described there. @@ -2601,7 +2623,7 @@ fi Then point the viewer to the local tunnel on port 5902: vncviewer -encodings "copyrect tight zrle hextile" localhost:2 - That's it. (note that the [336]ssl_vncviewer script can automate + That's it. (note that the [343]ssl_vncviewer script can automate this.) Be sure to use a VNC password because unlike ssh by default the @@ -2609,13 +2631,13 @@ fi some extra configuration one could also set up certificates to provide authentication of either or both sides as well (and hence avoid man-in-the-middle attacks). See the stunnel and openssl documentation - and also [337]the key management section for details. + and also [344]the key management section for details. stunnel has also been ported to Windows, and there are likely others to choose from for that OS. Much info for using it on Windows can be - found at the stunnel site and in this [338]article The article also + found at the stunnel site and in this [345]article The article also shows the detailed steps to set up all the authentication - certificates. (for both server and clients, see also the [339]x11vnc + certificates. (for both server and clients, see also the [346]x11vnc utilities that do this). The default Windows client setup (no certs) is simpler and only 4 files are needed in a folder: stunnel.exe, stunnel.conf, libssl32.dll, libeay32.dll. We used an stunnel.conf @@ -2636,7 +2658,7 @@ connect = far-away.east:5901 As an aside, if you don't like the little "gap" of unencrypted TCP traffic (and a localhost listening socket) on the local machine between stunnel and x11vnc it can actually be closed by having stunnel - start up x11vnc in [340]-inetd mode: + start up x11vnc in [347]-inetd mode: stunnel -p /path/to/stunnel.pem -P none -d 5900 -l ./x11vnc_sh Where the script x11vnc_sh starts up x11vnc: @@ -2679,16 +2701,16 @@ connect = 5900 probably wouldn't work since the SSL negotiation is likely embedded in the VNC protocol unlike our case where it is external. - Note: as of Mar/2006 libvncserver/x11vnc provides a [341]SSL-enabled - Java applet that can be served up via the [342]-httpdir or [343]-http - options when [344]-ssl is enabled. It will also be served via HTTPS + Note: as of Mar/2006 libvncserver/x11vnc provides a [348]SSL-enabled + Java applet that can be served up via the [349]-httpdir or [350]-http + options when [351]-ssl is enabled. It will also be served via HTTPS via either the VNC port (e.g. https://host:5900/) or a 2nd port via - the [345]-https option. + the [352]-https option. In general current SSL VNC solutions are not particularly "seemless". But it can be done, and with a wrapper script on the viewer side and - the [346]-stunnel option on the server side it works well and is - convenient. Here is a simple script [347]ssl_vncviewer that automates + the [353]-stunnel option on the server side it works well and is + convenient. Here is a simple script [354]ssl_vncviewer that automates running stunnel on the VNC viewer side on Unix a little more carefully than the commands printed above. (One could probably do a similar thing with a .BAT file on Windows in the stunnel folder.) @@ -2696,7 +2718,7 @@ connect = 5900 Q-43: Does x11vnc have built-in SSL tunneling? - You can read about non-built-in methods [348]in the Previous FAQ + You can read about non-built-in methods [355]in the Previous FAQ SSL tunnels provide an encrypted channel without the need for Unix users, passwords, and key passphrases required for ssh (and at the @@ -2707,14 +2729,14 @@ connect = 5900 Built-in SSL x11vnc options: - As of Feb/2006 the x11vnc [349]-ssl and [350]-stunnel options automate - the SSL tunnel creation on the x11vnc server side. An [351]SSL-enabled + As of Feb/2006 the x11vnc [356]-ssl and [357]-stunnel options automate + the SSL tunnel creation on the x11vnc server side. An [358]SSL-enabled Java Viewer applet also provided that can be served via http or https to automate SSL on the client side. - The [352]-ssl mode uses the [353]www.openssl.org library if available - at build time. The [354]-stunnel mode requires the - [355]www.stunnel.org command stunnel(8) to be installed on the system. + The [359]-ssl mode uses the [360]www.openssl.org library if available + at build time. The [361]-stunnel mode requires the + [362]www.stunnel.org command stunnel(8) to be installed on the system. Both modes require an SSL certificate and key (i.e. .pem file). These are usually created via the openssl(1) (in fact in for options "-ssl" @@ -2766,12 +2788,12 @@ connect = 5900 is to encrypt the key with a passphrase (note however this requires supplying the passphrase each time x11vnc is started up). - See the discussion on [356]x11vnc Key Management for some utilities + See the discussion on [363]x11vnc Key Management for some utilities provided for creating and managing certificates and keys and even for creating your own Certificate Authority (CA) for signing VNC server and client certificates. This may be done by importing the certificate into Web Browser or Java plugin keystores, or pointing stunnel to it. - The wrapper script [357]ssl_vncviewer provides an example on unix + The wrapper script [364]ssl_vncviewer provides an example on unix (-verify option). Here are some notes on the simpler default (non-CA) operation. To have @@ -2787,7 +2809,7 @@ connect = 5900 to machines where the VNC Viewer will be run to enable authenticating the x11vnc SSL VNC server to the clients. When authentication takes place this way (or via the more sophisticated CA signing described - [358]here), then Man-In-The-Middle-Attacks are prevented. Otherwise, + [365]here), then Man-In-The-Middle-Attacks are prevented. Otherwise, the SSL encryption only provides protection against passive network traffic "sniffing". Nowadays, most people seem mostly concerned about only the latter (and the default x11vnc SSL modes protect against it.) @@ -2812,7 +2834,7 @@ connect = 5900 including using https to download it into the browser and connect to x11vnc. - See the [359]next FAQ for SSL enabled VNC Viewers. + See the [366]next FAQ for SSL enabled VNC Viewers. Q-44: How do I use VNC Viewers with built-in SSL tunneling? @@ -2823,9 +2845,9 @@ connect = 5900 The SSL enabled Java VNC Viewer (VncViewer.jar) in the x11vnc package supports only SSL based connections by default (set the applet parameter disableSSL=yes in index.vnc to override). As mentioned above - the [360]-httpdir can be used to specify the path to .../classes/ssl. + the [367]-httpdir can be used to specify the path to .../classes/ssl. A typical location might be /usr/local/share/x11vnc/classes/ssl. Or - the [361]-http can be used to try to have it find the directory + the [368]-http can be used to try to have it find the directory automatically. The Java viewer uses SSL to communicate securely with x11vnc. Note @@ -2850,7 +2872,7 @@ connect = 5900 example) can be slow or unreliable at times (it has to read some input and try to guess if the connection is VNC or HTTP). If it is unreliable and you still want to serve the Java applet via https, use - the [362]-https option to get an additional port dedicated to https + the [369]-https option to get an additional port dedicated to https (its URL will also be printed in the output). Another possibility is to add the GET applet parameter: @@ -2885,7 +2907,7 @@ connect = 5900 connection is VNC instead of the HTTPS it actually is (but since you have paused too long at the dialog the GET request comes too late). Often hitting Reload and going through the dialogs more quickly will - let you connect. Use the [363]-https option if you want a dedicated + let you connect. Use the [370]-https option if you want a dedicated port for HTTPS connections instead of sharing the VNC port. @@ -2894,10 +2916,10 @@ connect = 5900 If you want to use a native VNC Viewer with the SSL enabled x11vnc you will need to run an external SSL tunnel on the Viewer side. There do not seem to be any native SSL VNC Viewers outside of the x11vnc - package. The basic ideas of doing this were discussed [364]for + package. The basic ideas of doing this were discussed [371]for external tunnel utilities here. - The [365]ssl_vncviewer script provided with x11vnc can set up the + The [372]ssl_vncviewer script provided with x11vnc can set up the stunnel tunnel automatically on unix as long as the stunnel command is installed on the Viewer machine and available in PATH (and vncviewer too of course). Note that on Debian based system you will need to @@ -2929,10 +2951,10 @@ connect = 5900 The fifth one shows that Web proxies can be used if that is the only way to get out of the firewall. If the "double proxy" situation arises - separate the two by commas. See [366]this page for more information on + separate the two by commas. See [373]this page for more information on how Web proxies come into play. - If one uses a Certificate Authority (CA) scheme described [367]here, + If one uses a Certificate Authority (CA) scheme described [374]here, the wrapper script would use the CA cert instead of the server cert: 3') ssl_vncviewer -verify ./cacert.crt far-away.east:0 @@ -2968,7 +2990,7 @@ connect = 5900 (instead of the unsigned one in https://yourmachine.com:5900/ that gives the default index.vnc) - Note that the [368]ssl_vncviewer stunnel wrapper script can use Web + Note that the [375]ssl_vncviewer stunnel wrapper script can use Web proxies as well. Proxies that limit CONNECT to ports 443 and 563: @@ -2997,7 +3019,7 @@ connect = 5900 https://yourmachine.com/proxy.vnc?PORT=443 this is cleaner because it avoids editing the file, but requires more - parameters in the URL. To use the GET [369]trick discussed above, do: + parameters in the URL. To use the GET [376]trick discussed above, do: https://yourmachine.com/proxy.vnc?PORT=443&GET=1 @@ -3005,7 +3027,7 @@ connect = 5900 SSL from the Internet with a Web browser to x11vnc running on their workstations behind a firewall? Yes. You will need to configure apache to forward these connections. - It is discussed [370]here. This provides a clean alternative to the + It is discussed [377]here. This provides a clean alternative to the traditional method where the user uses SSH to log in through the gateway to create the encrypted port redirection to x11vnc running on her desktop. @@ -3013,7 +3035,7 @@ connect = 5900 Q-47: Can I create and use my own SSL Certificate Authority (CA) with x11vnc? - Yes, see [371]this page for how to do this and the utility commands + Yes, see [378]this page for how to do this and the utility commands x11vnc provides to create and manage many types of certificates and private keys. @@ -3032,11 +3054,11 @@ connect = 5900 need to have sufficient permissions to connect to the X display. Here are some ideas: - * Use the description under "Continuously" in the [372]FAQ on x11vnc + * Use the description under "Continuously" in the [379]FAQ on x11vnc and Display Managers - * Use the description in the [373]FAQ on x11vnc and inetd(1) + * Use the description in the [380]FAQ on x11vnc and inetd(1) * Start x11vnc from your $HOME/.xsession (or $HOME/.xinitrc) - * Although less reliable, see the [374]x11vnc_loop rc.local hack + * Although less reliable, see the [381]x11vnc_loop rc.local hack below. The display manager scheme will not be specific to which user has the @@ -3067,7 +3089,7 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg while running x11vnc as root, e.g. for the gnome display manager, gdm: x11vnc -auth /var/gdm/:0.Xauth -display :0 - (the [375]-auth option sets the XAUTHORITY variable for you). + (the [382]-auth option sets the XAUTHORITY variable for you). There will be a similar thing for xdm using however a different auth directory path (perhaps something like @@ -3092,7 +3114,7 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg auth file should be in /var/dt), you'll also need to add something like Dtlogin*grabServer:False to the Xconfig file (/etc/dt/config/Xconfig or /usr/dt/config/Xconfig on Solaris, see - [376]the example at the end of this FAQ). Then restart dtlogin, e.g.: + [383]the example at the end of this FAQ). Then restart dtlogin, e.g.: /etc/init.d/dtlogin stop; /etc/init.d/dtlogin start or reboot. Continuously. Have x11vnc reattach each time the X server is @@ -3155,7 +3177,7 @@ rever -bg Then restart: /usr/sbin/gdm-restart (or reboot). The KillInitClients=false setting is important: without it x11vnc will be - killed immediately after the user logs in. Here are [377]full details + killed immediately after the user logs in. Here are [384]full details on how to configure gdm _________________________________________________________________ @@ -3197,13 +3219,13 @@ rever -bg If you do not want to deal with any display manager startup scripts, here is a kludgey script that can be run manually or out of a boot - file like rc.local: [378]x11vnc_loop It will need some local + file like rc.local: [385]x11vnc_loop It will need some local customization before running. Because the XAUTHORITY auth file must be guessed by this script, use of the display manager script method described above is greatly preferred. If the machine is a traditional Xterminal you may want to read - [379]this FAQ. + [386]this FAQ. Q-50: Can I run x11vnc out of inetd(1)? How about xinetd(1)? @@ -3213,7 +3235,7 @@ rever -bg 5900 stream tcp nowait root /usr/sbin/tcpd /usr/local/bin/x11vnc_sh - where the shell script /usr/local/bin/x11vnc_sh uses the [380]-inetd + where the shell script /usr/local/bin/x11vnc_sh uses the [387]-inetd option and looks something like (you'll need to customize to your settings). #!/bin/sh @@ -3226,7 +3248,7 @@ rever -bg and that confuses it greatly, causing it to abort). If you do not use a wrapper script as above but rather call x11vnc directly in /etc/inetd.conf and do not redirect stderr to a file, then you must - specify the -q (aka [381]-quiet) option: "/usr/local/bin/x11vnc -q + specify the -q (aka [388]-quiet) option: "/usr/local/bin/x11vnc -q -inetd ...". When you supply both -q and -inet and no "-o logfile" then stderr will automatically be closed (to prevent, e.g. library stderr messages leaking out to the viewer). The recommended practice @@ -3234,7 +3256,7 @@ rever -bg script with "2>logfile" redirection because the errors and warnings printed out are very useful in troubleshooting problems. - Note also the need to set XAUTHORITY via [382]-auth to point to the + Note also the need to set XAUTHORITY via [389]-auth to point to the MIT-COOKIE auth file to get permission to connect to the X display (setting and exporting the XAUTHORITY variable accomplishes the same thing). See the x11vnc_loop file in the previous question for more @@ -3302,7 +3324,7 @@ service x11vncservice Q-51: Can I have x11vnc restart itself after it terminates? One could do this in a shell script, but now there is an option - [383]-loop that makes it easier. Of course when x11vnc restarts it + [390]-loop that makes it easier. Of course when x11vnc restarts it needs to have permissions to connect to the (potentially new) X display. This mode could be useful if the X server restarts often. Use e.g. "-loop5000" to sleep 5000 ms between restarts. Also "-loop2000,5" @@ -3313,7 +3335,7 @@ service x11vncservice web browser? To have x11vnc serve up a Java VNC viewer applet to any web browsers - that connect to it, run x11vnc with this [384]option: + that connect to it, run x11vnc with this [391]option: -httpdir /path/to/the/java/classes/dir (this directory will contain the files index.vnc and, for example, @@ -3332,7 +3354,7 @@ service x11vncservice then you can connect to that URL with any Java enabled browser. Feel free to customize the default index.vnc file in the classes directory. - As of May/2005 the [385]-http option will try to guess where the Java + As of May/2005 the [392]-http option will try to guess where the Java classes jar file is by looking a expected locations. Also note that if you wanted to, you could also start the Java viewer @@ -3346,7 +3368,7 @@ service x11vncservice As of Mar/2004 x11vnc supports reverse connections. On Unix one starts the VNC viewer in listen mode: vncviewer -listen (see your documentation for Windows, etc), and then starts up x11vnc with the - [386]-connect option. To connect immediately at x11vnc startup time + [393]-connect option. To connect immediately at x11vnc startup time use the "-connect host:port" option (use commas for a list of hosts to connect to). The ":port" is optional (default is 5500). @@ -3354,7 +3376,7 @@ service x11vncservice file is checked periodically (about once a second) for new hosts to connect to. - The [387]-remote control option (aka -R) can also be used to do this + The [394]-remote control option (aka -R) can also be used to do this during an active x11vnc session, e.g.: x11vnc -display :0 -R connect:hostname.domain @@ -3366,7 +3388,7 @@ x11vnc -display :0 -R connect:hostname.domain starting x11vnc. To use the vncconnect(1) program (from the core VNC package at - www.realvnc.com) specify the [388]-vncconnect option to x11vnc (Note: + www.realvnc.com) specify the [395]-vncconnect option to x11vnc (Note: as of Dec/2004 -vncconnect is now the default). vncconnect(1) must be pointed to the same X11 DISPLAY as x11vnc (since it uses X properties to communicate with x11vnc). If you do not have or do not want to get @@ -3411,7 +3433,7 @@ xprop -root -f VNC_CONNECT 8s -set VNC_CONNECT "$1" There are some annoyances WRT Xvfb though. The default keyboard mapping seems to be very poor. One should run x11vnc with - [389]-add_keysyms option to have keysyms added automatically. Also, to + [396]-add_keysyms option to have keysyms added automatically. Also, to add the Shift_R and Control_R modifiers something like this is needed: #!/bin/sh xmodmap -e "keycode any = Shift_R" @@ -3433,11 +3455,11 @@ xmodmap -e "add Control = Control_L Control_R" The main drawback to this method (besides requiring extra configuration and possibly root permission) is that it also does the - Linux Virtual Console/Terminal (VC/VT) [390]switching even though it + Linux Virtual Console/Terminal (VC/VT) [397]switching even though it does not need to (since it doesn't use a real framebuffer). There are some "dual headed" (actually multi-headed/multi-user) patches to the X server that turn off the VT usage in the X server. Update: As of - Jul/2005 we have an LD_PRELOAD script [391]Xdummy that allows you to + Jul/2005 we have an LD_PRELOAD script [398]Xdummy that allows you to use a stock (i.e. unpatched) Xorg or XFree86 server with the "dummy" driver and not have any VT switching problems! Currently Xdummy needs to be run as root, but with some luck that may be relaxed in the @@ -3469,7 +3491,7 @@ startx -- /path/to/Xdummy :1 An X server can be started on the headless machine (sometimes this requires configuring the X server to not fail if it cannot detect a keyboard or mouse, see the next paragraph). Then you can export that X - display via x11vnc (e.g. see [392]this FAQ) and access it from + display via x11vnc (e.g. see [399]this FAQ) and access it from anywhere on the network via a VNC viewer. Some tips on getting X servers to start on machines without keyboard @@ -3512,7 +3534,7 @@ startx -- /path/to/Xdummy :1 19/03/2004 10:10:58 error creating tile-row shm for len=4 19/03/2004 10:10:58 reverting to single_copytile mode - Here is a shell script [393]shm_clear to list and prompt for removal + Here is a shell script [400]shm_clear to list and prompt for removal of your unattached shm segments (attached ones are skipped). I use it while debugging x11vnc (I use "shm_clear -y" to assume "yes" for each prompt). If x11vnc is regularly not cleaning up its shm segments, @@ -3546,36 +3568,36 @@ ied) in /etc/system. See the next paragraph for more workarounds. To minimize the number of shm segments used by x11vnc try using the - [394]-onetile option (corresponds to only 3 shm segments used, and + [401]-onetile option (corresponds to only 3 shm segments used, and adding -fs 1.0 knocks it down to 2). If you are having much trouble with shm segments, consider disabling shm completely via the - [395]-noshm option. Performance will be somewhat degraded but when + [402]-noshm option. Performance will be somewhat degraded but when done over local machine sockets it should be acceptable (see an - [396]earlier question discussing -noshm). + [403]earlier question discussing -noshm). Q-57: How can I make x11vnc use less system resources? - The [397]-nap and "[398]-wait n" (where n is the sleep between polls + The [404]-nap and "[405]-wait n" (where n is the sleep between polls in milliseconds, the default is 30 or so) option are good places to start. Reducing the X server bits per pixel depth (e.g. to 16bpp or even 8bpp) will further decrease memory I/O and network I/O. The ShadowFB will make x11vnc's screen polling less severe. Using the - [399]-onetile option will use less memory and use fewer shared memory - slots (add [400]-fs 1.0 for one less slot). + [406]-onetile option will use less memory and use fewer shared memory + slots (add [407]-fs 1.0 for one less slot). Q-58: How can I make x11vnc use MORE system resources? - You can try [401]-threads and dial down the wait time (e.g. -wait 1) - and possibly dial down [402]-defer as well. Note that if you try to + You can try [408]-threads and dial down the wait time (e.g. -wait 1) + and possibly dial down [409]-defer as well. Note that if you try to increase the "frame rate" too much you can bog down the server end with the extra work it needs to do compressing the framebuffer data, etc. That said, it is possible to "stream" video via x11vnc if the video window is small enough. E.g. a 256x192 xawtv TV capture window (using - the x11vnc [403]-id option) can be streamed over a LAN or wireless at + the x11vnc [410]-id option) can be streamed over a LAN or wireless at a reasonable frame rate. @@ -3591,7 +3613,7 @@ ied) * Use a smaller desktop size (e.g. 1024x768 instead of 1280x1024) * Make sure the desktop background is a solid color (the background is resent every time it is re-exposed). Consider using the - [404]-solid [color] option to try to do this automatically. + [411]-solid [color] option to try to do this automatically. * Configure your window manager or desktop "theme" to not use fancy images, shading, and gradients for the window decorations, etc. Disable window animations, etc. Maybe your desktop has a "low @@ -3600,9 +3622,9 @@ ied) -> Use Smooth Scrolling (deselect it). * Avoid small scrolls of large windows using the Arrow keys or scrollbar. Try to use PageUp/PageDown instead. (not so much of a - problem in x11vnc 0.7.2 if [405]-scrollcopyrect is active and + problem in x11vnc 0.7.2 if [412]-scrollcopyrect is active and detecting scrolls for the application). - * If the [406]-wireframe option is not available (earlier than + * If the [413]-wireframe option is not available (earlier than x11vnc 0.7.2 or you have disabled it via -nowireframe) then Disable Opaque Moves and Resizes in the window manager/desktop. * However if -wireframe is active (on by default in x11vnc 0.7.2) @@ -3622,7 +3644,7 @@ ied) noticed. VNC viewer parameters: - * Use a [407]TightVNC enabled viewer! (Actually, RealVNC 4.x viewer + * Use a [414]TightVNC enabled viewer! (Actually, RealVNC 4.x viewer with ZRLE encoding is not too bad either; some claim it is faster). * Make sure the tight (or zrle) encoding is being used (look at @@ -3645,33 +3667,33 @@ ied) file. x11vnc parameters: - * Make sure the [408]-wireframe option is active (it should be on by + * Make sure the [415]-wireframe option is active (it should be on by default) and you have Opaque Moves/Resizes Enabled in the window manager. - * Make sure the [409]-scrollcopyrect option is active (it should be + * Make sure the [416]-scrollcopyrect option is active (it should be on by default). This detects scrolls in many (but not all) applications an applies the CopyRect encoding for a big speedup. - * Specify [410]-speeds modem to force the wireframe and + * Specify [417]-speeds modem to force the wireframe and scrollcopyrect heuristic parameters (and any future ones) to those of a dialup modem connection (or supply the rd,bw,lat numerical values that characterize your link). * If wireframe and scrollcopyrect aren't working, try using the more - drastic [411]-nodragging (no screen updates when dragging mouse, + drastic [418]-nodragging (no screen updates when dragging mouse, but sometimes you miss visual feedback) - * Set [412]-fs 1.0 (disables fullscreen updates) - * Try increasing [413]-wait or [414]-defer (reduces the maximum + * Set [419]-fs 1.0 (disables fullscreen updates) + * Try increasing [420]-wait or [421]-defer (reduces the maximum "frame rate", but won't help much for large screen changes) - * Try the [415]-progressive pixelheight mode with the block + * Try the [422]-progressive pixelheight mode with the block pixelheight 100 or so (delays sending vertical blocks since they may change while viewer is receiving earlier ones) - * If you just want to watch one (simple) window use [416]-id (cuts + * If you just want to watch one (simple) window use [423]-id (cuts down extraneous polling and updates, but can be buggy or insufficient) - * Set [417]-nosel (disables all clipboard selection exchange) - * Use [418]-nocursor and [419]-nocursorpos (repainting the remote + * Set [424]-nosel (disables all clipboard selection exchange) + * Use [425]-nocursor and [426]-nocursorpos (repainting the remote cursor position and shape takes resources and round trips) * On very slow links (e.g. <= 28.8) you may need to increase the - [420]-readtimeout n setting if it sometimes takes more than 20sec + [427]-readtimeout n setting if it sometimes takes more than 20sec to paint the full screen, etc. @@ -3693,7 +3715,7 @@ ied) Note that the DAMAGE extension does not speed up the actual reading of pixels from the video card framebuffer memory, by, say, mirroring them - in main memory. So reading the fb is still painfully [421]slow (e.g. + in main memory. So reading the fb is still painfully [428]slow (e.g. 5MB/sec), and so even using X DAMAGE when large changes occur on the screen the bulk of the time is still spent retrieving them. Not ideal, but use of the ShadowFB XFree86/Xorg option speeds up the reading @@ -3711,27 +3733,27 @@ ied) DAMAGE rectangles to contain real damage. The larger rectangles are only used as hints to focus the traditional scanline polling (i.e. if a scanline doesn't intersect a recent DAMAGE rectangle, the scan is - skipped). You can use the "[422]-xd_area A" option to adjust the size + skipped). You can use the "[429]-xd_area A" option to adjust the size of the trusted DAMAGE rectangles. The default is 20000 pixels (e.g. a 140x140 square, etc). Use "-xd_area 0" to disable the cutoff and trust all DAMAGE rectangles. - The option "[423]-xd_mem f" may also be of use in tuning the - algorithm. To disable using DAMAGE entirely use "[424]-noxdamage". + The option "[430]-xd_mem f" may also be of use in tuning the + algorithm. To disable using DAMAGE entirely use "[431]-noxdamage". Q-61: When I drag windows around with the mouse or scroll up and down things really bog down (unless I do the drag in a single, quick motion). Is there anything to do to improve things? - This problem is primarily due to [425]slow hardware read rates from + This problem is primarily due to [432]slow hardware read rates from video cards: as you scroll or move a large window around the screen changes are much too rapid for x11vnc to keep up them (it can usually only read the video card at about 5-10 MB/sec, so it can take a good fraction of a second to read the changes induce from moving a large window, if this to be done a number of times in succession the window or scroll appears to "lurch" forward). See the description in the - [426]-pointer_mode option for more info. The next bottleneck is + [433]-pointer_mode option for more info. The next bottleneck is compressing all of these changes and sending them out to connected viewers, however the VNC protocol is pretty much self-adapting with respect to that (updates are only packaged and sent when viewers ask @@ -3741,26 +3763,26 @@ ied) default should now be much better than before and dragging small windows around should no longer be a huge pain. If for some reason these changes make matters worse, you can go back to the old way via - the "[427]-pointer_mode 1" option. + the "[434]-pointer_mode 1" option. - Also added was the [428]-nodragging option that disables all screen + Also added was the [435]-nodragging option that disables all screen updates while dragging with the mouse (i.e. mouse motion with a button held down). This gives the snappiest response, but might be undesired in some circumstances when you want to see the visual feedback while dragging (e.g. menu traversal or text selection). - As of Dec/2004 the [429]-pointer_mode n option was introduced. n=1 is + As of Dec/2004 the [436]-pointer_mode n option was introduced. n=1 is the original mode, n=2 an improvement, etc.. See the -pointer_mode n help for more info. - Also, in some circumstances the [430]-threads option can improve + Also, in some circumstances the [437]-threads option can improve response considerably. Be forewarned that if more than one vncviewer is connected at the same time then libvncserver may not be thread safe (try to get the viewers to use different VNC encodings, e.g. tight and ZRLE). - As of Apr/2005 two new options (see the [431]wireframe FAQ and - [432]scrollcopyrect FAQ below) provide schemes to sweep this problem + As of Apr/2005 two new options (see the [438]wireframe FAQ and + [439]scrollcopyrect FAQ below) provide schemes to sweep this problem under the rug for window moves or resizes and for some (but not all) window scrolls. @@ -3776,8 +3798,8 @@ ied) the window move/resize stops, it returns to normal processing: you should only see the window appear in the new position. This spares you from interacting with a "lurching" window between all of the - intermediate steps. BTW the lurching is due to [433]slow video card - read rates (see [434]here too). A displacement, even a small one, of a + intermediate steps. BTW the lurching is due to [440]slow video card + read rates (see [441]here too). A displacement, even a small one, of a large window requires a non-negligible amount of time, a good fraction of a second, to read in from the hardware framebuffer. @@ -3785,7 +3807,7 @@ ied) for -wireframe to do any good. The mode is currently on by default because most people are inflicted - with the problem. It can be disabled with the [435]-nowireframe option + with the problem. It can be disabled with the [442]-nowireframe option (aka -nowf). Why might one want to turn off the wireframing? Since x11vnc is merely guessing when windows are being moved/resized, it may guess poorly for your window-manager or desktop, or even for the way @@ -3830,13 +3852,13 @@ ied) * Maximum time to show a wireframe animation. * Minimum time between sending wireframe outlines. - See the [436]"-wireframe tweaks" option for more details. On a slow + See the [443]"-wireframe tweaks" option for more details. On a slow link, e.g. dialup modem, the parameters may be automatically adjusted for better response. CopyRect encoding: In addition to the above there is the - [437]"-wirecopyrect mode" option. It is also on by default. This + [444]"-wirecopyrect mode" option. It is also on by default. This instructs x11vnc to not only show the wireframe animation, but to also instruct all connected VNC viewers to locally translate the window image data from the original position to the new position on the @@ -3884,7 +3906,7 @@ ied) requiring the image data to be transmitted over the network. For fast links the speedup is primarily due to x11vnc not having to read the scrolled framebuffer data from the X server (recall that reading from - the hardware framebuffer is [438]slow). + the hardware framebuffer is [445]slow). To do this x11vnc uses the RECORD X extension to snoop the X11 protocol between the X client with the focus window and the X server. @@ -3906,10 +3928,10 @@ ied) the X server display: if one falls too far behind it could become a mess... - The initial implementation of [439]-scrollcopyrect option is useful in + The initial implementation of [446]-scrollcopyrect option is useful in that it detects many scrolls and thus gives a much nicer working - environment (especially when combined with the [440]-wireframe - [441]-wirecopyrect [442]options, which are also on by default; and if + environment (especially when combined with the [447]-wireframe + [448]-wirecopyrect [449]options, which are also on by default; and if you are willing to enable the ShadowFB things are very fast). The fact that there aren't long delays or lurches during scrolling is the primary improvement. @@ -3942,10 +3964,10 @@ ied) One can tap the Alt_L key (Left "Alt" key) 3 times in a row to signal x11vnc to refresh the screen to all viewers. Your VNC-viewer may have its own screen refresh hot-key or button. See - also: [443]-fixscreen + also: [450]-fixscreen * Some applications, notably OpenOffice, do XCopyArea scrolls in weird ways that assume ancestor window clipping is taking place. - See the [444]-scr_skip option for ways to tweak this on a + See the [451]-scr_skip option for ways to tweak this on a per-application basis. * Selecting text while dragging the mouse may be slower, especially if the Button-down event happens near the window's edge. This is @@ -3962,7 +3984,7 @@ ied) because it fails to detect scrolls in it. Sometimes clicking inside the application window or selecting some text in it to force the focus helps. - * When using the [445]-scale option there will be a quick CopyRect + * When using the [452]-scale option there will be a quick CopyRect scroll, but it needs to be followed by a slower "cleanup" update. This is because for a fixed finite screen resolution (e.g. 75 dpi) scaling and copyrect-ing are not exactly independent. Scaling @@ -3975,7 +3997,7 @@ ied) If you find the -scrollcopyrect behavior too approximate or distracting you can go back to the standard polling-only update method - with the [446]-noscrollcopyrect (or -noscr for short). If you find + with the [453]-noscrollcopyrect (or -noscr for short). If you find some extremely bad and repeatable behavior for -scrollcopyrect please report a bug. @@ -4014,23 +4036,23 @@ ied) this is because the cursor shape is often downloaded to the graphics hardware (video card), but I could be mistaken. - A simple kludge is provided by the "[447]-cursor X" option that + A simple kludge is provided by the "[454]-cursor X" option that changes the cursor when the mouse is on the root background (or any window has the same cursor as the root background). Note that desktops like GNOME or KDE often cover up the root background, so this won't - work for those cases. Also see the "[448]-cursor some" option for + work for those cases. Also see the "[455]-cursor some" option for additional kludges. Note that as of Aug/2004 on Solaris using the SUN_OVL overlay extension and IRIX, x11vnc can show the correct mouse cursor when the - [449]-overlay option is supplied. See [450]this FAQ for more info. + [456]-overlay option is supplied. See [457]this FAQ for more info. Also as of Dec/2004 XFIXES X extension support has been added to allow exact extraction of the mouse cursor shape. XFIXES fixes the problem of the cursor-shape being write-only: x11vnc can now query the X server for the current shape and send it back to the connected viewers. XFIXES is available on recent Linux Xorg based distros and - [451]Solaris 10. + [458]Solaris 10. The only XFIXES issue is the handling of alpha channel transparency in cursors. If a cursor has any translucency then in general it must be @@ -4038,7 +4060,7 @@ ied) situations where the cursor transparency can also handled exactly: when the VNC Viewer requires the cursor shape be drawn into the VNC framebuffer or if you apply a patch to your VNC Viewer to extract - hidden alpha channel data under 32bpp. [452]Details can be found here. + hidden alpha channel data under 32bpp. [459]Details can be found here. Q-65: When using XFIXES cursorshape mode, some of the cursors look @@ -4071,17 +4093,17 @@ ied) for most cursor themes and you don't have to worry about it. In case it still looks bad for your cursor theme, there are (of - course!) some tunable parameters. The "[453]-alphacut n" option lets + course!) some tunable parameters. The "[460]-alphacut n" option lets you set the threshold "n" (between 0 and 255): cursor pixels with alpha values below n will be considered completely transparent while values equal to or above n will be completely opaque. The default is - 240. The "[454]-alphafrac f" option tries to correct individual + 240. The "[461]-alphafrac f" option tries to correct individual cursors that did not fare well with the default -alphacut value: if a cursor has less than fraction f (between 0.0 and 1.0) of its pixels selected by the default -alphacut, the threshold is lowered until f of its pixels are selected. The default fraction is 0.33. - Finally, there is an option [455]-alpharemove that is useful for + Finally, there is an option [462]-alpharemove that is useful for themes where many cursors are light colored (e.g. "whiteglass"). XFIXES returns the cursor data with the RGB values pre-multiplied by the alpha value. If the white cursors look too grey, specify @@ -4107,10 +4129,10 @@ ied) alpha channel data to libvncserver. However, this data will only be used for VNC clients that do not support the CursorShapeUpdates VNC extension (or have disabled it). It can be disabled for all clients - with the [456]-nocursorshape x11vnc option. In this case the cursor is + with the [463]-nocursorshape x11vnc option. In this case the cursor is drawn, correctly blended with the background, into the VNC framebuffer before being sent out to the client. So the alpha blending is done on - the x11vnc side. Use the [457]-noalphablend option to disable this + the x11vnc side. Use the [464]-noalphablend option to disable this behavior (always approximate transparent cursors with opaque RGB values). @@ -4139,9 +4161,9 @@ ied) Q-67: Why does the mouse arrow just stay in one corner in my vncviewer, whereas my cursor (that does move) is just a dot? - This default takes advantage of a [458]tightvnc extension + This default takes advantage of a [465]tightvnc extension (CursorShapeUpdates) that allows specifying a cursor image shape for - the local VNC viewer. You may disable it with the [459]-nocursor + the local VNC viewer. You may disable it with the [466]-nocursor option to x11vnc if your viewer does not have this extension. Note: as of Aug/2004 this should be fixed: the default for @@ -4155,17 +4177,17 @@ ied) clients (i.e. passive viewers can see the mouse cursor being moved around by another viewer)? - Use the [460]-cursorpos option when starting x11vnc. A VNC viewer must + Use the [467]-cursorpos option when starting x11vnc. A VNC viewer must support the Cursor Positions Updates for the user to see the mouse motions (the TightVNC viewers support this). As of Aug/2004 -cursorpos - is the default. See also [461]-nocursorpos and [462]-nocursorshape. + is the default. See also [468]-nocursorpos and [469]-nocursorshape. Q-69: Is it possible to swap the mouse buttons (e.g. left-handed operation), or arbitrarily remap them? How about mapping button clicks to keystrokes, e.g. to partially emulate Mouse wheel scrolling? - You can remap the mouse buttons via something like: [463]-buttonmap + You can remap the mouse buttons via something like: [470]-buttonmap 13-31 (or perhaps 12-21). Also, note that xmodmap(1) lets you directly adjust the X server's button mappings, but in some circumstances it might be more desirable to have x11vnc do it. @@ -4173,7 +4195,7 @@ ied) One user had an X server with only one mouse button(!) and was able to map all of the VNC client mouse buttons to it via: -buttonmap 123-111. - Note that the [464]-debug_pointer option prints out much info for + Note that the [471]-debug_pointer option prints out much info for every mouse/pointer event and is handy in solving problems. To map mouse button clicks to keystrokes you can use the alternate @@ -4195,7 +4217,7 @@ ied) Exactly what keystroke "scrolling" events they should be bound to depends on one's taste. If this method is too approximate, one could - consider not using [465]-buttonmap but rather configuring the X server + consider not using [472]-buttonmap but rather configuring the X server to think it has a mouse with 5 buttons even though the physical mouse does not. (e.g. 'Option "ZAxisMapping" "4 5"'). @@ -4225,7 +4247,7 @@ ied) Q-70: How can I get my AltGr and Shift modifiers to work between keyboards for different languages? - The option [466]-modtweak should help here. It is a mode that monitors + The option [473]-modtweak should help here. It is a mode that monitors the state of the Shift and AltGr Modifiers and tries to deduce the correct keycode to send, possibly by sending fake modifier key presses and releases in addition to the actual keystroke. @@ -4234,16 +4256,16 @@ ied) to get the old behavior). This was done because it was noticed on newer XFree86 setups even on bland "us" keyboards like "pc104 us" XFree86 included a "ghost" key with both "<" and ">" it. This key does - not exist on the keyboard (see [467]this FAQ for more info). Without + not exist on the keyboard (see [474]this FAQ for more info). Without -modtweak there was then an ambiguity in the reverse map keysym => keycode, making it so the "<" symbol could not be typed. - Also see the [468]FAQ about the -xkb option for a more powerful method + Also see the [475]FAQ about the -xkb option for a more powerful method of modifier tweaking for use on X servers with the XKEYBOARD extension. When trying to resolve keyboard mapping problems, note that the - [469]-debug_keyboard option prints out much info for every keystroke + [476]-debug_keyboard option prints out much info for every keystroke and so can be useful debugging things. @@ -4255,9 +4277,9 @@ ied) (e.g. pc105 in the XF86Config file when it should be something else, say pc104). - Short Cut: Try the [470]-xkb or [471]-sloppy_keys options and see if + Short Cut: Try the [477]-xkb or [478]-sloppy_keys options and see if that helps the situation. The discussion below is a bit outdated (e.g. - [472]-modtweak is now the default) but is useful reference for various + [479]-modtweak is now the default) but is useful reference for various tricks and so is kept. @@ -4300,17 +4322,17 @@ ied) -remap less-comma These are convenient in that they do not modify the actual X server - settings. The former ([473]-modtweak) is a mode that monitors the + settings. The former ([480]-modtweak) is a mode that monitors the state of the Shift and AltGr modifiers and tries to deduce the correct keycode sequence to send. Since Jul/2004 -modtweak is now the default. - The latter ([474]-remap less-comma) is an immediate remapping of the + The latter ([481]-remap less-comma) is an immediate remapping of the keysym less to the keysym comma when it comes in from a client (so when Shift is down the comma press will yield "<"). - See also the [475]FAQ about the -xkb option as a possible workaround + See also the [482]FAQ about the -xkb option as a possible workaround using the XKEYBOARD extension. - Note that the [476]-debug_keyboard option prints out much info for + Note that the [483]-debug_keyboard option prints out much info for every keystroke to aid debugging keyboard problems. @@ -4318,13 +4340,13 @@ ied) (i.e. an extra comma). This is likely because you press "Shift" then "<" but then released - the Shift key before releasing the "<". Because of a [477]keymapping + the Shift key before releasing the "<". Because of a [484]keymapping ambiguity the last event "< up" is interpreted as "," because that key unshifted is the comma. - This should not happen in [478]-xkb mode, because it works hard to + This should not happen in [485]-xkb mode, because it works hard to resolve the ambiguities. If you do not want to use -xkb, try the - option [479]-sloppy_keys to attempt a similar type of algorithm. + option [486]-sloppy_keys to attempt a similar type of algorithm. Q-73: I'm using an "international" keyboard (e.g. German "de", or @@ -4348,7 +4370,7 @@ ied) In both cases no AltGr is sent to the VNC server, but we know AltGr is needed on the physical international keyboard to type a "@". - This all worked fine with x11vnc running with the [480]-modtweak + This all worked fine with x11vnc running with the [487]-modtweak option (it figures out how to adjust the Modifier keys (Shift or AltGr) to get the "@"). However it fails under recent versions of XFree86 (and the X.org fork). These run the XKEYBOARD extension by @@ -4365,7 +4387,7 @@ ied) * there is a new option -xkb to use the XKEYBOARD extension API to do the Modifier key tweaking. - The [481]-xkb option seems to fix all of the missing keys: "@", "<", + The [488]-xkb option seems to fix all of the missing keys: "@", "<", ">", etc.: it is recommended that you try it if you have this sort of problem. Let us know if there are any remaining problems (see the next paragraph for some known problems). If you specify the -debug_keyboard @@ -4373,7 +4395,7 @@ ied) debugging output (send it along with any problems you report). Update: as of Jun/2005 x11vnc will try to automatically enable - [482]-xkb if it appears that would be beneficial (e.g. if it sees any + [489]-xkb if it appears that would be beneficial (e.g. if it sees any of "@", "<", ">", "[" and similar keys are mapped in a way that needs the -xkb to access them). To disable this automatic check use -noxkb. @@ -4388,7 +4410,7 @@ ied) was attached to keycode 93 (no physical key generates this keycode) while ISO_Level3_Shift was attached to keycode 113. The keycode skipping option was used to disable the ghost key: - [483]-skip_keycodes 93 + [490]-skip_keycodes 93 * In implementing -xkb we noticed that some characters were still not getting through, e.g. "~" and "^". This is not really an XKEYBOARD problem. What was happening was the VNC viewer was @@ -4405,16 +4427,16 @@ ied) What to do? In general the VNC protocol has not really solved this problem: what should be done if the VNC viewer sends a keysym not recognized by the VNC server side? Workarounds can possibly be - created using the [484]-remap x11vnc option: + created using the [491]-remap x11vnc option: -remap asciitilde-dead_tilde,asciicircum-dead_circumflex etc. Use -remap filename if the list is long. Please send us your workarounds for this problem on your keyboard. Perhaps we can have x11vnc adjust automatically at some point. Also see the - [485]-add_keysyms option in the next paragraph. - Update: for convenience "[486]-remap DEAD" does many of these + [492]-add_keysyms option in the next paragraph. + Update: for convenience "[493]-remap DEAD" does many of these mappings at once. - * To complement the above workaround using the [487]-remap, an - option [488]-add_keysyms was added. This option instructs x11vnc + * To complement the above workaround using the [494]-remap, an + option [495]-add_keysyms was added. This option instructs x11vnc to bind any unknown Keysyms coming in from VNC viewers to unused Keycodes in the X server. This modifies the global state of the X server. When x11vnc exits it removes the extra keymappings it @@ -4433,7 +4455,7 @@ ied) Short answer: disable key autorepeating by running the command "xset r off" on the Xserver where x11vnc is run (restore via "xset r on") or - use the new (Jul/2004) [489]-norepeat x11vnc option. You will still + use the new (Jul/2004) [496]-norepeat x11vnc option. You will still have autorepeating because that is taken care of on your VNC viewer side. @@ -4457,7 +4479,7 @@ ied) off", does the problem go away? The workaround is to manually apply "xset r off" and "xset r on" as - needed, or to use the [490]-norepeat (which has since Dec/2004 been + needed, or to use the [497]-norepeat (which has since Dec/2004 been made the default). Note that with X server autorepeat turned off the VNC viewer side of the connection will (nearly always) do its own autorepeating so there is no big loss here, unless someone is also @@ -4468,7 +4490,7 @@ ied) keystrokes!! Are you using x11vnc to log in to an X session? (as described in - [491]this FAQ) If so, x11vnc is starting before your session and it + [498]this FAQ) If so, x11vnc is starting before your session and it disables autorepeat when you connect, but then after you log in your session startup (GNOME, KDE, ...) could be resetting the autorepeat to be on. Or it could be something inside your desktop trying to be @@ -4492,7 +4514,7 @@ ied) machine where I run the VNC viewer does not. Is there a way I can map a local unused key to send an AltGr? How about a Compose key as well? - Something like "[492]-remap Super_R-Mode_switch" x11vnc option may + Something like "[499]-remap Super_R-Mode_switch" x11vnc option may work. Note that Super_R is the "Right Windoze(tm) Flaggie" key; you may want to choose another. The -debug_keyboard option comes in handy in finding keysym names (so does xev(1)). @@ -4515,7 +4537,7 @@ ied) Since xmodmap(1) modifies the X server mappings you may not want to do this (because it affects local work on that machine). Something like - the [493]-remap Alt_L-Meta_L to x11vnc may be sufficient for ones + the [500]-remap Alt_L-Meta_L to x11vnc may be sufficient for ones needs, and does not modify the X server environment. Note that you cannot send Alt_L in this case, maybe -remap Super_L-Meta_L would be a better choice if the Super_L key is typically unused in Unix. @@ -4526,7 +4548,7 @@ ied) This can be done directly in some X servers using AccessX and Pointer_EnableKeys, but is a bit awkward. It may be more convenient to - have x11vnc do the remapping. This can be done via the [494]-remap + have x11vnc do the remapping. This can be done via the [501]-remap option using the fake "keysyms" Button1, Button2, etc. as the "to" keys (i.e. the ones after the "-") @@ -4535,7 +4557,7 @@ ied) button "paste" because (using XFree86/Xorg Emulate3Buttons) you have to click both buttons on the touch pad at the same time. This remapping: - [495]-remap Super_R-Button2 + [502]-remap Super_R-Button2 maps the Super_R "flag" key press to the Button2 click, thereby making X pasting a bit easier. @@ -4565,7 +4587,7 @@ ied) There may also be scaling viewers out there (e.g. TightVNC or UltraVNC on Windows) that automatically shrink or expand the remote framebuffer to fit the local display. Especially for hand-held devices. See also - [496]this FAQ on x11vnc scaling. + [503]this FAQ on x11vnc scaling. Q-80: Does x11vnc support server-side framebuffer scaling? (E.g. to @@ -4573,7 +4595,7 @@ ied) As of Jun/2004 x11vnc provides basic server-side scaling. It is a global scaling of the desktop, not a per-client setting. To enable it - use the "[497]-scale fraction" option. "fraction" can either be a + use the "[504]-scale fraction" option. "fraction" can either be a floating point number (e.g. -scale 0.5) or the alternative m/n fraction notation (e.g. -scale 2/3). Note that if fraction is greater than one the display is magnified. @@ -4594,7 +4616,7 @@ ied) One can also use the ":nb" with an integer scale factor (say "-scale 2:nb") to use x11vnc as a screen magnifier for vision impaired - [498]applications. Since with integer scale factors the framebuffers + [505]applications. Since with integer scale factors the framebuffers become huge and scaling operations time consuming, be sure to use ":nb" for the fastest response. @@ -4620,12 +4642,12 @@ ied) If one desires per-client scaling for something like 1:1 from a workstation and 1:2 from a smaller device (e.g. handheld), currently the only option is to run two (or more) x11vnc processes with - different scalings listening on separate ports ([499]-rfbport option, + different scalings listening on separate ports ([506]-rfbport option, etc.). BTW, whenever you run two or more x11vnc's on the same X display and - use the [500]GUI, then to avoid all of the x11vnc's simultaneously - answering the gui you will need to use something like [501]"-connect + use the [507]GUI, then to avoid all of the x11vnc's simultaneously + answering the gui you will need to use something like [508]"-connect file1 -gui ..." with different connect files for each x11vnc you want to control via the gui (or remote-control). The "-connect file1" usage gives separate communication channels between a x11vnc proces and the @@ -4634,7 +4656,7 @@ ied) Update: As of Mar/2005 x11vnc now scales the mouse cursor with the same scale factor as the screen. If you don't want that, use the - [502]"-scale_cursor frac" option to set the cursor scaling to a + [509]"-scale_cursor frac" option to set the cursor scaling to a different factor (e.g. use "-scale_cursor 1" to keep the cursor at its natural unscaled size). @@ -4656,16 +4678,16 @@ ied) screen is not rectangular (e.g. 1280x1024 and 1024x768 monitors joined together), then there will be "non-existent" areas on the screen. The X server will return "garbage" image data for these areas and so they - may be distracting to the viewer. The [503]-blackout x11vnc option + may be distracting to the viewer. The [510]-blackout x11vnc option allows you to blacken-out rectangles by manually specifying their WxH+X+Y geometries. If your system has the libXinerama library, the - [504]-xinerama x11vnc option can be used to have it automatically + [511]-xinerama x11vnc option can be used to have it automatically determine the rectangles to be blackened out. (Note on 8bpp PseudoColor displays the fill color may not be black). Some users have reported that the mouse does not behave properly for their Xinerama display: i.e. the mouse cannot be moved to all regions - of the large display. If this happens try using the [505]-xwarppointer + of the large display. If this happens try using the [512]-xwarppointer option. This instructs x11vnc to fake mouse pointer motions using the XWarpPointer function instead of the XTestFakeMotionEvent XTEST function. (This may be due to a bug in the X server for XTEST when @@ -4690,23 +4712,23 @@ ied) Note: if you are running on Solaris 8 or earlier you can easily hit up against the maximum of 6 shm segments per process (for Xsun in this case) from running multiple x11vnc processes. You should modify - /etc/system as mentioned in another [506]FAQ to increase the limit. It - is probably also a good idea to run with the [507]-onetile option in + /etc/system as mentioned in another [513]FAQ to increase the limit. It + is probably also a good idea to run with the [514]-onetile option in this case (to limit each x11vnc to 3 shm segments), or even - [508]-noshm to use no shm segments. + [515]-noshm to use no shm segments. Q-83: Can x11vnc show only a portion of the display? (E.g. for a special purpose rfb application). - As of Mar/2005 x11vnc has the "[509]-clip WxH+X+Y" option to select a + As of Mar/2005 x11vnc has the "[516]-clip WxH+X+Y" option to select a rectangle of width W, height H and offset (X, Y). Thus the VNC screen will be the clipped sub-region of the display and be only WxH in size. - One user used -clip to split up a large [510]Xinerama screen into two + One user used -clip to split up a large [517]Xinerama screen into two more managable smaller screens. This also works to view a sub-region of a single application window if - the [511]-id or [512]-sid options are used. The offset is measured + the [518]-id or [519]-sid options are used. The offset is measured from the upper left corner of the selected window. @@ -4715,7 +4737,7 @@ ied) crash. As of Dec/2004 x11vnc supports XRANDR. You enable it with the - [513]-xrandr option to make x11vnc monitor XRANDR events and also trap + [520]-xrandr option to make x11vnc monitor XRANDR events and also trap X server errors if the screen change occurred in the middle of an X call like XGetImage. Once it traps the screen change it will create a new framebuffer using the new screen. @@ -4725,7 +4747,7 @@ ied) then the viewer will automatically resize. Otherwise, the new framebuffer is fit as best as possible into the original viewer size (portions of the screen may be clipped, unused, etc). For these - viewers you can try the [514]-padgeom option to make the region big + viewers you can try the [521]-padgeom option to make the region big enough to hold all resizes and rotations. If you specify "-xrandr newfbsize" then vnc viewers that do not @@ -4780,9 +4802,9 @@ ied) * Fullscreen mode The way VMWare does Fullscreen mode on Linux is to display the Guest - desktop in a separate Virtual Console (e.g. VC 8) (see [515]this FAQ + desktop in a separate Virtual Console (e.g. VC 8) (see [522]this FAQ on VC's for background). Unfortunately, this Fullscreen VC is not an X - server. So x11vnc cannot access it (however, [516]see this for a + server. So x11vnc cannot access it (however, [523]see this for a possible partial workaround). x11vnc works fine with "Normal X application window" and "Quick-Switch mode" because these use X. @@ -4799,13 +4821,13 @@ ied) response. One can also cut the display depth (e.g. to 16bpp) in this 2nd X session to improve video performance. This 2nd X session emulates Fullscreen mode to some degree and can be viewed via x11vnc - as long as the VMWare X session [517]is in the active VC. + as long as the VMWare X session [524]is in the active VC. Also note that with a little bit of playing with "xwininfo -all -children" output one can extract the (non-toplevel) windowid of the of the Guest desktop only when VMWare is running as a normal X application. Then one can export just the guest desktop (i.e. without - the VMWare menu buttons) by use of the [518]-id windowid option. The + the VMWare menu buttons) by use of the [525]-id windowid option. The caveats are the X session VMWare is in must be in the active VC and the window must be fully visible, so this mode is not terribly convenient, but could be useful in some circumstances (e.g. running @@ -4814,8 +4836,8 @@ ied) mouse)). - Q-88: Can non-X devices (e.g. a raw framebuffer) be viewed and/or - controlled by x11vnc? + Q-88: Can non-X devices (e.g. a raw framebuffer) be viewed (and even + controlled) with VNC via x11vnc? As of Apr/2005 there is rudimentary support for this. Two options were added: "-rawfb string" (to indicate the raw framembuffer and its @@ -4823,8 +4845,8 @@ ied) will inject or otherwise process mouse and keystroke input). This non-X mode for x11vnc is experimental because it is so removed in - scope from the intended usage of the tool. Little attempt is made to - make all of the other options consistent with non-X framebuffer + scope from the intended usage of the tool. Incomplete attempt is made + to make all of the other options consistent with non-X framebuffer polling. So all of the X-related options (e.g. -add_keysyms, -xkb) are just ignored or in the worst case will cause a crash. Be careful applying such an option via the command line or remote control. @@ -4841,12 +4863,18 @@ ied) -rawfb file:/tmp/my.pnm@250x200x24+37 + -rawfb file:/dev/urandom@128x128x8 + + -rawfb snap:/dev/video0@320x240x24 -24to32 + So the type can be "shm" for shared memory objects, and "map" or "file" for file objects. "map" uses mmap(2) to map the file into memory and is preferred over "file" (that uses the slower lseek(2) access method). Only use file if map isn't working. BTW, "mmap" is an alias for "map" and if you do not supply a type and the file exists, - map is assumed. + map is assumed. The "snap:" setting applies the [526]-snapfb option + with "file:" type reading (this is useful for exporting webcams or tv + tuner video; see [527]the next FAQ for more info). Also, if the string is of the form "setup:cmd" then cmd is run and the first line of its output retrieved and used as the rawfb string. This @@ -4857,7 +4885,8 @@ ied) segment and periodically updates it with new framebuffer data. x11vnc polls the area for changes. See shmat(2) and ipcs(8) for more info. The ipcs command will list current shared memory segments on the - system. + system. Sometimes you can snoop on a program's framebuffer it did not + expect you would be polling. The object will be the path to the regular or character special file for the cases of map and file. The idea here is that in the case of a @@ -4865,7 +4894,7 @@ ied) data to it. In the case of a character special (e.g. /dev/fb0) it is the kernel that is "updating" the framebuffer data. - In all cases x11vnc needs to be told the width, height, and number of + In most cases x11vnc needs to be told the width, height, and number of bits per pixel (bpp) of the framebuffer. This is the @WxHxB field. For the case of the Linux framebuffer device, /dev/fb0, the fbset(8) may be of use (but may not always be accurate for what is currently @@ -4885,28 +4914,29 @@ ied) screen to either shm or a mapped file. The format of these is XWD and so the initial header should be skipped. BTW, since XWD is not strictly RGB the view will only be approximate. Of course for the case - of Xvfb x11vnc can poll it much better via the [519]X API, but you get + of Xvfb x11vnc can poll it much better via the [528]X API, but you get the idea. By default in -rawfb mode x11vnc will actually close any X display it happened to open. This is basically to shake out bugs (e.g it will crash rather than mysteriously interacting with the X display). If you want x11vnc to keep the X display open while polling the raw - framebuffer capitalize the type (i.e. "SHM:", "MAP:", or "FILE:"). - This could be convenient for keeping the remote control channel active - (it uses X properties). The "-connect /path/to/file" mechanism could - also be used for remote control to avoid the X property channel. Rare - usage, but if you also supply -noviewonly in this mode then the mouse - and keyboard input are still sent to the X display, presumably for - doing something strange with /dev/fb... + framebuffer prefix a "+" sign at the beginning of the string (e.g. + +file:/dev/urandom@64x64x8) This could be convenient for keeping the + remote control channel active (it uses X properties). The "-connect + /path/to/file" mechanism could also be used for remote control to + avoid the X property channel. Rare usage, but if you also supply + -noviewonly in this "+" mode then the mouse and keyboard input are + still sent to the X display, presumably for doing something strange + with /dev/fb... All of the above was just for viewing the raw framebuffer. That may be - enough for certain applications of this feature (e.g. suppose a video - camera mapped its framebuffer into memory). To handle the pointer and - keyboard input from the viewer users the "-pipeinput cmd" option was - added to indicate a helper program to process the user input. The - input is streamed to it and looks something like this: + enough for certain applications of this feature (e.g. suppose a + [529]video camera mapped its framebuffer into memory). To handle the + pointer and keyboard input from the viewer users the "-pipeinput cmd" + option was added to indicate a helper program to process the user + input. The input is streamed to it and looks something like this: Pointer 1 205 257 0 None Pointer 1 198 253 0 None Pointer 1 198 253 1 ButtonPress-1 @@ -4938,7 +4968,7 @@ ied) keystrokes into the Linux console (e.g. the virtual consoles: /dev/tty1, /dev/tty2, etc) in x11vnc/misc/vcinject.pl. It is based on the vncterm/LinuxVNC.c program also in the libvncserver CVS. So to - view and interact with VC #2 (assuming it is the [520]active VC) one + view and interact with VC #2 (assuming it is the [530]active VC) one can run something like: x11vnc -rawfb map:/dev/fb0@1024x768x16 -pipeinput './vcinject.pl 2' @@ -4946,12 +4976,40 @@ ied) configured. See fbset(8) and other documentation. Try "file:/dev/fb0@WxHxB" as a last resort. + Starting with x11vnc 0.8.1, the above vc injection is built in, as + well as WxHxB determination. Just use something like: + x11vnc -rawfb cons + + This will try to guess the active virtual console (via /dev/tty0) and + also the /dev/fb0 WxHxB and rgb masks automatically. Use, e.g., + "-rawfb cons3" to force the VT number. Here is the -help output for + this mode: + + If the rawfb string begins with "cons" the framebuffer device + /dev/fb0 is opened (this requires the appropriate kernel modules) + and so is /dev/tty0. The latter is used to inject keystrokes (not + all are supported, but the basic ones are). You will need to be + root to inject keystrokes. /dev/tty0 refers to the active VT, to + indicate one explicitly, use "cons2", etc. using the VT number. + Note you can change VT remotely using the chvt(1) command. + Sometimes switching out and back corrects the framebuffer. To skip + injecting entirely use "consx". + + The strings "console", or "/dev/fb0" can be used instead of "cons". + The latter can be used to specify a different framebuffer device, + e.g. /dev/fb1. If the name is something nonstandard, use + "cons:/dev/foofb" + + If you do not want x11vnc to guess the framebuffer's WxHxB and + masks automatically, specify them with a @WxHxB at the end of the + string. + The above is just an example of what can be done. If you really want to view and interact with the Linux console it is better to use the more accurate and faster LinuxVNC program. The only advantage x11vnc -rawfb might have is that it can presumably allow interaction with a non-text application, e.g. one based on svgalib. For example the - [521]VMWare Fullscreen mode is actually viewable under -rawfb. But + [531]VMWare Fullscreen mode is actually viewable under -rawfb. But this isn't much use until one figures out how to inject keystrokes and mouse events... @@ -4962,7 +5020,147 @@ ied) program that passes the framebuffer to libvncserver. - Q-89: I am using x11vnc where my local machine has "popup/hidden + Q-89: Can I export via VNC a Webcam or TV tuner framebuffer using + x11vnc? + + Yes, this is possible to some degree with the [532]-rawfb option. + There is no X11 involved: snapshots from the video capture device are + used for the screen image data. See the [533]previous FAQ on -rawfb + for background. For best results, use x11vnc version 0.8.1 or later. + + Roughly, one would do something like this: + x11vnc -rawfb snap:/dev/video@320x240x32 + + This requires that the system allows simple read(2) access to the + video device. This is true for video4Linux on Linux kernel 2.6 and + later (it won't work for 2.4, you'll need a separate program to + snapshot to a file that you point -rawfb to; ask me if it is not clear + what to do). + + The "snap:" enforces [534]-snapfb mode which appears to be necessary. + The read pointer for video capture devices cannot be repositioned + (which would be needed for scanline polling), but you can read a full + frame of data from the device. + + On Linux, if the Video4Linux API is present or the v4l-info(1) program + (related to xawtv) exists in in PATH, then x11vnc can be instructed to + try it to determine the -rawfb WxHxB parameters for you automatically. + In this case one would just type: + x11vnc -rawfb video + + or "-rawfb video1" for the 2nd video device, etc. + + x11vnc has also been extended to use the Video4Linux API over v4l-info + if it is available at build time. This enables setting parameters + (e.g. size and brightness) via x11vnc. See the description below. + Without Video4Linux you will need to initialize the settings of the + video device using something like xawtv or spcaview (and then hope the + settings persist until x11vnc reopens the device). + + Many video4linux drivers tend to set the framebuffer to be 24bpp (as + opposed to 32bpp). Since this can cause problems with VNC viewers, + etc, the [535]-24to32 option will be automatically imposed when in + 24bpp. + + Note that by its very nature, video capture involves rapid change in + the framebuffer. This is especially true for cameras where slight + wavering in brightness is always happening. This can lead to much + network bandwidth consumption for the VNC traffic and also local CPU + and I/O resource usage. You may want to experiment with "dialing down" + the framerate via the [536]-wait, [537]-slow_fb, or [538]-defer + options. Decreasing the window size and bpp also helps. + + + Setting Camera/Tuner parameters via x11vnc: + + There is also some support for setting parameters of the capture + device. This is done via "-rawfb video:<settings>". This could be + useful for unattended startup at boottime, etc. Here is the -help + description: + + A more sophisticated video device scheme allows initializing the + device's settings using: + + -rawfb video:<settings> + + The prefix could also be, as above, e.g. "video1:" to specify the + device file. The v4l API must be available for this to work. + Otherwise, you will need to try to initialize the device with an + external program, e.g. xawtv, spcaview, and hope they persist when + x11vnc re-opens the device. + + <settings> is a comma separated list of key=value pairs. The + device's brightness, color, contrast, and hue can be set to + percentages, e.g. br=80,co=50,cn=44,hu=60. + + The device filename can be set too if needed (if it does not start + with "video"), e.g. fn=/dev/qcam. + + The width, height and bpp of the framebuffer can be set via, e.g., + w=160,h=120,bpp=16. + + Related to the bpp above, the pixel format can be set via the + fmt=XXX, where XXX can be one of: GREY, HI240, RGB555, RGB565, + RGB24, and RGB32 (with bpp 8, 8, 16, 16, 24, and 32 respectively). + See http://www.linuxtv.org for more info (V4L api). + + For tv/rf tuner cards one can set the tuning mode via tun=XXX where + XXX can be one of PAL, NTSC, SECAM, or AUTO. + + One can switch the input channel by the inp=XXX setting, where XXX + is the name of the input channel (Television, Composite1, S-Video, + etc). Use the name that is in the information about the device that + is printed at startup. + + For input channels with tuners (e.g. Television) one can change + which station is selected by the sta=XXX setting. XXX is the + station number. Currently only the ntsc-cable-us (US cable) + channels are built into x11vnc. See the -freqtab option below to + supply one from xawtv. If XXX is greater than 500, then it is + interpreted as a raw frequency in KHz. + + Example: + + -rawfb video:br=80,w=320,h=240,fmt=RGB32,tun=NTSC,sta=47 + + one might need to add inp=Television too for the input channel to + be TV if the card doesn't come up by default in that one. + + Note that not all video capture devices will support all of the + above settings. + + See the -pipeinput VID option below for a way to control the + settings through the VNC Viewer via keystrokes. + + As above, if you specify a "@WxHxB..." after the <settings> string + they are used verbatim: the device is not queried for the current + values. Otherwise the device will be queried. + + Also, if you supply the "-pipeinput VID" option you can control the + settings to some degree via keystroke mappings, e.g. B to increase the + brightness or Up arrow to change the TV station: + + For "-pipeinput VID" and you are using the -rawfb for a video + capture device, then an internal list of keyboard mappings is used + to set parameters of the video. The mappings are: + + "B" and "b" adjust the brightness up and down. + "H" and "h" adjust the hue. + "C" and "c" adjust the colour. + "N" and "n" adjust the contrast. + "S" and "s" adjust the size of the capture screen. + "I" and "i" cycle through input channels. + Up and Down arrows adjust the station (if a tuner) + F1, F2, ..., F6 will switch the video capture pixel + format to HI240, RGB565, RGB24, RGB32, RGB555, and + GREY respectively. See -rawfb video for details. + + See also the [539]-freqtab option to supply your own xawtv channel to + frequency mappings for your country (only ntsc-cable-us is built into + x11vnc). + + + Q-90: I am using x11vnc where my local machine has "popup/hidden taskbars" (e.g. GNOME or MacOS X) and the remote display where x11vnc runs also has "popup/hidden taskbars" (e.g. GNOME). When I move the mouse to the edge of the screen where the popups happen, the taskbars @@ -4977,30 +5175,30 @@ ied) [Misc: Clipboard, File Transfer, Beeps, Thanks, etc.] - Q-90: Does the Clipboard/Selection get transferred between the + Q-91: Does the Clipboard/Selection get transferred between the vncviewer and the X display? As of Jan/2004 x11vnc supports the "CutText" part of the rfb protocol. Furthermore, x11vnc is able to hold the PRIMARY selection (Xvnc does not seem to do this). If you don't want the Clipboard/Selection - exchanged use the [522]-nosel option. If you don't want the PRIMARY - selection to be polled for changes use the [523]-noprimary option. You - can also fine-tune it a bit with the [524]-seldir dir option. + exchanged use the [540]-nosel option. If you don't want the PRIMARY + selection to be polled for changes use the [541]-noprimary option. You + can also fine-tune it a bit with the [542]-seldir dir option. You may need to watch out for desktop utilities such as KDE's "Klipper" that do odd things with the selection, clipboard, and cutbuffers. - Q-91: Can I transfer files back and forth with x11vnc? + Q-92: Can I transfer files back and forth with x11vnc? As of Oct/2005 x11vnc enables the TightVNC file transfer implementation that was added to libvncserver. This currently only works with TightVNC viewers (and Windows only it appears). It is on by - default, to disable it use the [525]-nofilexfer option. + default, to disable it use the [543]-nofilexfer option. - Q-92: Why don't I hear the "Beeps" in my X session (e.g. when typing + Q-93: Why don't I hear the "Beeps" in my X session (e.g. when typing tput bel in an xterm)? As of Dec/2003 "Beep" XBell events are tracked by default. The X @@ -5008,7 +5206,7 @@ ied) in Solaris, see Xserver(1) for how to turn it on via +kb), and so you won't hear them if the extension is not present. - If you don't want to hear the beeps use the [526]-nobell option. If + If you don't want to hear the beeps use the [544]-nobell option. If you want to hear the audio from the remote applications, consider trying a redirector such as esd. @@ -5017,7 +5215,7 @@ ied) Contributions: - Q-93: Thanks for your program and for your help! Can I make a + Q-94: Thanks for your program and for your help! Can I make a donation? Please do (any amount is appreciated) and thank you for your support! @@ -5033,526 +5231,544 @@ References 4. http://www.karlrunge.com/x11vnc/index.html#beta-test 5. http://www.karlrunge.com/x11vnc/index.html#faq-thanks 6. http://www.karlrunge.com/x11vnc/index.html#faq-thanks - 7. http://www.karlrunge.com/x11vnc/index.html#faq - 8. http://www.karlrunge.com/x11vnc/disclaimer.html - 9. http://www.karlrunge.com/x11vnc/index.html#contact - 10. http://www.realvnc.com/ - 11. http://www.tightvnc.com/ - 12. http://www.ultravnc.com/ - 13. http://www.redstonesoftware.com/vnc.html - 14. http://www.karlrunge.com/x11vnc/index.html#downloading - 15. http://www.tightvnc.com/download.html - 16. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth - 17. http://www.karlrunge.com/x11vnc/index.html#faq-xperms + 7. http://www.karlrunge.com/x11vnc/index.html#faq-video + 8. http://www.karlrunge.com/x11vnc/index.html#faq + 9. http://www.karlrunge.com/x11vnc/disclaimer.html + 10. http://www.karlrunge.com/x11vnc/index.html#contact + 11. http://www.realvnc.com/ + 12. http://www.tightvnc.com/ + 13. http://www.ultravnc.com/ + 14. http://www.redstonesoftware.com/vnc.html + 15. http://www.karlrunge.com/x11vnc/index.html#downloading + 16. http://www.tightvnc.com/download.html + 17. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth 18. http://www.karlrunge.com/x11vnc/index.html#faq-xperms - 19. http://www.karlrunge.com/x11vnc/index.html#faq-viewer-download - 20. http://www.sun.com/software/solaris/freeware/ - 21. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-forever + 19. http://www.karlrunge.com/x11vnc/index.html#faq-xperms + 20. http://www.karlrunge.com/x11vnc/index.html#faq-viewer-download + 21. http://www.sun.com/software/solaris/freeware/ 22. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-forever - 23. http://www.karlrunge.com/x11vnc/index.html#faq-service - 24. http://www.karlrunge.com/x11vnc/index.html#faq-passwd - 25. http://www.karlrunge.com/x11vnc/index.html#vnc_password_file - 26. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 27. http://www.karlrunge.com/x11vnc/index.html#vnc_password_file - 28. http://www.karlrunge.com/x11vnc/index.html#faq-inetd - 29. http://www.karlrunge.com/x11vnc/index.html#tightvnc_via - 30. http://www.karlrunge.com/x11vnc/chainingssh.html - 31. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-bg - 32. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 33. http://www.karlrunge.com/x11vnc/index.html#faq-inetd - 34. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth - 35. http://www.karlrunge.com/x11vnc/index.html#faq-passwd - 36. http://www.karlrunge.com/x11vnc/index.html#faq-passwdfile - 37. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile - 38. http://www.karlrunge.com/x11vnc/index.html#faq-allow-opt - 39. http://www.karlrunge.com/x11vnc/index.html#faq-tcp_wrappers - 40. http://www.stunnel.org/ - 41. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl - 42. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int - 43. http://sourceforge.net/projects/libvncserver/ - 44. http://sourceforge.net/project/showfiles.php?group_id=32584&package_id=119006&release_id=393257 - 45. http://sourceforge.net/project/shownotes.php?release_id=393257&group_id=32584 - 46. http://www.karlrunge.com/x11vnc/x11vnc-0.8.1.tar.gz - 47. http://www.karlrunge.com/x11vnc/index.html#faq-binaries - 48. http://www.tightvnc.com/download.html - 49. http://www.realvnc.com/download-free.html - 50. http://sourceforge.net/projects/cotvnc/ - 51. http://www.ultravnc.com/ - 52. http://www.karlrunge.com/x11vnc/rx11vnc - 53. http://www.karlrunge.com/x11vnc/rx11vnc.pl - 54. http://www.sunfreeware.com/ - 55. http://www.karlrunge.com/x11vnc/bins - 56. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding - 57. http://www.karlrunge.com/x11vnc/miscbuild.html - 58. ftp://ftp.uu.net/graphics/jpeg/ - 59. http://www.gzip.org/zlib/ - 60. http://www.sunfreeware.com/ - 61. http://www.karlrunge.com/x11vnc/index.html#faq-solaris251build - 62. http://www.karlrunge.com/x11vnc/x11vnc-0.8.1.tar.gz - 63. http://www.karlrunge.com/x11vnc/bins - 64. mailto:x11vnc-beta@karlrunge.com - 65. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw - 66. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw_nis - 67. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl - 68. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost - 69. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel - 70. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl - 71. http://www.openssl.org/ - 72. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel - 73. http://www.stunnel.org/ - 74. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslverify - 75. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https - 76. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-usepw - 77. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noclipboard - 78. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosetclipboard - 79. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama - 80. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofilexfer - 81. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile - 82. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 - 83. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay - 84. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-loop - 85. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-afteraccept - 86. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-accept - 87. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-slow_fb - 88. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-blackout - 89. http://www.karlrunge.com/x11vnc/index.html#faq-xdamage - 90. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe - 91. http://www.karlrunge.com/x11vnc/index.html#wirecopyrect - 92. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect - 93. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid - 94. http://www.tightvnc.com/ - 95. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport - 96. http://www.karlrunge.com/x11vnc/x11vnc_opts.html - 97. http://www.karlrunge.com/x11vnc/index.html#faq-passwd - 98. http://www.karlrunge.com/x11vnc/recurse_x11vnc.jpg - 99. http://wwws.sun.com/sunray/index.html - 100. http://www.karlrunge.com/x11vnc/sunray.html - 101. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 102. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 103. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb - 104. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor - 105. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 23. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-forever + 24. http://www.karlrunge.com/x11vnc/index.html#faq-service + 25. http://www.karlrunge.com/x11vnc/index.html#faq-passwd + 26. http://www.karlrunge.com/x11vnc/index.html#vnc_password_file + 27. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect + 28. http://www.karlrunge.com/x11vnc/index.html#vnc_password_file + 29. http://www.karlrunge.com/x11vnc/index.html#faq-inetd + 30. http://www.karlrunge.com/x11vnc/index.html#tightvnc_via + 31. http://www.karlrunge.com/x11vnc/chainingssh.html + 32. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-bg + 33. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect + 34. http://www.karlrunge.com/x11vnc/index.html#faq-inetd + 35. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth + 36. http://www.karlrunge.com/x11vnc/index.html#faq-passwd + 37. http://www.karlrunge.com/x11vnc/index.html#faq-passwdfile + 38. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile + 39. http://www.karlrunge.com/x11vnc/index.html#faq-allow-opt + 40. http://www.karlrunge.com/x11vnc/index.html#faq-tcp_wrappers + 41. http://www.stunnel.org/ + 42. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl + 43. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int + 44. http://sourceforge.net/projects/libvncserver/ + 45. http://sourceforge.net/project/showfiles.php?group_id=32584&package_id=119006&release_id=393257 + 46. http://sourceforge.net/project/shownotes.php?release_id=393257&group_id=32584 + 47. http://www.karlrunge.com/x11vnc/x11vnc-0.8.1.tar.gz + 48. http://www.karlrunge.com/x11vnc/index.html#faq-binaries + 49. http://www.tightvnc.com/download.html + 50. http://www.realvnc.com/download-free.html + 51. http://sourceforge.net/projects/cotvnc/ + 52. http://www.ultravnc.com/ + 53. http://www.karlrunge.com/x11vnc/rx11vnc + 54. http://www.karlrunge.com/x11vnc/rx11vnc.pl + 55. http://www.sunfreeware.com/ + 56. http://www.karlrunge.com/x11vnc/bins + 57. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding + 58. http://www.karlrunge.com/x11vnc/miscbuild.html + 59. ftp://ftp.uu.net/graphics/jpeg/ + 60. http://www.gzip.org/zlib/ + 61. http://www.sunfreeware.com/ + 62. http://www.karlrunge.com/x11vnc/index.html#faq-solaris251build + 63. http://www.karlrunge.com/x11vnc/x11vnc-0.8.1.tar.gz + 64. http://www.karlrunge.com/x11vnc/bins + 65. mailto:x11vnc-beta@karlrunge.com + 66. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw + 67. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw_nis + 68. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl + 69. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost + 70. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel + 71. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl + 72. http://www.openssl.org/ + 73. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel + 74. http://www.stunnel.org/ + 75. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslverify + 76. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https + 77. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer + 78. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-usepw + 79. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb + 80. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb + 81. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-24to32 + 82. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noclipboard + 83. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosetclipboard + 84. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama + 85. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofilexfer + 86. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile + 87. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 + 88. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 89. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-loop + 90. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-afteraccept + 91. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-accept + 92. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-slow_fb + 93. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-blackout + 94. http://www.karlrunge.com/x11vnc/index.html#faq-xdamage + 95. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe + 96. http://www.karlrunge.com/x11vnc/index.html#wirecopyrect + 97. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect + 98. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid + 99. http://www.tightvnc.com/ + 100. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport + 101. http://www.karlrunge.com/x11vnc/x11vnc_opts.html + 102. http://www.karlrunge.com/x11vnc/index.html#faq-passwd + 103. http://www.karlrunge.com/x11vnc/recurse_x11vnc.jpg + 104. http://wwws.sun.com/sunray/index.html + 105. http://www.karlrunge.com/x11vnc/sunray.html 106. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 107. mailto:xvml@karlrunge.com - 108. http://www.karlrunge.com/x11vnc/index.html#faq-thanks - 109. http://www.karlrunge.com/x11vnc/index.html#faq-xperms - 110. http://www.karlrunge.com/x11vnc/index.html#faq-build - 111. http://www.karlrunge.com/x11vnc/index.html#faq-missing-xtest - 112. http://www.karlrunge.com/x11vnc/index.html#faq-solaris251build - 113. http://www.karlrunge.com/x11vnc/index.html#faq-binaries - 114. http://www.karlrunge.com/x11vnc/index.html#faq-viewer-download - 115. http://www.karlrunge.com/x11vnc/index.html#faq-cmdline-opts - 116. http://www.karlrunge.com/x11vnc/index.html#faq-config-file - 117. http://www.karlrunge.com/x11vnc/index.html#faq-gui-tray - 118. http://www.karlrunge.com/x11vnc/index.html#faq-quiet-bg - 119. http://www.karlrunge.com/x11vnc/index.html#faq-sigpipe - 120. http://www.karlrunge.com/x11vnc/index.html#faq-build-customizations - 121. http://www.karlrunge.com/x11vnc/index.html#faq-win2vnc - 122. http://www.karlrunge.com/x11vnc/index.html#faq-win2vnc-8bpp - 123. http://www.karlrunge.com/x11vnc/index.html#faq-8bpp - 124. http://www.karlrunge.com/x11vnc/index.html#faq-overlays - 125. http://www.karlrunge.com/x11vnc/index.html#faq-windowid - 126. http://www.karlrunge.com/x11vnc/index.html#faq-transients-id - 127. http://www.karlrunge.com/x11vnc/index.html#faq-24bpp - 128. http://www.karlrunge.com/x11vnc/index.html#faq-noshm - 129. http://www.karlrunge.com/x11vnc/index.html#faq-xterminal-xauth - 130. http://www.karlrunge.com/x11vnc/index.html#faq-sunrays - 131. http://www.karlrunge.com/x11vnc/index.html#faq-stop-bg - 132. http://www.karlrunge.com/x11vnc/index.html#faq-remote_control - 133. http://www.karlrunge.com/x11vnc/index.html#faq-passwd - 134. http://www.karlrunge.com/x11vnc/index.html#faq-passwd-noecho - 135. http://www.karlrunge.com/x11vnc/index.html#faq-passwdfile - 136. http://www.karlrunge.com/x11vnc/index.html#faq-multipasswd - 137. http://www.karlrunge.com/x11vnc/index.html#faq-unix-passwords - 138. http://www.karlrunge.com/x11vnc/index.html#faq-forever-shared - 139. http://www.karlrunge.com/x11vnc/index.html#faq-allow-opt - 140. http://www.karlrunge.com/x11vnc/index.html#faq-tcp_wrappers - 141. http://www.karlrunge.com/x11vnc/index.html#faq-listen-interface - 142. http://www.karlrunge.com/x11vnc/index.html#faq-listen-localhost - 143. http://www.karlrunge.com/x11vnc/index.html#faq-input-opt - 144. http://www.karlrunge.com/x11vnc/index.html#faq-accept-opt - 145. http://www.karlrunge.com/x11vnc/index.html#faq-users-opt - 146. http://www.karlrunge.com/x11vnc/index.html#faq-blockdpy - 147. http://www.karlrunge.com/x11vnc/index.html#faq-gone-lock - 148. http://www.karlrunge.com/x11vnc/index.html#faq-ssh-unix - 149. http://www.karlrunge.com/x11vnc/index.html#faq-ssh-putty - 150. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-ext - 151. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int - 152. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers - 153. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-java-viewer-proxy - 154. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-portal - 155. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-ca - 156. http://www.karlrunge.com/x11vnc/index.html#faq-service - 157. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager - 158. http://www.karlrunge.com/x11vnc/index.html#faq-inetd - 159. http://www.karlrunge.com/x11vnc/index.html#faq-loop - 160. http://www.karlrunge.com/x11vnc/index.html#faq-java-http - 161. http://www.karlrunge.com/x11vnc/index.html#faq-reverse-connect - 162. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb - 163. http://www.karlrunge.com/x11vnc/index.html#faq-headless - 164. http://www.karlrunge.com/x11vnc/index.html#faq-solshm - 165. http://www.karlrunge.com/x11vnc/index.html#faq-less-resource - 166. http://www.karlrunge.com/x11vnc/index.html#faq-more-resource - 167. http://www.karlrunge.com/x11vnc/index.html#faq-slow-link - 168. http://www.karlrunge.com/x11vnc/index.html#faq-xdamage - 169. http://www.karlrunge.com/x11vnc/index.html#faq-pointer-mode - 170. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe - 171. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect - 172. http://www.karlrunge.com/x11vnc/index.html#faq-cursor-shape - 173. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha - 174. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha-hacks - 175. http://www.karlrunge.com/x11vnc/index.html#faq-cursor-arrow - 176. http://www.karlrunge.com/x11vnc/index.html#faq-cursor-positions - 177. http://www.karlrunge.com/x11vnc/index.html#faq-buttonmap-opt - 178. http://www.karlrunge.com/x11vnc/index.html#faq-altgr - 179. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless - 180. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless-sloppy - 181. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak - 182. http://www.karlrunge.com/x11vnc/index.html#faq-repeated-keys - 183. http://www.karlrunge.com/x11vnc/index.html#faq-repeated-keys-still - 184. http://www.karlrunge.com/x11vnc/index.html#faq-remap-opt - 185. http://www.karlrunge.com/x11vnc/index.html#faq-sun-alt-meta - 186. http://www.karlrunge.com/x11vnc/index.html#faq-remap-button-click - 187. http://www.karlrunge.com/x11vnc/index.html#faq-scrollbars - 188. http://www.karlrunge.com/x11vnc/index.html#faq-scaling - 189. http://www.karlrunge.com/x11vnc/index.html#faq-xinerama - 190. http://www.karlrunge.com/x11vnc/index.html#faq-multi-screen - 191. http://www.karlrunge.com/x11vnc/index.html#faq-clip-screen - 192. http://www.karlrunge.com/x11vnc/index.html#faq-xrandr - 193. http://www.karlrunge.com/x11vnc/index.html#faq-black-screen - 194. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 195. http://www.karlrunge.com/x11vnc/index.html#faq-vmware - 196. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb - 197. http://www.karlrunge.com/x11vnc/index.html#faq-hidden-taskbars - 198. http://www.karlrunge.com/x11vnc/index.html#faq-clipboard - 199. http://www.karlrunge.com/x11vnc/index.html#faq-filexfer - 200. http://www.karlrunge.com/x11vnc/index.html#faq-beeps - 201. http://www.karlrunge.com/x11vnc/index.html#faq-thanks - 202. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display - 203. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth - 204. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager - 205. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-users - 206. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding - 207. http://www.karlrunge.com/x11vnc/x11vnc_sunos4.html - 208. http://www.karlrunge.com/x11vnc/index.html#building - 209. http://www.karlrunge.com/x11vnc/index.html#faq-build - 210. http://packages.debian.org/x11vnc - 211. http://www.linuxpackages.net/search_view.php?by=name&name=x11vnc - 212. http://dag.wieers.com/packages/x11vnc/ - 213. http://dries.ulyssis.org/rpm/packages/x11vnc/info.html - 214. http://linux01.gwdg.de/~pbleser/rpm-navigation.php?cat=Network/x11vnc/ - 215. http://www.sunfreeware.com/ - 216. http://mike.saunby.net/770/x11vnc/ - 217. http://www.pdaxrom.org/ipk_feed.php?menuid=11&showfeed=unstable#x11vnc - 218. http://www.focv.com/ipkg/ - 219. http://www.karlrunge.com/x11vnc/bins - 220. http://www.tightvnc.com/download.html - 221. http://www.realvnc.com/download-free.html - 222. http://sourceforge.net/projects/cotvnc/ - 223. http://www.ultravnc.com/ - 224. http://www.karlrunge.com/x11vnc/x11vnc_opts.html - 225. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui - 226. http://www.karlrunge.com/x11vnc/index.html#faq-gui-tray - 227. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-q - 228. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-bg - 229. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-o - 230. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding - 231. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofb - 232. http://fredrik.hubbe.net/x2vnc.html - 233. http://www.hubbe.net/~hubbe/win2vnc.html - 234. http://www.deboer.gmxhome.de/ - 235. http://sourceforge.net/projects/win2vnc/ - 236. http://fredrik.hubbe.net/x2vnc.html - 237. http://freshmeat.net/projects/x2x/ - 238. http://ftp.digital.com/pub/Digital/SRC/x2x/ - 239. http://zapek.com/software/zvnc/ - 240. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-visual - 241. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-flashcmap - 242. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 - 243. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-notruecolor - 244. http://www.karlrunge.com/x11vnc/index.html#faq-8bpp - 245. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay - 246. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 - 247. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 107. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 108. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb + 109. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor + 110. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 111. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 112. mailto:xvml@karlrunge.com + 113. http://www.karlrunge.com/x11vnc/index.html#faq-thanks + 114. http://www.karlrunge.com/x11vnc/index.html#faq-xperms + 115. http://www.karlrunge.com/x11vnc/index.html#faq-build + 116. http://www.karlrunge.com/x11vnc/index.html#faq-missing-xtest + 117. http://www.karlrunge.com/x11vnc/index.html#faq-solaris251build + 118. http://www.karlrunge.com/x11vnc/index.html#faq-binaries + 119. http://www.karlrunge.com/x11vnc/index.html#faq-viewer-download + 120. http://www.karlrunge.com/x11vnc/index.html#faq-cmdline-opts + 121. http://www.karlrunge.com/x11vnc/index.html#faq-config-file + 122. http://www.karlrunge.com/x11vnc/index.html#faq-gui-tray + 123. http://www.karlrunge.com/x11vnc/index.html#faq-quiet-bg + 124. http://www.karlrunge.com/x11vnc/index.html#faq-sigpipe + 125. http://www.karlrunge.com/x11vnc/index.html#faq-build-customizations + 126. http://www.karlrunge.com/x11vnc/index.html#faq-win2vnc + 127. http://www.karlrunge.com/x11vnc/index.html#faq-win2vnc-8bpp + 128. http://www.karlrunge.com/x11vnc/index.html#faq-8bpp + 129. http://www.karlrunge.com/x11vnc/index.html#faq-overlays + 130. http://www.karlrunge.com/x11vnc/index.html#faq-windowid + 131. http://www.karlrunge.com/x11vnc/index.html#faq-transients-id + 132. http://www.karlrunge.com/x11vnc/index.html#faq-24bpp + 133. http://www.karlrunge.com/x11vnc/index.html#faq-noshm + 134. http://www.karlrunge.com/x11vnc/index.html#faq-xterminal-xauth + 135. http://www.karlrunge.com/x11vnc/index.html#faq-sunrays + 136. http://www.karlrunge.com/x11vnc/index.html#faq-stop-bg + 137. http://www.karlrunge.com/x11vnc/index.html#faq-remote_control + 138. http://www.karlrunge.com/x11vnc/index.html#faq-passwd + 139. http://www.karlrunge.com/x11vnc/index.html#faq-passwd-noecho + 140. http://www.karlrunge.com/x11vnc/index.html#faq-passwdfile + 141. http://www.karlrunge.com/x11vnc/index.html#faq-multipasswd + 142. http://www.karlrunge.com/x11vnc/index.html#faq-unix-passwords + 143. http://www.karlrunge.com/x11vnc/index.html#faq-forever-shared + 144. http://www.karlrunge.com/x11vnc/index.html#faq-allow-opt + 145. http://www.karlrunge.com/x11vnc/index.html#faq-tcp_wrappers + 146. http://www.karlrunge.com/x11vnc/index.html#faq-listen-interface + 147. http://www.karlrunge.com/x11vnc/index.html#faq-listen-localhost + 148. http://www.karlrunge.com/x11vnc/index.html#faq-input-opt + 149. http://www.karlrunge.com/x11vnc/index.html#faq-accept-opt + 150. http://www.karlrunge.com/x11vnc/index.html#faq-users-opt + 151. http://www.karlrunge.com/x11vnc/index.html#faq-blockdpy + 152. http://www.karlrunge.com/x11vnc/index.html#faq-gone-lock + 153. http://www.karlrunge.com/x11vnc/index.html#faq-ssh-unix + 154. http://www.karlrunge.com/x11vnc/index.html#faq-ssh-putty + 155. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-ext + 156. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int + 157. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers + 158. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-java-viewer-proxy + 159. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-portal + 160. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-ca + 161. http://www.karlrunge.com/x11vnc/index.html#faq-service + 162. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager + 163. http://www.karlrunge.com/x11vnc/index.html#faq-inetd + 164. http://www.karlrunge.com/x11vnc/index.html#faq-loop + 165. http://www.karlrunge.com/x11vnc/index.html#faq-java-http + 166. http://www.karlrunge.com/x11vnc/index.html#faq-reverse-connect + 167. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb + 168. http://www.karlrunge.com/x11vnc/index.html#faq-headless + 169. http://www.karlrunge.com/x11vnc/index.html#faq-solshm + 170. http://www.karlrunge.com/x11vnc/index.html#faq-less-resource + 171. http://www.karlrunge.com/x11vnc/index.html#faq-more-resource + 172. http://www.karlrunge.com/x11vnc/index.html#faq-slow-link + 173. http://www.karlrunge.com/x11vnc/index.html#faq-xdamage + 174. http://www.karlrunge.com/x11vnc/index.html#faq-pointer-mode + 175. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe + 176. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect + 177. http://www.karlrunge.com/x11vnc/index.html#faq-cursor-shape + 178. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha + 179. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha-hacks + 180. http://www.karlrunge.com/x11vnc/index.html#faq-cursor-arrow + 181. http://www.karlrunge.com/x11vnc/index.html#faq-cursor-positions + 182. http://www.karlrunge.com/x11vnc/index.html#faq-buttonmap-opt + 183. http://www.karlrunge.com/x11vnc/index.html#faq-altgr + 184. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless + 185. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless-sloppy + 186. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak + 187. http://www.karlrunge.com/x11vnc/index.html#faq-repeated-keys + 188. http://www.karlrunge.com/x11vnc/index.html#faq-repeated-keys-still + 189. http://www.karlrunge.com/x11vnc/index.html#faq-remap-opt + 190. http://www.karlrunge.com/x11vnc/index.html#faq-sun-alt-meta + 191. http://www.karlrunge.com/x11vnc/index.html#faq-remap-button-click + 192. http://www.karlrunge.com/x11vnc/index.html#faq-scrollbars + 193. http://www.karlrunge.com/x11vnc/index.html#faq-scaling + 194. http://www.karlrunge.com/x11vnc/index.html#faq-xinerama + 195. http://www.karlrunge.com/x11vnc/index.html#faq-multi-screen + 196. http://www.karlrunge.com/x11vnc/index.html#faq-clip-screen + 197. http://www.karlrunge.com/x11vnc/index.html#faq-xrandr + 198. http://www.karlrunge.com/x11vnc/index.html#faq-black-screen + 199. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 200. http://www.karlrunge.com/x11vnc/index.html#faq-vmware + 201. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb + 202. http://www.karlrunge.com/x11vnc/index.html#faq-video + 203. http://www.karlrunge.com/x11vnc/index.html#faq-hidden-taskbars + 204. http://www.karlrunge.com/x11vnc/index.html#faq-clipboard + 205. http://www.karlrunge.com/x11vnc/index.html#faq-filexfer + 206. http://www.karlrunge.com/x11vnc/index.html#faq-beeps + 207. http://www.karlrunge.com/x11vnc/index.html#faq-thanks + 208. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display + 209. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth + 210. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager + 211. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-users + 212. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding + 213. http://www.karlrunge.com/x11vnc/x11vnc_sunos4.html + 214. http://www.karlrunge.com/x11vnc/index.html#building + 215. http://www.karlrunge.com/x11vnc/index.html#faq-build + 216. http://packages.debian.org/x11vnc + 217. http://www.linuxpackages.net/search_view.php?by=name&name=x11vnc + 218. http://dag.wieers.com/packages/x11vnc/ + 219. http://dries.ulyssis.org/rpm/packages/x11vnc/info.html + 220. http://linux01.gwdg.de/~pbleser/rpm-navigation.php?cat=Network/x11vnc/ + 221. http://www.sunfreeware.com/ + 222. http://mike.saunby.net/770/x11vnc/ + 223. http://www.pdaxrom.org/ipk_feed.php?menuid=11&showfeed=unstable#x11vnc + 224. http://www.focv.com/ipkg/ + 225. http://www.karlrunge.com/x11vnc/bins + 226. http://www.tightvnc.com/download.html + 227. http://www.realvnc.com/download-free.html + 228. http://sourceforge.net/projects/cotvnc/ + 229. http://www.ultravnc.com/ + 230. http://www.karlrunge.com/x11vnc/x11vnc_opts.html + 231. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui + 232. http://www.karlrunge.com/x11vnc/index.html#faq-gui-tray + 233. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-q + 234. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-bg + 235. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-o + 236. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding + 237. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofb + 238. http://fredrik.hubbe.net/x2vnc.html + 239. http://www.hubbe.net/~hubbe/win2vnc.html + 240. http://www.deboer.gmxhome.de/ + 241. http://sourceforge.net/projects/win2vnc/ + 242. http://fredrik.hubbe.net/x2vnc.html + 243. http://freshmeat.net/projects/x2x/ + 244. http://ftp.digital.com/pub/Digital/SRC/x2x/ + 245. http://zapek.com/software/zvnc/ + 246. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-visual + 247. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-flashcmap 248. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 - 249. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-flashcmap - 250. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen - 251. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 - 252. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 253. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 - 254. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay - 255. http://www.karlrunge.com/x11vnc/index.html#faq-overlays - 256. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 257. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sid - 258. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display - 259. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm - 260. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-flipbyteorder - 261. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth - 262. http://www.karlrunge.com/x11vnc/index.html#xauth_pain - 263. http://www.karlrunge.com/x11vnc/index.html#faq-noshm - 264. http://wwws.sun.com/sunray/index.html - 265. http://www.karlrunge.com/x11vnc/sunray.html - 266. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote - 267. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-query - 268. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-forever - 269. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-bg - 270. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clear_mods - 271. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clear_keys - 272. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote - 273. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-query - 274. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui - 275. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-storepasswd - 276. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth - 277. http://www.karlrunge.com/x11vnc/index.html#faq-passwdfile - 278. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-usepw - 279. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-viewpasswd - 280. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwd - 281. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile - 282. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth - 283. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile - 284. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw - 285. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw_nis - 286. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost - 287. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel - 288. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost - 289. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 290. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel - 291. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-accept - 292. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-forever - 293. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-shared - 294. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 295. http://www.karlrunge.com/x11vnc/index.html#faq-passwd - 296. http://www.karlrunge.com/x11vnc/index.html#faq-passwdfile - 297. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-allow - 298. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost - 299. http://www.karlrunge.com/x11vnc/index.html#faq-tcp_wrappers - 300. http://www.karlrunge.com/x11vnc/index.html#faq-inetd - 301. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-listen - 302. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-allow - 303. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost + 249. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-notruecolor + 250. http://www.karlrunge.com/x11vnc/index.html#faq-8bpp + 251. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 252. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 + 253. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 254. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 + 255. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-flashcmap + 256. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen + 257. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 + 258. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 259. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-8to24 + 260. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 261. http://www.karlrunge.com/x11vnc/index.html#faq-overlays + 262. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 263. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sid + 264. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-24to32 + 265. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display + 266. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm + 267. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-flipbyteorder + 268. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth + 269. http://www.karlrunge.com/x11vnc/index.html#xauth_pain + 270. http://www.karlrunge.com/x11vnc/index.html#faq-noshm + 271. http://wwws.sun.com/sunray/index.html + 272. http://www.karlrunge.com/x11vnc/sunray.html + 273. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote + 274. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-query + 275. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-forever + 276. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-bg + 277. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clear_mods + 278. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clear_keys + 279. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote + 280. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-query + 281. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui + 282. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-storepasswd + 283. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth + 284. http://www.karlrunge.com/x11vnc/index.html#faq-passwdfile + 285. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-usepw + 286. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-viewpasswd + 287. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwd + 288. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile + 289. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth + 290. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile + 291. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw + 292. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw_nis + 293. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost + 294. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel + 295. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost + 296. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 297. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel + 298. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-accept + 299. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-forever + 300. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-shared + 301. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 302. http://www.karlrunge.com/x11vnc/index.html#faq-passwd + 303. http://www.karlrunge.com/x11vnc/index.html#faq-passwdfile 304. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-allow 305. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost - 306. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-listen - 307. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-allow - 308. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost - 309. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-input - 310. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-accept - 311. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-viewonly - 312. ftp://ftp.x.org/ - 313. http://www.karlrunge.com/x11vnc/dtVncPopup - 314. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gone - 315. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-users - 316. http://www.karlrunge.com/x11vnc/blockdpy.c + 306. http://www.karlrunge.com/x11vnc/index.html#faq-tcp_wrappers + 307. http://www.karlrunge.com/x11vnc/index.html#faq-inetd + 308. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-listen + 309. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-allow + 310. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost + 311. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-allow + 312. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost + 313. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-listen + 314. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-allow + 315. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost + 316. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-input 317. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-accept - 318. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gone - 319. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gone - 320. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-afteraccept - 321. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 322. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 323. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost - 324. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth - 325. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile - 326. http://www.karlrunge.com/x11vnc/index.html#gateway_double_ssh - 327. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 328. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 329. http://www.stunnel.org/ - 330. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl - 331. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel - 332. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslverify - 333. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int - 334. http://www.stunnel.org/ - 335. http://www.karlrunge.com/x11vnc/ssl.html - 336. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer - 337. http://www.karlrunge.com/x11vnc/ssl.html - 338. http://www.securityfocus.com/infocus/1677 - 339. http://www.karlrunge.com/x11vnc/ssl.html - 340. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-inetd - 341. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers - 342. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir - 343. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http - 344. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl - 345. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https - 346. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel - 347. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer - 348. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-ext - 349. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl - 350. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel - 351. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers - 352. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl - 353. http://www.openssl.org/ - 354. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel - 355. http://www.stunnel.org/ - 356. http://www.karlrunge.com/x11vnc/ssl.html - 357. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer - 358. http://www.karlrunge.com/x11vnc/ssl.html - 359. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers - 360. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir - 361. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http - 362. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https - 363. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https - 364. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-ext - 365. http://www.karlrunge.com/x11vnc/ssl_vncviewer - 366. http://www.karlrunge.com/x11vnc/ssl-portal.html - 367. http://www.karlrunge.com/x11vnc/ssl.html - 368. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer - 369. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers - 370. http://www.karlrunge.com/x11vnc/ssl-portal.html - 371. http://www.karlrunge.com/x11vnc/ssl.html - 372. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously - 373. http://www.karlrunge.com/x11vnc/index.html#faq-inetd - 374. http://www.karlrunge.com/x11vnc/index.html#x11vnc_loop - 375. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth - 376. http://www.karlrunge.com/x11vnc/index.html#dtlogin_solaris - 377. http://www.jirka.org/gdm-documentation/x241.html - 378. http://www.karlrunge.com/x11vnc/x11vnc_loop - 379. http://www.karlrunge.com/x11vnc/index.html#faq-xterminal-xauth - 380. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-inetd - 381. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-q + 318. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-viewonly + 319. ftp://ftp.x.org/ + 320. http://www.karlrunge.com/x11vnc/dtVncPopup + 321. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gone + 322. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-users + 323. http://www.karlrunge.com/x11vnc/blockdpy.c + 324. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-accept + 325. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gone + 326. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gone + 327. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-afteraccept + 328. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 329. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 330. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost + 331. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth + 332. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile + 333. http://www.karlrunge.com/x11vnc/index.html#gateway_double_ssh + 334. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 335. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect + 336. http://www.stunnel.org/ + 337. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl + 338. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel + 339. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslverify + 340. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int + 341. http://www.stunnel.org/ + 342. http://www.karlrunge.com/x11vnc/ssl.html + 343. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer + 344. http://www.karlrunge.com/x11vnc/ssl.html + 345. http://www.securityfocus.com/infocus/1677 + 346. http://www.karlrunge.com/x11vnc/ssl.html + 347. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-inetd + 348. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers + 349. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir + 350. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http + 351. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl + 352. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https + 353. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel + 354. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer + 355. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-ext + 356. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl + 357. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel + 358. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers + 359. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl + 360. http://www.openssl.org/ + 361. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel + 362. http://www.stunnel.org/ + 363. http://www.karlrunge.com/x11vnc/ssl.html + 364. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer + 365. http://www.karlrunge.com/x11vnc/ssl.html + 366. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers + 367. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir + 368. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http + 369. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https + 370. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https + 371. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-ext + 372. http://www.karlrunge.com/x11vnc/ssl_vncviewer + 373. http://www.karlrunge.com/x11vnc/ssl-portal.html + 374. http://www.karlrunge.com/x11vnc/ssl.html + 375. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer + 376. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers + 377. http://www.karlrunge.com/x11vnc/ssl-portal.html + 378. http://www.karlrunge.com/x11vnc/ssl.html + 379. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously + 380. http://www.karlrunge.com/x11vnc/index.html#faq-inetd + 381. http://www.karlrunge.com/x11vnc/index.html#x11vnc_loop 382. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth - 383. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-loop - 384. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir - 385. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http - 386. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 387. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote - 388. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-vncconnect - 389. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 390. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 391. http://www.karlrunge.com/x11vnc/Xdummy - 392. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously - 393. http://www.karlrunge.com/x11vnc/shm_clear - 394. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 395. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm - 396. http://www.karlrunge.com/x11vnc/index.html#faq-noshm - 397. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nap - 398. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait - 399. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 400. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs - 401. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads - 402. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer - 403. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 404. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid - 405. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 406. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 407. http://www.tightvnc.com/ - 408. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 409. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 410. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-speeds - 411. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging - 412. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs - 413. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait - 414. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer - 415. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-progressive - 416. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 417. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel - 418. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor - 419. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos - 420. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-readtimeout - 421. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 422. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_area - 423. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_mem - 424. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noxdamage - 425. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 426. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode - 427. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode - 428. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging - 429. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode - 430. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads - 431. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe - 432. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect - 433. http://www.karlrunge.com/x11vnc/index.html#faq-pointer-mode - 434. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 435. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 436. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 437. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 438. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 439. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 440. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 441. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wirecopyrect - 442. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe - 443. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen - 444. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scr_skip - 445. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale + 383. http://www.karlrunge.com/x11vnc/index.html#dtlogin_solaris + 384. http://www.jirka.org/gdm-documentation/x241.html + 385. http://www.karlrunge.com/x11vnc/x11vnc_loop + 386. http://www.karlrunge.com/x11vnc/index.html#faq-xterminal-xauth + 387. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-inetd + 388. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-q + 389. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth + 390. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-loop + 391. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir + 392. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http + 393. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect + 394. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote + 395. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-vncconnect + 396. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms + 397. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 398. http://www.karlrunge.com/x11vnc/Xdummy + 399. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously + 400. http://www.karlrunge.com/x11vnc/shm_clear + 401. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 402. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm + 403. http://www.karlrunge.com/x11vnc/index.html#faq-noshm + 404. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nap + 405. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait + 406. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 407. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs + 408. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads + 409. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer + 410. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 411. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid + 412. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 413. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 414. http://www.tightvnc.com/ + 415. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 416. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 417. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-speeds + 418. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging + 419. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs + 420. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait + 421. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer + 422. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-progressive + 423. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 424. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel + 425. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor + 426. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos + 427. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-readtimeout + 428. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow + 429. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_area + 430. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_mem + 431. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noxdamage + 432. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow + 433. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 434. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 435. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging + 436. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 437. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads + 438. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe + 439. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect + 440. http://www.karlrunge.com/x11vnc/index.html#faq-pointer-mode + 441. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow + 442. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 443. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 444. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 445. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow 446. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 447. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor - 448. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor - 449. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay - 450. http://www.karlrunge.com/x11vnc/index.html#the-overlay-mode - 451. http://www.karlrunge.com/x11vnc/index.html#solaris10-build - 452. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha-hacks - 453. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphacut - 454. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphafrac - 455. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alpharemove - 456. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape - 457. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noalphablend - 458. http://www.tightvnc.com/ - 459. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor - 460. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursorpos - 461. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos - 462. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape - 463. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap - 464. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_pointer - 465. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap - 466. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 467. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless - 468. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak - 469. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard - 470. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 471. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys - 472. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak + 447. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 448. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wirecopyrect + 449. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe + 450. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen + 451. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scr_skip + 452. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale + 453. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 454. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor + 455. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor + 456. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 457. http://www.karlrunge.com/x11vnc/index.html#the-overlay-mode + 458. http://www.karlrunge.com/x11vnc/index.html#solaris10-build + 459. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha-hacks + 460. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphacut + 461. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphafrac + 462. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alpharemove + 463. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape + 464. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noalphablend + 465. http://www.tightvnc.com/ + 466. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor + 467. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursorpos + 468. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos + 469. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape + 470. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap + 471. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_pointer + 472. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap 473. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 474. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 474. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless 475. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak 476. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard - 477. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless - 478. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 479. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys + 477. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 478. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys + 479. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak 480. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 481. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 482. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 483. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_keycodes - 484. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 485. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 486. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 487. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 488. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 489. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat - 490. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat - 491. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager - 492. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 481. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 482. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak + 483. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard + 484. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless + 485. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 486. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys + 487. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak + 488. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 489. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 490. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_keycodes + 491. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 492. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms 493. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap 494. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 495. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 496. http://www.karlrunge.com/x11vnc/index.html#faq-scaling - 497. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale - 498. http://www.cus.cam.ac.uk/~ssb22/source/vnc-magnification.html - 499. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport - 500. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui - 501. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 502. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale_cursor - 503. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-blackout - 504. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama - 505. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xwarppointer - 506. http://www.karlrunge.com/x11vnc/index.html#faq-solshm - 507. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 508. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm - 509. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clip - 510. http://www.karlrunge.com/x11vnc/index.html#faq-xinerama - 511. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 512. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 513. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xrandr - 514. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-padgeom - 515. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 516. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb - 517. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 495. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms + 496. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat + 497. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat + 498. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager + 499. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 500. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 501. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 502. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 503. http://www.karlrunge.com/x11vnc/index.html#faq-scaling + 504. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale + 505. http://www.cus.cam.ac.uk/~ssb22/source/vnc-magnification.html + 506. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport + 507. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui + 508. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect + 509. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale_cursor + 510. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-blackout + 511. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama + 512. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xwarppointer + 513. http://www.karlrunge.com/x11vnc/index.html#faq-solshm + 514. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 515. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm + 516. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clip + 517. http://www.karlrunge.com/x11vnc/index.html#faq-xinerama 518. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 519. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb - 520. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 521. http://www.karlrunge.com/x11vnc/index.html#faq-vmware - 522. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel - 523. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noprimary - 524. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-seldir - 525. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofilexfer - 526. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nobell + 519. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 520. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xrandr + 521. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-padgeom + 522. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 523. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb + 524. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 525. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 526. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-snapfb + 527. http://www.karlrunge.com/x11vnc/index.html#faq-video + 528. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb + 529. http://www.karlrunge.com/x11vnc/index.html#faq-video + 530. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 531. http://www.karlrunge.com/x11vnc/index.html#faq-vmware + 532. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb + 533. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb + 534. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-snapfb + 535. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-24to32 + 536. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait + 537. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-slow_fb + 538. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer + 539. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-freqtab + 540. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel + 541. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noprimary + 542. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-seldir + 543. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofilexfer + 544. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nobell ======================================================================= http://www.karlrunge.com/x11vnc/chainingssh.html: @@ -6205,12 +6421,11 @@ NTIwLjQxMTE2OTEPMA0GA1UEChMGeDExdm5jMS4wLAYDVQQDEyV4MTF2bmMtU0VM ~/.vnc/certs/server-req:external.crt and create the .pem this way: - cp ~/.vnc/certs/server-req:external.key ~/.vnc/certs/server-req:external. + mv ~/.vnc/certs/server-req:external.key ~/.vnc/certs/server-req:external. pem chmod 600 ~/.vnc/certs/server-req:external.pem cat ~/.vnc/certs/server-req:external.crt >> ~/.vnc/certs/server-req:external. pem - rm ~/.vnc/certs/server-req:external.key You also rename the two files (.crt and .pem) to have a shorter basename if you like. @@ -6495,6 +6710,8 @@ t:563/ -proxy option that can take advantage of this method. For the case of the "double proxy" situation (see below) supply both separated by a comma. + ssl_vncviewer -proxy www.gateway.east:563 mach1:15 + ssl_vncviewer -proxy proxy1.foobar.com:8080,www.gateway.east:563 mach1:15 Downloading the Java applet via HTTPS: @@ -6684,67 +6901,68 @@ x11vnc: a VNC server for real X displays Here are all of x11vnc command line options: % x11vnc -opts (see below for -help long descriptions) -x11vnc: allow VNC connections to real X11 displays. 0.8.1 lastmod: 2006-04-16 +x11vnc: allow VNC connections to real X11 displays. 0.8.1 lastmod: 2006-05-06 x11vnc options: -display disp -auth file -id windowid -sid windowid -clip WxH+X+Y -flashcmap -shiftcmap n -notruecolor -visual n -overlay -overlay_nocursor -8to24 [opts] - -scale fraction -scale_cursor frac -viewonly - -shared -once -forever - -loop -timeout n -inetd - -nofilexfer -http -connect string - -vncconnect -novncconnect -allow host1[,host2..] - -localhost -nolookup -input string - -viewpasswd string -passwdfile filename -unixpw [list] - -unixpw_nis [list] -ssl [pem] -ssldir [dir] - -sslverify [path] -sslGenCA [dir] -sslGenCert type name - -sslEncKey [pem] -sslCertInfo [pem] -sslDelCert [pem] - -stunnel [pem] -stunnel3 [pem] -https [port] - -usepw -storepasswd pass file -nopw - -accept string -afteraccept string -gone string - -users list -noshm -flipbyteorder - -onetile -solid [color] -blackout string - -xinerama -noxinerama -xtrap - -xrandr [mode] -padgeom WxH -o logfile - -flag file -rc filename -norc - -h, -help -?, -opts -V, -version - -dbg -q -bg - -modtweak -nomodtweak -xkb - -noxkb -skip_keycodes string -sloppy_keys - -skip_dups -noskip_dups -add_keysyms - -noadd_keysyms -clear_mods -clear_keys - -remap string -norepeat -repeat - -nofb -nobell -nosel - -noprimary -nosetprimary -noclipboard - -nosetclipboard -seldir string -cursor [mode] - -nocursor -arrow n -noxfixes - -alphacut n -alphafrac fraction -alpharemove - -noalphablend -nocursorshape -cursorpos - -nocursorpos -xwarppointer -buttonmap string - -nodragging -wireframe [str] -nowireframe - -wirecopyrect mode -nowirecopyrect -debug_wireframe - -scrollcopyrect mode -noscrollcopyrect -scr_area n - -scr_skip list -scr_inc list -scr_keys list - -scr_term list -scr_keyrepeat lo-hi -scr_parms string - -fixscreen string -debug_scroll -noxrecord - -grab_buster -nograb_buster -debug_grabs - -debug_sel -pointer_mode n -input_skip n - -speeds rd,bw,lat -wmdt string -debug_pointer - -debug_keyboard -defer time -wait time - -wait_ui factor -nowait_bog -slow_fb time - -readtimeout n -nap -nonap - -sb time -nofbpm -fbpm - -noxdamage -xd_area A -xd_mem f - -sigpipe string -threads -nothreads - -fs f -gaps n -grow n - -fuzz n -debug_tiles -snapfb - -rawfb string -pipeinput cmd -gui [gui-opts] - -remote command -query variable -QD variable - -sync -noremote -yesremote - -unsafe -safer -privremote - -nocmds -deny_all + -24to32 -scale fraction -scale_cursor frac + -viewonly -shared -once + -forever -loop -timeout n + -inetd -nofilexfer -http + -connect string -vncconnect -novncconnect + -allow host1[,host2..] -localhost -nolookup + -input string -viewpasswd string -passwdfile filename + -unixpw [list] -unixpw_nis [list] -ssl [pem] + -ssldir [dir] -sslverify [path] -sslGenCA [dir] + -sslGenCert type name -sslEncKey [pem] -sslCertInfo [pem] + -sslDelCert [pem] -stunnel [pem] -stunnel3 [pem] + -https [port] -usepw -storepasswd pass file + -nopw -accept string -afteraccept string + -gone string -users list -noshm + -flipbyteorder -onetile -solid [color] + -blackout string -xinerama -noxinerama + -xtrap -xrandr [mode] -padgeom WxH + -o logfile -flag file -rc filename + -norc -h, -help -?, -opts + -V, -version -dbg -q + -bg -modtweak -nomodtweak + -xkb -noxkb -skip_keycodes string + -sloppy_keys -skip_dups -noskip_dups + -add_keysyms -noadd_keysyms -clear_mods + -clear_keys -remap string -norepeat + -repeat -nofb -nobell + -nosel -noprimary -nosetprimary + -noclipboard -nosetclipboard -seldir string + -cursor [mode] -nocursor -arrow n + -noxfixes -alphacut n -alphafrac fraction + -alpharemove -noalphablend -nocursorshape + -cursorpos -nocursorpos -xwarppointer + -buttonmap string -nodragging -wireframe [str] + -nowireframe -wirecopyrect mode -nowirecopyrect + -debug_wireframe -scrollcopyrect mode -noscrollcopyrect + -scr_area n -scr_skip list -scr_inc list + -scr_keys list -scr_term list -scr_keyrepeat lo-hi + -scr_parms string -fixscreen string -debug_scroll + -noxrecord -grab_buster -nograb_buster + -debug_grabs -debug_sel -pointer_mode n + -input_skip n -speeds rd,bw,lat -wmdt string + -debug_pointer -debug_keyboard -defer time + -wait time -wait_ui factor -nowait_bog + -slow_fb time -readtimeout n -nap + -nonap -sb time -nofbpm + -fbpm -noxdamage -xd_area A + -xd_mem f -sigpipe string -threads + -nothreads -fs f -gaps n + -grow n -fuzz n -debug_tiles + -snapfb -rawfb string -freqtab file + -pipeinput cmd -gui [gui-opts] -remote command + -query variable -QD variable -sync + -noremote -yesremote -unsafe + -safer -privremote -nocmds + -deny_all libvncserver options: -rfbport port TCP port for RFB protocol @@ -6776,7 +6994,7 @@ libvncserver-tight-extension options: % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.8.1 lastmod: 2006-04-16 +x11vnc: allow VNC connections to real X11 displays. 0.8.1 lastmod: 2006-05-06 (type "x11vnc -opts" to just list the options.) @@ -6990,6 +7208,19 @@ Options: Debugging for this mode can be enabled by setting "dbg=1", "dbg=2", or "dbg=3". +-24to32 Very rare problem: if the framebuffer (X display + or -rawfb) is 24bpp instead of the usual 32bpp, then + dynamically transform the pixels to 32bpp. This will be + slower, but can be used to work around problems where + VNC viewers cannot handle 24bpp (e.g. "main: setPF: + not 8, 16 or 32 bpp?"). See the FAQ for more info. + + In the case of -rawfb mode, the pixels are directly + modified by inserting a 0 byte to pad them out to 32bpp. + For X displays, a kludge is done that is equivalent to + "-noshm -visual TrueColor:32". (If better performance + is needed for the latter, feel free to ask). + -scale fraction Scale the framebuffer by factor "fraction". Values less than 1 shrink the fb, larger ones expand it. Note: image may not be sharp and response may be slower. @@ -8904,13 +9135,17 @@ Options: or where window tearing is a problem. -rawfb string Experimental option, instead of polling X, poll the - memory object specified in "string". For shared - memory segments it is of the form: "shm:N@WxHxB" - which specifies a shmid N and framebuffer Width, Height, - and Bits per pixel. To memory map mmap(2) a file use: + memory object specified in "string". + + For shared memory segments string is of the + form: "shm:N@WxHxB" which specifies a shmid + N and framebuffer Width, Height, and Bits + per pixel. To memory map mmap(2) a file use: "map:/path/to/a/file@WxHxB". If there is trouble - with mmap, use "file:/..." for slower lseek(2) - based reading. If you do not supply a type "map" + with mmap, use "file:/..." for slower lseek(2) based + reading. Use "snap:..." to imply -snapfb mode and the + "file:" access (this is for devices that only provide + the fb all at once). If you do not supply a type "map" is assumed if the file exists. If string is "setup:cmd", then the command "cmd" @@ -8919,6 +9154,14 @@ Options: determining WxHxB, etc. These are often done as root so take care. + If the string begins with "video", see the video4linux + discusion below where the device may be queried for + (and possibly set) the framebuffer parameters. + + If the strings begins with "cons", see the linux + console discussion below where the framebuffer device + is opened and keystrokes are inserted into the console. + Optional suffixes are ":R/G/B" and "+O" to specify red, green, and blue masks and an offset into the memory object. If the masks are not provided x11vnc @@ -8929,6 +9172,11 @@ Options: -rawfb map:/dev/fb0@1024x768x32 -rawfb map:/tmp/Xvfb_screen0@640x480x8+3232 -rawfb file:/tmp/my.pnm@250x200x24+37 + -rawfb file:/dev/urandom@128x128x8 + -rawfb snap:/dev/video0@320x240x24 -24to32 + -rawfb video0 + -rawfb video -pipeinput VID + -rawfb console (see ipcs(1) and fbset(1) for the first two examples) @@ -8936,16 +9184,157 @@ Options: -pipeinput option). Most of the X11 (screen, keyboard, mouse) options do not make sense and many will cause this mode to crash, so please think twice before - setting/changing them. + setting or changing them in a running x11vnc. + + If you DO NOT want x11vnc to close the X DISPLAY in + rawfb mode, prepend a "+" e.g. +file:/dev/fb0... + Keeping the display open enables the default + remote-control channel, which could be useful. + Alternatively, if you specify -noviewonly, then the + mouse and keyboard input are STILL sent to the X + display, this usage should be very rare, i.e. doing + something strange with /dev/fb0. + + If the device is not "seekable" try reading it all + at once in full snaps via the "snap:" mode (note: + this is a resource hog). If you are using file: or + map: and the device needs to be reopened for *every* + snapfb snapshot, set the environment variable: + SNAPFB_RAWFB_RESET=1 as well. + + If you want x11vnc to dynamically transform a 24bpp + rawfb to 32bpp (note that this will be slower) use + the -24to32 option. This would be useful for, say, + for a video camera that delivers the pixel data as + 24bpp packed RGB. This is the default under "video" + mode if the bpp is 24. + + video4linux: on Linux some attempt is made to handle + video devices (webcams or tv tuners) automatically. + The idea is the WxHxB will be extracted from the + device itself. So if you do not supply "@WxHxB... + parameters x11vnc will try to determine them. It first + tries the v4l API if that support has been compiled in. + Otherwise it will run the v4l-info(1) external program + if it is available. + + The simplest examples are "-rawfb video" and "-rawfb + video1" which imply the device file /dev/video and + /dev/video1, respectively. You can also supply the + /dev if you like, e.g. "-rawfb /dev/video0" + + Since the video capture device framebuffer usually + changes continuously (e.g. brightness fluctuations), + you may want to use the -wait, -slow_fb, or -defer + options to lower the "framerate" to cut down on + network VNC traffic. + + A more sophisticated video device scheme allows + initializing the device's settings using: + + -rawfb video:<settings> + + The prefix could also be, as above, e.g. "video1:" to + specify the device file. The v4l API must be available + for this to work. Otherwise, you will need to try + to initialize the device with an external program, + e.g. xawtv, spcaview, and hope they persist when x11vnc + re-opens the device. + + <settings> is a comma separated list of key=value pairs. + The device's brightness, color, contrast, and hue can + be set to percentages, e.g. br=80,co=50,cn=44,hu=60. + + The device filename can be set too if needed (if it + does not start with "video"), e.g. fn=/dev/qcam. + + The width, height and bpp of the framebuffer can be + set via, e.g., w=160,h=120,bpp=16. + + Related to the bpp above, the pixel format can be set + via the fmt=XXX, where XXX can be one of: GREY, HI240, + RGB555, RGB565, RGB24, and RGB32 (with bpp 8, 8, 16, 16, + 24, and 32 respectively). See http://www.linuxtv.org + for more info (V4L api). + + For tv/rf tuner cards one can set the tuning mode + via tun=XXX where XXX can be one of PAL, NTSC, SECAM, + or AUTO. + + One can switch the input channel by the inp=XXX setting, + where XXX is the name of the input channel (Television, + Composite1, S-Video, etc). Use the name that is in the + information about the device that is printed at startup. + + For input channels with tuners (e.g. Television) one + can change which station is selected by the sta=XXX + setting. XXX is the station number. Currently only + the ntsc-cable-us (US cable) channels are built into + x11vnc. See the -freqtab option below to supply one + from xawtv. If XXX is greater than 500, then it is + interpreted as a raw frequency in KHz. + + Example: + + -rawfb video:br=80,w=320,h=240,fmt=RGB32,tun=NTSC,sta=47 + + one might need to add inp=Television too for the input + channel to be TV if the card doesn't come up by default + in that one. + + Note that not all video capture devices will support + all of the above settings. + + See the -pipeinput VID option below for a way to control + the settings through the VNC Viewer via keystrokes. + + As above, if you specify a "@WxHxB..." after the + <settings> string they are used verbatim: the device + is not queried for the current values. Otherwise the + device will be queried. + + Linux console: If the libvncserver LinuxVNC command is + on your system use that instead of the following method + because it will be faster and more accurate for Linux + text console. + + If the rawfb string begins with "cons" the framebuffer + device /dev/fb0 is opened (this requires the appropriate + kernel modules) and so is /dev/tty0. The latter is + used to inject keystrokes (not all are supported, + but the basic ones are). You will need to be root to + inject keystrokes. /dev/tty0 refers to the active VT, + to indicate one explicitly, use "cons2", etc. using + the VT number. Note you can change VT remotely using + the chvt(1) command. Sometimes switching out and back + corrects the framebuffer. To skip injecting entirely + use "consx". + + The strings "console", or "/dev/fb0" can be used + instead of "cons". The latter can be used to specify + a different framebuffer device, e.g. /dev/fb1. If the + name is something nonstandard, use "cons:/dev/foofb" + + If you do not want x11vnc to guess the framebuffer's + WxHxB and masks automatically, specify them with a + @WxHxB at the end of the string. - If you don't want x11vnc to close the X DISPLAY in - rawfb mode, then capitalize the prefix, SHM:, MAP:, - FILE: Keeping the display open enables the default - remote-control channel, which could be useful. Also, - if you also specify -noviewonly, then the mouse and - keyboard input are STILL sent to the X display, this - usage should be very rare, i.e. doing something strange - with /dev/fb0. + Examples: + -rawfb cons (same as -rawfb console) + -rawfb /dev/fb0 (same) + -rawfb cons3 (force /dev/tty3) + -rawfb consx (no keystrokes) + -rawfb console:/dev/nonstd + +-freqtab file For use with "-rawfb video" for TV tuner devices to + specify station frequencies. Instead of using the built + in ntsc-cable-us mapping of station number to frequency, + use the data in file. For stations that are not + numeric, e.g. SE20, they are placed above the highest + numbered station in the order they are found. Example: + "-freqtab /usr/X11R6/share/xawtv/europe-west.list" + You can make your own freqtab by copying the xawtv + format. -pipeinput cmd Another experimental option: it lets you supply an external command in "cmd" that x11vnc will pipe @@ -8964,6 +9353,22 @@ Options: value is stored in X11VNC_RAWFB_STR for the pipe command to use if it wants. Do 'env | grep X11VNC' for more. + If cmd is "VID" and you are using the -rawfb for a + video capture device, then an internal list of keyboard + mappings is used to set parameters of the video. + The mappings are: + + "B" and "b" adjust the brightness up and down. + "H" and "h" adjust the hue. + "C" and "c" adjust the colour. + "N" and "n" adjust the contrast. + "S" and "s" adjust the size of the capture screen. + "I" and "i" cycle through input channels. + Up and Down arrows adjust the station (if a tuner) + F1, F2, ..., F6 will switch the video capture pixel + format to HI240, RGB565, RGB24, RGB32, RGB555, and + GREY respectively. See -rawfb video for details. + -gui [gui-opts] Start up a simple tcl/tk gui based on the the remote control options -remote/-query described below. Requires the "wish" program to be installed on the @@ -9115,6 +9520,8 @@ n 8to24 enable -8to24 mode (if applicable). no8to24 disable -8to24 mode. 8to24_opts:str set the -8to24 opts to "str". + 24to32 enable -24to32 mode (if applicable). + no24to32 disable -24to32 mode. visual:vis set -visual to "vis" scale:frac set -scale to "frac" scale_cursor:f set -scale_cursor to "f" @@ -9383,15 +9790,15 @@ n truecolor notruecolor overlay nooverlay overlay_cursor overlay_yescursor nooverlay_nocursor nooverlay_cursor nooverlay_yescursor overlay_nocursor 8to24 no8to24 - 8to24_opts visual scale scale_cursor viewonly noviewonly - shared noshared forever noforever once timeout filexfer - nofilexfer deny lock nodeny unlock connect allowonce - allow localhost nolocalhost listen lookup nolookup - accept afteraccept gone shm noshm flipbyteorder - noflipbyteorder onetile noonetile solid_color - solid nosolid blackout xinerama noxinerama xtrap - noxtrap xrandr noxrandr xrandr_mode padgeom quiet q - noquiet modtweak nomodtweak xkb noxkb skip_keycodes + 8to24_opts 24to32 no24to32 visual scale scale_cursor + viewonly noviewonly shared noshared forever noforever + once timeout filexfer nofilexfer deny lock nodeny + unlock connect allowonce allow localhost nolocalhost + listen lookup nolookup accept afteraccept gone shm + noshm flipbyteorder noflipbyteorder onetile noonetile + solid_color solid nosolid blackout xinerama noxinerama + xtrap noxtrap xrandr noxrandr xrandr_mode padgeom quiet + q noquiet modtweak nomodtweak xkb noxkb skip_keycodes sloppy_keys nosloppy_keys skip_dups noskip_dups add_keysyms noadd_keysyms clear_mods noclear_mods clear_keys noclear_keys remap repeat norepeat fb nofb diff --git a/x11vnc/connections.c b/x11vnc/connections.c index 7d23c42..0dcebe2 100644 --- a/x11vnc/connections.c +++ b/x11vnc/connections.c @@ -13,6 +13,7 @@ #include "scan.h" #include "sslcmds.h" #include "sslhelper.h" +#include "xwrappers.h" /* * routines for handling incoming, outgoing, etc connections @@ -864,7 +865,7 @@ static unsigned char t2x2_bits[] = { KeyCode key_o; - if (raw_fb && ! dpy) return 0; /* raw_fb hack */ + RAWFB_RET(0) if (! accept) { sprintf(str_y, "OK"); @@ -951,7 +952,7 @@ static unsigned char t2x2_bits[] = { XSetDashes(dpy, gc, 0, dash_list, list_length); XMapWindow(dpy, awin); - XFlush(dpy); + XFlush_wr(dpy); if (accept) { snprintf(strh, 100, "x11vnc: accept connection from %s?", addr); @@ -1107,7 +1108,7 @@ static unsigned char t2x2_bits[] = { XUnmapWindow(dpy, awin); XFreeGC(dpy, gc); XDestroyWindow(dpy, awin); - XFlush(dpy); + XFlush_wr(dpy); break; } } @@ -1438,7 +1439,12 @@ static void check_connect_file(char *file) { } else { rfbLog("read connect file: %s\n", str); } - client_connect = str; + if (!strcmp(str, "cmd=stop") && + dnow() - x11vnc_start < 3.0) { + rfbLog("ignoring stale cmd=stop\n"); + } else { + client_connect = str; + } } } } @@ -1586,11 +1592,13 @@ void reverse_connect(char *str) { * for changes. The vncconnect(1) will set it on our X display. */ void set_vnc_connect_prop(char *str) { + RAWFB_RET_VOID XChangeProperty(dpy, rootwin, vnc_connect_prop, XA_STRING, 8, PropModeReplace, (unsigned char *)str, strlen(str)); } void set_x11vnc_remote_prop(char *str) { + RAWFB_RET_VOID XChangeProperty(dpy, rootwin, x11vnc_remote_prop, XA_STRING, 8, PropModeReplace, (unsigned char *)str, strlen(str)); } @@ -1609,6 +1617,7 @@ void read_vnc_connect_prop(int nomsg) { /* not active or problem with VNC_CONNECT atom */ return; } + RAWFB_RET_VOID /* read the property value into vnc_connect_str: */ do { @@ -1654,6 +1663,7 @@ void read_x11vnc_remote_prop(int nomsg) { /* not active or problem with X11VNC_REMOTE atom */ return; } + RAWFB_RET_VOID /* read the property value into x11vnc_remote_str: */ do { diff --git a/x11vnc/cursor.c b/x11vnc/cursor.c index eff8210..e9a2d54 100644 --- a/x11vnc/cursor.c +++ b/x11vnc/cursor.c @@ -824,6 +824,8 @@ static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) { int nm_info = 1; XErrorHandler old_handler; + RAWFB_RET_VOID + X_LOCK; if (!strcmp(s, "default") || !strcmp(s, "X") || !strcmp(s, "arrow")) { @@ -1208,7 +1210,7 @@ static int get_xfixes_cursor(int init) { return -1; } - if (xfixes_present) { + if (xfixes_present && dpy) { #if LIBVNCSERVER_HAVE_LIBXFIXES int use, oldest, i; time_t oldtime, now; @@ -1388,6 +1390,7 @@ void initialize_cursors_mode(void) { int get_which_cursor(void) { int which = CURS_ARROW; + int db = 0; if (show_multiple_cursors) { int depth; @@ -1416,6 +1419,7 @@ int get_which_cursor(void) { } if (mode == 3 && xfixes_present && use_xfixes) { + if (db) fprintf(stderr, "get_which_cursor call get_xfixes_cursor\n"); return get_xfixes_cursor(0); } @@ -1444,7 +1448,7 @@ int get_which_cursor(void) { int which0 = which; /* apply crude heuristics to choose a cursor... */ - if (win) { + if (win && dpy) { int ratio = 10, x, y; unsigned int w, h, bw, d; Window r; @@ -1495,6 +1499,7 @@ int get_which_cursor(void) { } } } + if (db) fprintf(stderr, "get_which_cursor which: %d\n", which); return which; } @@ -1768,7 +1773,7 @@ int check_x11_pointer(void) { int x, y; unsigned int mask; - if (raw_fb && ! dpy) return 0; /* raw_fb hack */ + RAWFB_RET(0) if (unixpw_in_progress) return 0; diff --git a/x11vnc/gui.c b/x11vnc/gui.c index 0727bec..5c69b91 100644 --- a/x11vnc/gui.c +++ b/x11vnc/gui.c @@ -70,6 +70,8 @@ int tray_embed(Window iconwin, int remove) { long info[2] = {XEMBED_VERSION, XEMBED_MAPPED}; long data = 0; + RAWFB_RET(0) + if (remove) { if (!valid_window(iconwin, &attr, 1)) { return 0; @@ -156,6 +158,8 @@ static int tray_manager_running(Display *d, Window *manager) { Atom tray_manager; Window tray_win; + RAWFB_RET(0) + if (manager) { *manager = None; } diff --git a/x11vnc/help.c b/x11vnc/help.c index 1986e7e..c070323 100644 --- a/x11vnc/help.c +++ b/x11vnc/help.c @@ -228,9 +228,22 @@ void print_help(int mode) { " this machine -overlay is supported and gives better\n" " response.\n" "\n" -" Debugging for this mode can be enabled by setting \n" +" Debugging for this mode can be enabled by setting\n" " \"dbg=1\", \"dbg=2\", or \"dbg=3\".\n" "\n" +"-24to32 Very rare problem: if the framebuffer (X display\n" +" or -rawfb) is 24bpp instead of the usual 32bpp, then\n" +" dynamically transform the pixels to 32bpp. This will be\n" +" slower, but can be used to work around problems where\n" +" VNC viewers cannot handle 24bpp (e.g. \"main: setPF:\n" +" not 8, 16 or 32 bpp?\"). See the FAQ for more info.\n" +"\n" +" In the case of -rawfb mode, the pixels are directly\n" +" modified by inserting a 0 byte to pad them out to 32bpp.\n" +" For X displays, a kludge is done that is equivalent to\n" +" \"-noshm -visual TrueColor:32\". (If better performance\n" +" is needed for the latter, feel free to ask).\n" +"\n" "-scale fraction Scale the framebuffer by factor \"fraction\". Values\n" " less than 1 shrink the fb, larger ones expand it. Note:\n" " image may not be sharp and response may be slower.\n" @@ -2154,13 +2167,17 @@ void print_help(int mode) { " or where window tearing is a problem.\n" "\n" "-rawfb string Experimental option, instead of polling X, poll the\n" -" memory object specified in \"string\". For shared\n" -" memory segments it is of the form: \"shm:N@WxHxB\"\n" -" which specifies a shmid N and framebuffer Width, Height,\n" -" and Bits per pixel. To memory map mmap(2) a file use:\n" +" memory object specified in \"string\".\n" +"\n" +" For shared memory segments string is of the\n" +" form: \"shm:N@WxHxB\" which specifies a shmid\n" +" N and framebuffer Width, Height, and Bits\n" +" per pixel. To memory map mmap(2) a file use:\n" " \"map:/path/to/a/file@WxHxB\". If there is trouble\n" -" with mmap, use \"file:/...\" for slower lseek(2)\n" -" based reading. If you do not supply a type \"map\"\n" +" with mmap, use \"file:/...\" for slower lseek(2) based\n" +" reading. Use \"snap:...\" to imply -snapfb mode and the\n" +" \"file:\" access (this is for devices that only provide\n" +" the fb all at once). If you do not supply a type \"map\"\n" " is assumed if the file exists.\n" "\n" " If string is \"setup:cmd\", then the command \"cmd\"\n" @@ -2169,6 +2186,14 @@ void print_help(int mode) { " determining WxHxB, etc. These are often done as root\n" " so take care.\n" "\n" +" If the string begins with \"video\", see the video4linux\n" +" discusion below where the device may be queried for\n" +" (and possibly set) the framebuffer parameters.\n" +"\n" +" If the strings begins with \"cons\", see the linux\n" +" console discussion below where the framebuffer device\n" +" is opened and keystrokes are inserted into the console.\n" +"\n" " Optional suffixes are \":R/G/B\" and \"+O\" to specify\n" " red, green, and blue masks and an offset into the\n" " memory object. If the masks are not provided x11vnc\n" @@ -2179,6 +2204,11 @@ void print_help(int mode) { " -rawfb map:/dev/fb0@1024x768x32\n" " -rawfb map:/tmp/Xvfb_screen0@640x480x8+3232\n" " -rawfb file:/tmp/my.pnm@250x200x24+37\n" +" -rawfb file:/dev/urandom@128x128x8\n" +" -rawfb snap:/dev/video0@320x240x24 -24to32\n" +" -rawfb video0\n" +" -rawfb video -pipeinput VID\n" +" -rawfb console\n" "\n" " (see ipcs(1) and fbset(1) for the first two examples)\n" "\n" @@ -2186,16 +2216,157 @@ void print_help(int mode) { " -pipeinput option). Most of the X11 (screen, keyboard,\n" " mouse) options do not make sense and many will cause\n" " this mode to crash, so please think twice before\n" -" setting/changing them.\n" +" setting or changing them in a running x11vnc.\n" +"\n" +" If you DO NOT want x11vnc to close the X DISPLAY in\n" +" rawfb mode, prepend a \"+\" e.g. +file:/dev/fb0...\n" +" Keeping the display open enables the default\n" +" remote-control channel, which could be useful.\n" +" Alternatively, if you specify -noviewonly, then the\n" +" mouse and keyboard input are STILL sent to the X\n" +" display, this usage should be very rare, i.e. doing\n" +" something strange with /dev/fb0.\n" +"\n" +" If the device is not \"seekable\" try reading it all\n" +" at once in full snaps via the \"snap:\" mode (note:\n" +" this is a resource hog). If you are using file: or\n" +" map: and the device needs to be reopened for *every*\n" +" snapfb snapshot, set the environment variable:\n" +" SNAPFB_RAWFB_RESET=1 as well.\n" +"\n" +" If you want x11vnc to dynamically transform a 24bpp\n" +" rawfb to 32bpp (note that this will be slower) use\n" +" the -24to32 option. This would be useful for, say,\n" +" for a video camera that delivers the pixel data as\n" +" 24bpp packed RGB. This is the default under \"video\"\n" +" mode if the bpp is 24.\n" +"\n" +" video4linux: on Linux some attempt is made to handle\n" +" video devices (webcams or tv tuners) automatically.\n" +" The idea is the WxHxB will be extracted from the\n" +" device itself. So if you do not supply \"@WxHxB...\n" +" parameters x11vnc will try to determine them. It first\n" +" tries the v4l API if that support has been compiled in.\n" +" Otherwise it will run the v4l-info(1) external program\n" +" if it is available.\n" +"\n" +" The simplest examples are \"-rawfb video\" and \"-rawfb\n" +" video1\" which imply the device file /dev/video and\n" +" /dev/video1, respectively. You can also supply the\n" +" /dev if you like, e.g. \"-rawfb /dev/video0\"\n" +"\n" +" Since the video capture device framebuffer usually\n" +" changes continuously (e.g. brightness fluctuations),\n" +" you may want to use the -wait, -slow_fb, or -defer\n" +" options to lower the \"framerate\" to cut down on\n" +" network VNC traffic.\n" +"\n" +" A more sophisticated video device scheme allows\n" +" initializing the device's settings using:\n" +"\n" +" -rawfb video:<settings>\n" +"\n" +" The prefix could also be, as above, e.g. \"video1:\" to\n" +" specify the device file. The v4l API must be available\n" +" for this to work. Otherwise, you will need to try\n" +" to initialize the device with an external program,\n" +" e.g. xawtv, spcaview, and hope they persist when x11vnc\n" +" re-opens the device.\n" +"\n" +" <settings> is a comma separated list of key=value pairs.\n" +" The device's brightness, color, contrast, and hue can\n" +" be set to percentages, e.g. br=80,co=50,cn=44,hu=60.\n" +"\n" +" The device filename can be set too if needed (if it\n" +" does not start with \"video\"), e.g. fn=/dev/qcam.\n" +"\n" +" The width, height and bpp of the framebuffer can be\n" +" set via, e.g., w=160,h=120,bpp=16.\n" +"\n" +" Related to the bpp above, the pixel format can be set\n" +" via the fmt=XXX, where XXX can be one of: GREY, HI240,\n" +" RGB555, RGB565, RGB24, and RGB32 (with bpp 8, 8, 16, 16,\n" +" 24, and 32 respectively). See http://www.linuxtv.org\n" +" for more info (V4L api).\n" +"\n" +" For tv/rf tuner cards one can set the tuning mode\n" +" via tun=XXX where XXX can be one of PAL, NTSC, SECAM,\n" +" or AUTO.\n" +"\n" +" One can switch the input channel by the inp=XXX setting,\n" +" where XXX is the name of the input channel (Television,\n" +" Composite1, S-Video, etc). Use the name that is in the\n" +" information about the device that is printed at startup.\n" +"\n" +" For input channels with tuners (e.g. Television) one\n" +" can change which station is selected by the sta=XXX\n" +" setting. XXX is the station number. Currently only\n" +" the ntsc-cable-us (US cable) channels are built into\n" +" x11vnc. See the -freqtab option below to supply one\n" +" from xawtv. If XXX is greater than 500, then it is\n" +" interpreted as a raw frequency in KHz.\n" +"\n" +" Example:\n" +"\n" +" -rawfb video:br=80,w=320,h=240,fmt=RGB32,tun=NTSC,sta=47\n" +"\n" +" one might need to add inp=Television too for the input\n" +" channel to be TV if the card doesn't come up by default\n" +" in that one.\n" +"\n" +" Note that not all video capture devices will support\n" +" all of the above settings.\n" +"\n" +" See the -pipeinput VID option below for a way to control\n" +" the settings through the VNC Viewer via keystrokes.\n" +"\n" +" As above, if you specify a \"@WxHxB...\" after the\n" +" <settings> string they are used verbatim: the device\n" +" is not queried for the current values. Otherwise the\n" +" device will be queried.\n" +"\n" +" Linux console: If the libvncserver LinuxVNC command is\n" +" on your system use that instead of the following method\n" +" because it will be faster and more accurate for Linux\n" +" text console.\n" +"\n" +" If the rawfb string begins with \"cons\" the framebuffer\n" +" device /dev/fb0 is opened (this requires the appropriate\n" +" kernel modules) and so is /dev/tty0. The latter is\n" +" used to inject keystrokes (not all are supported,\n" +" but the basic ones are). You will need to be root to\n" +" inject keystrokes. /dev/tty0 refers to the active VT,\n" +" to indicate one explicitly, use \"cons2\", etc. using\n" +" the VT number. Note you can change VT remotely using\n" +" the chvt(1) command. Sometimes switching out and back\n" +" corrects the framebuffer. To skip injecting entirely\n" +" use \"consx\".\n" +"\n" +" The strings \"console\", or \"/dev/fb0\" can be used\n" +" instead of \"cons\". The latter can be used to specify\n" +" a different framebuffer device, e.g. /dev/fb1. If the\n" +" name is something nonstandard, use \"cons:/dev/foofb\"\n" +"\n" +" If you do not want x11vnc to guess the framebuffer's\n" +" WxHxB and masks automatically, specify them with a\n" +" @WxHxB at the end of the string.\n" "\n" -" If you don't want x11vnc to close the X DISPLAY in\n" -" rawfb mode, then capitalize the prefix, SHM:, MAP:,\n" -" FILE: Keeping the display open enables the default\n" -" remote-control channel, which could be useful. Also,\n" -" if you also specify -noviewonly, then the mouse and\n" -" keyboard input are STILL sent to the X display, this\n" -" usage should be very rare, i.e. doing something strange\n" -" with /dev/fb0.\n" +" Examples:\n" +" -rawfb cons (same as -rawfb console)\n" +" -rawfb /dev/fb0 (same)\n" +" -rawfb cons3 (force /dev/tty3)\n" +" -rawfb consx (no keystrokes)\n" +" -rawfb console:/dev/nonstd\n" +"\n" +"-freqtab file For use with \"-rawfb video\" for TV tuner devices to\n" +" specify station frequencies. Instead of using the built\n" +" in ntsc-cable-us mapping of station number to frequency,\n" +" use the data in file. For stations that are not\n" +" numeric, e.g. SE20, they are placed above the highest\n" +" numbered station in the order they are found. Example:\n" +" \"-freqtab /usr/X11R6/share/xawtv/europe-west.list\"\n" +" You can make your own freqtab by copying the xawtv\n" +" format.\n" "\n" "-pipeinput cmd Another experimental option: it lets you supply an\n" " external command in \"cmd\" that x11vnc will pipe\n" @@ -2214,6 +2385,22 @@ void print_help(int mode) { " value is stored in X11VNC_RAWFB_STR for the pipe command\n" " to use if it wants. Do 'env | grep X11VNC' for more.\n" "\n" +" If cmd is \"VID\" and you are using the -rawfb for a\n" +" video capture device, then an internal list of keyboard\n" +" mappings is used to set parameters of the video.\n" +" The mappings are:\n" +"\n" +" \"B\" and \"b\" adjust the brightness up and down.\n" +" \"H\" and \"h\" adjust the hue.\n" +" \"C\" and \"c\" adjust the colour.\n" +" \"N\" and \"n\" adjust the contrast.\n" +" \"S\" and \"s\" adjust the size of the capture screen.\n" +" \"I\" and \"i\" cycle through input channels.\n" +" Up and Down arrows adjust the station (if a tuner)\n" +" F1, F2, ..., F6 will switch the video capture pixel\n" +" format to HI240, RGB565, RGB24, RGB32, RGB555, and\n" +" GREY respectively. See -rawfb video for details.\n" +"\n" "-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote\n" " control options -remote/-query described below.\n" " Requires the \"wish\" program to be installed on the\n" @@ -2365,6 +2552,8 @@ void print_help(int mode) { " 8to24 enable -8to24 mode (if applicable).\n" " no8to24 disable -8to24 mode.\n" " 8to24_opts:str set the -8to24 opts to \"str\".\n" +" 24to32 enable -24to32 mode (if applicable).\n" +" no24to32 disable -24to32 mode.\n" " visual:vis set -visual to \"vis\"\n" " scale:frac set -scale to \"frac\"\n" " scale_cursor:f set -scale_cursor to \"f\"\n" @@ -2639,15 +2828,15 @@ void print_help(int mode) { " truecolor notruecolor overlay nooverlay overlay_cursor\n" " overlay_yescursor nooverlay_nocursor nooverlay_cursor\n" " nooverlay_yescursor overlay_nocursor 8to24 no8to24\n" -" 8to24_opts visual scale scale_cursor viewonly noviewonly\n" -" shared noshared forever noforever once timeout filexfer\n" -" nofilexfer deny lock nodeny unlock connect allowonce\n" -" allow localhost nolocalhost listen lookup nolookup\n" -" accept afteraccept gone shm noshm flipbyteorder\n" -" noflipbyteorder onetile noonetile solid_color\n" -" solid nosolid blackout xinerama noxinerama xtrap\n" -" noxtrap xrandr noxrandr xrandr_mode padgeom quiet q\n" -" noquiet modtweak nomodtweak xkb noxkb skip_keycodes\n" +" 8to24_opts 24to32 no24to32 visual scale scale_cursor\n" +" viewonly noviewonly shared noshared forever noforever\n" +" once timeout filexfer nofilexfer deny lock nodeny\n" +" unlock connect allowonce allow localhost nolocalhost\n" +" listen lookup nolookup accept afteraccept gone shm\n" +" noshm flipbyteorder noflipbyteorder onetile noonetile\n" +" solid_color solid nosolid blackout xinerama noxinerama\n" +" xtrap noxtrap xrandr noxrandr xrandr_mode padgeom quiet\n" +" q noquiet modtweak nomodtweak xkb noxkb skip_keycodes\n" " sloppy_keys nosloppy_keys skip_dups noskip_dups\n" " add_keysyms noadd_keysyms clear_mods noclear_mods\n" " clear_keys noclear_keys remap repeat norepeat fb nofb\n" diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c index 6a0ccc7..7e1f952 100644 --- a/x11vnc/keyboard.c +++ b/x11vnc/keyboard.c @@ -11,6 +11,8 @@ #include "cleanup.h" #include "allowed_input_t.h" #include "unixpw.h" +#include "v4l.h" +#include "linuxfb.h" void get_keystate(int *keystate); void clear_modifiers(int init); @@ -54,6 +56,8 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client); void get_keystate(int *keystate) { int i, k; char keys[32]; + + RAWFB_RET_VOID /* n.b. caller decides to X_LOCK or not. */ XQueryKeymap(dpy, keys); @@ -85,6 +89,8 @@ void clear_modifiers(int init) { KeySym keysym; KeyCode keycode; + RAWFB_RET_VOID + /* n.b. caller decides to X_LOCK or not. */ if (first) { /* @@ -134,7 +140,7 @@ void clear_modifiers(int init) { } XTestFakeKeyEvent_wr(dpy, keycode, False, CurrentTime); } - XFlush(dpy); + XFlush_wr(dpy); } static KeySym simple_mods[] = { @@ -211,6 +217,8 @@ int track_mod_state(rfbKeySym keysym, rfbBool down, rfbBool set) { */ void clear_keys(void) { int k, keystate[256]; + + RAWFB_RET_VOID /* n.b. caller decides to X_LOCK or not. */ get_keystate(keystate); @@ -221,7 +229,7 @@ void clear_keys(void) { XTestFakeKeyEvent_wr(dpy, keycode, False, CurrentTime); } } - XFlush(dpy); + XFlush_wr(dpy); } /* @@ -238,6 +246,9 @@ static int save_auto_repeat = -1; int get_autorepeat_state(void) { XKeyboardState kstate; + + RAWFB_RET(0) + X_LOCK; XGetKeyboardControl(dpy, &kstate); X_UNLOCK; @@ -255,7 +266,7 @@ void autorepeat(int restore, int bequiet) { int global_auto_repeat; XKeyboardControl kctrl; - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (restore) { if (save_auto_repeat < 0) { @@ -271,7 +282,7 @@ void autorepeat(int restore, int bequiet) { kctrl.auto_repeat_mode = save_auto_repeat; XChangeKeyboardControl(dpy, KBAutoRepeatMode, &kctrl); - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; if (! bequiet && ! quiet) { @@ -291,7 +302,7 @@ void autorepeat(int restore, int bequiet) { X_LOCK; kctrl.auto_repeat_mode = AutoRepeatModeOff; XChangeKeyboardControl(dpy, KBAutoRepeatMode, &kctrl); - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; if (! bequiet && ! quiet) { @@ -352,7 +363,7 @@ int add_keysym(KeySym keysym) { first = 0; } - if (raw_fb && ! dpy) return 0; /* raw_fb hack */ + RAWFB_RET(0) if (keysym == NoSymbol) { return 0; @@ -419,7 +430,7 @@ int add_keysym(KeySym keysym) { } } - XFlush(dpy); + XFlush_wr(dpy); added_keysyms[kc] = keysym; ret = kc; break; @@ -434,7 +445,7 @@ static void delete_keycode(KeyCode kc, int bequiet) { KeySym ksym, new[8]; char *str; - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID XDisplayKeycodes(dpy, &minkey, &maxkey); keymap = XGetKeyboardMapping(dpy, minkey, (maxkey - minkey + 1), @@ -454,7 +465,7 @@ static void delete_keycode(KeyCode kc, int bequiet) { } XFree(keymap); - XFlush(dpy); + XFlush_wr(dpy); } static int count_added_keycodes(void) { @@ -599,7 +610,7 @@ static void add_dead_keysyms(char *str) { inmap = 1; } #if LIBVNCSERVER_HAVE_XKEYBOARD - if (! inmap && xkb_present) { + if (! inmap && xkb_present && dpy) { int kc, grp, lvl; for (kc = 0; kc < 0x100; kc++) { for (grp = 0; grp < 4; grp++) { @@ -753,6 +764,8 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) { if (!sloppy_keys) { return 0; } + + RAWFB_RET(0) if (!down && !keycode_state[key] && !IsModifierKey(keysym)) { int i, cnt = 0, downkey = -1; @@ -863,6 +876,7 @@ void switch_to_xkb_if_better(void) { /* already using it */ return; } + RAWFB_RET_VOID XDisplayKeycodes(dpy, &minkey, &maxkey); @@ -1110,6 +1124,8 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store * */ + RAWFB_RET_VOID + /* initialize all the arrays: */ for (kc = 0; kc < 0x100; kc++) { multi_key[kc] = 0; @@ -1414,6 +1430,8 @@ static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym, if (client) {} /* unused vars warning: */ + RAWFB_RET_VOID + X_LOCK; if (debug_keyboard) { @@ -2144,6 +2162,8 @@ void initialize_modtweak(void) { keycodes[i] = NoSymbol; } + RAWFB_RET_VOID + X_LOCK; XDisplayKeycodes(dpy, &minkey, &maxkey); @@ -2230,6 +2250,8 @@ static void tweak_mod(signed char mod, rfbBool down) { Bool dn = (Bool) down; KeyCode altgr = altgr_code; + RAWFB_RET_VOID + if (mod < 0) { if (debug_keyboard) { rfbLog("tweak_mod: Skip: down=%d index=%d\n", down, @@ -2281,6 +2303,8 @@ static void modifier_tweak_keyboard(rfbBool down, rfbKeySym keysym, KeyCode k; int tweak = 0; + RAWFB_RET_VOID + if (use_xkb_modtweak) { xkb_tweak_keyboard(down, keysym, client); return; @@ -2344,7 +2368,7 @@ static void modifier_tweak_keyboard(rfbBool down, rfbKeySym keysym, void initialize_keyboard_and_pointer(void) { - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (use_modifier_tweak) { initialize_modtweak(); @@ -2417,6 +2441,12 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { char *name; ClientData *cd = (ClientData *) client->clientData; + if (pipeinput_int == PIPEINPUT_VID) { + v4l_key_command(down, keysym, client); + } + if (pipeinput_int == PIPEINPUT_CONS) { + console_key_command(down, keysym, client); + } if (pipeinput_fh == NULL) { return; } @@ -2698,7 +2728,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { skipped_last_down = 0; last_rfb_key_accepted = TRUE; - if (pipeinput_fh != NULL) { + if (pipeinput_fh != NULL || pipeinput_int) { pipe_keyboard(down, keysym, client); if (! pipeinput_tee) { if (! view_only || raw_fb) { /* raw_fb hack */ @@ -2742,7 +2772,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { got_user_input++; got_keyboard_input++; - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (keyremaps) { keyremap_t *remap = keyremaps; @@ -2810,7 +2840,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { do_button_mask_change(mask, button); /* down */ mask = 0; do_button_mask_change(mask, button); /* up */ - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; return; } @@ -2818,7 +2848,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { if (use_modifier_tweak) { modifier_tweak_keyboard(down, keysym, client); X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; return; } @@ -2842,7 +2872,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { if ( k != NoSymbol ) { XTestFakeKeyEvent_wr(dpy, k, (Bool) down, CurrentTime); - XFlush(dpy); + XFlush_wr(dpy); } X_UNLOCK; diff --git a/x11vnc/linuxfb.c b/x11vnc/linuxfb.c new file mode 100644 index 0000000..2f4e0be --- /dev/null +++ b/x11vnc/linuxfb.c @@ -0,0 +1,234 @@ +/* -- linuxfb.c -- */ + +#include "x11vnc.h" +#include "cleanup.h" +#include "scan.h" +#include "xinerama.h" +#include "screen.h" +#include "pointer.h" + +#if LIBVNCSERVER_HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif +#if LIBVNCSERVER_HAVE_LINUX_FB_H +#include <linux/fb.h> +#endif + +char *console_guess(char *str, int *fd); +void console_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); +void console_pointer_command(int mask, int x, int y, rfbClientPtr client); + +char *console_guess(char *str, int *fd) { + char *q, *in = strdup(str); + char *atparms = NULL, *file = NULL; + int tty = -1; + if (strstr(in, "/dev/fb") == in) { + free(in); + in = (char *) malloc(strlen("cons:") + strlen(str) + 1); + sprintf(in, "cons:%s", str); + } else if (strstr(in, "fb") == in) { + free(in); + in = (char *) malloc(strlen("cons:/dev/") + strlen(str) + 1); + sprintf(in, "cons:/dev/%s", str); + } + + if (strstr(in, "cons") != in) { + rfbLog("console_guess: unrecognized console/fb format: %s\n", str); + free(in); + return NULL; + } + + q = strrchr(in, '@'); + if (q) { + atparms = strdup(q+1); + *q = '\0'; + } + q = strrchr(in, ':'); + if (q) { + file = strdup(q+1); + *q = '\0'; + } + if (! file || file[0] == '\0') { + file = strdup("/dev/fb"); + } + if (strstr(file, "fb") == file) { + q = (char *) malloc(strlen("/dev/") + strlen(file) + 1); + sprintf(q, "/dev/%s", file); + free(file); + file = q; + } + if (!strcmp(file, "/dev/fb")) { + /* sometimes no sylink fb -> fb0 */ + struct stat sbuf; + if (stat(file, &sbuf) != 0) { + free(file); + file = strdup("/dev/fb0"); + } + } + rfbLog("console_guess: file is %s\n", file); + + if (!strcmp(in, "cons") || !strcmp(in, "console")) { + /* current active VT: */ + tty = 0; + } else { + int n; + if (sscanf(in, "cons%d", &n) == 1) { + tty = n; + } else if (sscanf(in, "console%d", &n) != 1) { + tty = n; + } + } + if (tty >=0 && tty < 64) { + if (pipeinput_str == NULL) { + pipeinput_str = (char *) malloc(10); + sprintf(pipeinput_str, "CONS%d", tty); + rfbLog("console_guess: file pipeinput %s\n", pipeinput_str); + initialize_pipeinput(); + } + } + if (! atparms) { +#if LIBVNCSERVER_HAVE_LINUX_FB_H +#if LIBVNCSERVER_HAVE_SYS_IOCTL_H + struct fb_var_screeninfo var_info; + int d = open(file, O_RDWR); + if (d >= 0) { + int w, h, b; + unsigned long rm = 0, gm = 0, bm = 0; + if (ioctl(d, FBIOGET_VSCREENINFO, &var_info) != -1) { + w = (int) var_info.xres; + h = (int) var_info.yres; + b = (int) var_info.bits_per_pixel; + + rm = (1 << var_info.red.length) - 1; + gm = (1 << var_info.green.length) - 1; + bm = (1 << var_info.blue.length) - 1; + rm = rm << var_info.red.offset; + gm = gm << var_info.green.offset; + bm = bm << var_info.blue.offset; + + if (b == 8 && rm == 0xff && gm == 0xff && bm == 0xff) { + /* I don't believe it... */ + rm = 0x07; + gm = 0x38; + bm = 0xc0; + } + + /* @66666x66666x32:0xffffffff:... */ + atparms = (char *) malloc(200); + sprintf(atparms, "%dx%dx%d:%lx/%lx/%lx", + w, h, b, rm, gm, bm); + *fd = d; + } else { + perror("ioctl"); + close(d); + } + } else { + rfbLog("could not open: %s\n", file); + perror("open"); + close(d); + } +#endif +#endif + } + + if (! atparms) { + rfbLog("console_guess: could not get @ parameters.\n"); + return NULL; + } + + q = (char *) malloc(strlen("map:") + strlen(file) + 1 + strlen(atparms) + 1); + sprintf(q, "map:%s@%s", file, atparms); + return q; +} + +void console_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { + static int control = 0; + if (debug_keyboard) fprintf(stderr, "console_key_command: %d %s\n", (int) keysym, down ? "down" : "up"); + if (pipeinput_cons_fd < 0) { + return; + } + + /* From LinuxVNC.c: */ + if (keysym == XK_Control_L || keysym == XK_Control_R) { + if (! down) { + if (control > 0) { + control--; + } + } else { + control++; + } + return; + } + if (!down) { + return; + } + if (keysym == XK_Escape) { + keysym = 27; + } + if (control) { + if (keysym >= 'a' && keysym <= 'z') { + keysym -= ('a' - 1); + } else if (keysym >= 'A' && keysym <= 'Z') { + keysym -= ('A' - 1); + } else { + keysym = 0xffff; + } + } + if (keysym == XK_Tab) { + keysym = '\t'; + } else if (keysym == XK_Return) { + keysym = '\r'; + } else if (keysym == XK_BackSpace) { + keysym = 8; + } else if (keysym == XK_Home || keysym == XK_KP_Home) { + keysym = 1; + } else if (keysym == XK_End || keysym == XK_KP_End) { + keysym = 5; + } else if (keysym == XK_Up || keysym == XK_KP_Up) { + keysym = 16; + } else if (keysym == XK_Down || keysym == XK_KP_Down) { + keysym = 14; + } else if (keysym == XK_Right || keysym == XK_KP_Right) { + keysym = 6; + } else if (keysym == XK_Next || keysym == XK_KP_Next) { + keysym = 6; + } else if (keysym == XK_Left || keysym == XK_KP_Left) { + keysym = 2; + } else if (keysym == XK_Prior || keysym == XK_KP_Prior) { + keysym = 2; + } +#if LIBVNCSERVER_HAVE_SYS_IOCTL_H && defined(TIOCSTI) + if (keysym < 0x100) { + if (ioctl(pipeinput_cons_fd, TIOCSTI, &keysym) != -1) { + return; + } + perror("ioctl"); + close(pipeinput_cons_fd); + pipeinput_cons_fd = -1; + if (! pipeinput_cons_dev) { + return; + } + pipeinput_cons_fd = open(pipeinput_cons_dev, O_WRONLY); + if (pipeinput_cons_fd < 0) { + rfbLog("pipeinput: could not reopen %s\n", + pipeinput_cons_dev); + perror("open"); + return; + } + if (ioctl(pipeinput_cons_fd, TIOCSTI, &keysym) == -1) { + perror("ioctl"); + close(pipeinput_cons_fd); + pipeinput_cons_fd = -1; + rfbLog("pipeinput: could not reopen %s\n", + pipeinput_cons_dev); + } + } +#endif + + if (client) {} +} + +void console_pointer_command(int mask, int x, int y, rfbClientPtr client) { + if (mask || x || y || client) {} +} + diff --git a/x11vnc/linuxfb.h b/x11vnc/linuxfb.h new file mode 100644 index 0000000..146d8a4 --- /dev/null +++ b/x11vnc/linuxfb.h @@ -0,0 +1,10 @@ +#ifndef _X11VNC_LINUXFB_H +#define _X11VNC_LINUXFB_H + +/* -- linuxfb.h -- */ +extern char *console_guess(char *str, int *fd); +extern void console_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); +extern void console_pointer_command(int mask, int x, int y, rfbClientPtr client); + + +#endif /* _X11VNC_LINUXFB_H */ diff --git a/x11vnc/options.c b/x11vnc/options.c index a4ddee5..b270547 100644 --- a/x11vnc/options.c +++ b/x11vnc/options.c @@ -11,6 +11,7 @@ int debug = 0; char *use_dpy = NULL; /* -display */ char *auth_file = NULL; /* -auth/-xauth */ char *visual_str = NULL; /* -visual */ +int set_visual_str_to_something = 0; char *logfile = NULL; /* -o, -logfile */ int logfile_append = 0; char *flagfile = NULL; /* -flag */ @@ -102,6 +103,7 @@ int flash_cmap = 0; /* follow installed colormaps */ int shift_cmap = 0; /* ncells < 256 and needs shift of pixel values */ int force_indexed_color = 0; /* whether to force indexed color for 8bpp */ int cmap8to24 = 0; /* -8to24 */ +int xform24to32 = 0; /* -24to32 */ char *cmap8to24_str = NULL; int launch_gui = 0; /* -gui */ @@ -110,10 +112,15 @@ int use_iso_level3 = 0; /* ISO_Level3_Shift instead of Mode_switch */ int clear_mods = 0; /* -clear_mods (1) and -clear_keys (2) */ int nofb = 0; /* do not send any fb updates */ char *raw_fb_str = NULL; /* used under -rawfb */ +char *raw_fb_pixfmt = NULL; +char *freqtab = NULL; char *pipeinput_str = NULL; /* -pipeinput [tee,reopen,keycodes:]cmd */ char *pipeinput_opts = NULL; FILE *pipeinput_fh = NULL; int pipeinput_tee = 0; +int pipeinput_int = 0; +int pipeinput_cons_fd = -1; +char *pipeinput_cons_dev = NULL; unsigned long subwin = 0x0; /* -id, -sid */ int subwin_wait_mapped = 0; diff --git a/x11vnc/options.h b/x11vnc/options.h index a0976af..a4c2cc9 100644 --- a/x11vnc/options.h +++ b/x11vnc/options.h @@ -11,6 +11,7 @@ extern int debug; extern char *use_dpy; extern char *auth_file; extern char *visual_str; +extern int set_visual_str_to_something; extern char *logfile; extern int logfile_append; extern char *flagfile; @@ -78,6 +79,7 @@ extern int shift_cmap; extern int force_indexed_color; extern int cmap8to24; extern char *cmap8to24_str; +extern int xform24to32; extern int launch_gui; extern int use_modifier_tweak; @@ -85,10 +87,15 @@ extern int use_iso_level3; extern int clear_mods; extern int nofb; extern char *raw_fb_str; +extern char *raw_fb_pixfmt; +extern char *freqtab; extern char *pipeinput_str; extern char *pipeinput_opts; extern FILE *pipeinput_fh; extern int pipeinput_tee; +extern int pipeinput_int; +extern int pipeinput_cons_fd; +extern char *pipeinput_cons_dev; extern unsigned long subwin; extern int subwin_wait_mapped; diff --git a/x11vnc/params.h b/x11vnc/params.h index 79f6624..2a9ea0b 100644 --- a/x11vnc/params.h +++ b/x11vnc/params.h @@ -35,4 +35,8 @@ #define MAXN 256 +#define PIPEINPUT_NONE 0x0 +#define PIPEINPUT_VID 0x1 +#define PIPEINPUT_CONS 0x2 + #endif /* _X11VNC_PARAMS_H */ diff --git a/x11vnc/pm.c b/x11vnc/pm.c index 8b3eab5..2ddb009 100644 --- a/x11vnc/pm.c +++ b/x11vnc/pm.c @@ -25,7 +25,7 @@ static void check_fbpm(void) { CARD16 level; BOOL enabled; - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (! init_fbpm) { if (FBPMCapable(dpy)) { @@ -83,7 +83,7 @@ static void check_fbpm(void) { if (db) fprintf(stderr, "FBPMInfo failed.\n"); } #else - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (! init_fbpm) { rfbLog("X FBPM extension not supported.\n"); init_fbpm = 1; diff --git a/x11vnc/pointer.c b/x11vnc/pointer.c index d2ec4c1..5abd843 100644 --- a/x11vnc/pointer.c +++ b/x11vnc/pointer.c @@ -11,6 +11,8 @@ #include "connections.h" #include "cleanup.h" #include "unixpw.h" +#include "v4l.h" +#include "linuxfb.h" int pointer_queued_sent = 0; @@ -26,7 +28,6 @@ static void update_x11_pointer_position(int x, int y); static void update_x11_pointer_mask(int mask); static void pipe_pointer(int mask, int x, int y, rfbClientPtr client); - /* * pointer event (motion and button click) handling routines. */ @@ -116,7 +117,7 @@ static void buttonparse(int from, char **s) { "keysym: %s\n", t); n--; } - } else { + } else if (dpy) { /* * XXX may not work with -modtweak or -xkb */ @@ -214,9 +215,13 @@ void initialize_pointer_map(char *pointer_remap) { * from -buttonmap option. */ - X_LOCK; - num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS); - X_UNLOCK; + if (!raw_fb_str) { + X_LOCK; + num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS); + X_UNLOCK; + } else { + num_buttons = 5; + } if (num_buttons < 0) { num_buttons = 0; @@ -284,7 +289,7 @@ void initialize_pointer_map(char *pointer_remap) { static void update_x11_pointer_position(int x, int y) { int rc; - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID X_LOCK; if (use_xwarppointer) { @@ -358,7 +363,7 @@ void do_button_mask_change(int mask, int button) { /* do not send keysym on button up */ continue; } - if (debug_pointer) { + if (debug_pointer && dpy) { rfbLog("pointer(): sending button %d " "down as keycode 0x%x (event %d)\n", i+1, key, k+1); @@ -387,7 +392,7 @@ static void update_x11_pointer_mask(int mask) { last_event = last_input = last_pointer_input = time(0); - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (mask != button_mask) { last_pointer_click_time = dnow(); @@ -513,6 +518,12 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) { ClientData *cd = (ClientData *) client->clientData; char hint[MAX_BUTTONS * 20]; + if (pipeinput_int == PIPEINPUT_VID) { + v4l_pointer_command(mask, x, y, client); + } + if (pipeinput_int == PIPEINPUT_CONS) { + console_pointer_command(mask, x, y, client); + } if (pipeinput_fh == NULL) { return; } @@ -795,7 +806,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { "%.4f\n", dnow() - x11vnc_start); } X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; } } @@ -828,13 +839,15 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { sent = 1; } - if (nofb && sent) { + if (! dpy) { + ; + } else if (nofb && sent) { /* * nofb is for, e.g. Win2VNC, where fastest pointer * updates are desired. */ X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; } else if (buffer_it) { if (debug_pointer) { @@ -842,7 +855,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { "%.4f\n", dnow() - x11vnc_start); } X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; } } @@ -899,6 +912,33 @@ void initialize_pipeinput(void) { } else { p = pipeinput_str; } +if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p); + + if (!strcmp(p, "VID")) { + pipeinput_int = PIPEINPUT_VID; + return; + } + if (strstr(p, "CONS") == p) { + int tty = 0, n; + char dev[32]; + if (sscanf(p, "CONS%d", &n) == 1) { + tty = n; + } + sprintf(dev, "/dev/tty%d", tty); + pipeinput_cons_fd = open(dev, O_WRONLY); + if (pipeinput_cons_fd >= 0) { + rfbLog("pipeinput: using linux console: %s\n", dev); + if (pipeinput_cons_dev) { + free(pipeinput_cons_dev); + } + pipeinput_cons_dev = strdup(dev); + pipeinput_int = PIPEINPUT_CONS; + } else { + rfbLog("pipeinput: could not open: %s\n", dev); + rfbLogPerror("open"); + } + return; + } set_child_info(); if (no_external_cmds) { diff --git a/x11vnc/rates.c b/x11vnc/rates.c index d2170dd..811a7ae 100644 --- a/x11vnc/rates.c +++ b/x11vnc/rates.c @@ -209,9 +209,7 @@ void initialize_speeds(void) { int n = 0; double dt, timer; dtime0(&timer); - if (0 && raw_fb && ! dpy) { /* raw_fb hack */ - n = 0; - } else if (fullscreen) { + if (fullscreen) { copy_image(fullscreen, 0, 0, 0, 0); n = fullscreen->bytes_per_line * fullscreen->height; } else if (scanline) { diff --git a/x11vnc/remote.c b/x11vnc/remote.c index 7c68493..8181454 100644 --- a/x11vnc/remote.c +++ b/x11vnc/remote.c @@ -74,7 +74,9 @@ int send_remote_cmd(char *cmd, int query, int wait) { fprintf(stderr, ">>> sending remote command: \"%s\" via" " X11VNC_REMOTE X property.\n", cmd); set_x11vnc_remote_prop(cmd); - XFlush(dpy); + if (dpy) { + XFlush_wr(dpy); + } } if (query || wait) { @@ -724,9 +726,16 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (!strcmp(p, "stop") || !strcmp(p, "quit") || !strcmp(p, "exit") || !strcmp(p, "shutdown")) { NOTAPP - close_all_clients(); + if (client_connect_file) { + FILE *in = fopen(client_connect_file, "w"); + if (in) { + fprintf(in, "cmd=noop\n"); + fclose(in); + } + } rfbLog("remote_cmd: setting shut_down flag\n"); shut_down = 1; + close_all_clients(); } else if (!strcmp(p, "ping")) { query = 1; @@ -1063,6 +1072,34 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: set cmap8to24_str to: %s\n", cmap8to24_str); do_new_fb(0); + } else if (!strcmp(p, "24to32")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, xform24to32); + goto qry; + } + rfbLog("remote_cmd: turning on -24to32 mode.\n"); + xform24to32 = 1; + do_new_fb(1); + + } else if (!strcmp(p, "no24to32")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !xform24to32); + goto qry; + } + rfbLog("remote_cmd: turning off -24to32 mode.\n"); + if (set_visual_str_to_something) { + if (visual_str) { + rfbLog("unsetting: %d %d/%d\n", visual_str, + (int) visual_id, visual_depth); + free(visual_str); + } + visual_str = NULL; + visual_id = (VisualID) 0; + visual_depth = 0; + } + xform24to32 = 0; + do_new_fb(1); + } else if (strstr(p, "visual") == p) { COLON_CHECK("visual:") if (query) { @@ -1579,7 +1616,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: turning on flipbyteorder mode.\n"); flip_byte_order = 1; if (orig != flip_byte_order) { - if (! using_shm) { + if (! using_shm || xform24to32) { do_new_fb(1); } else { rfbLog(" using shm, not resetting fb\n"); @@ -1594,7 +1631,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: turning off flipbyteorder mode.\n"); flip_byte_order = 0; if (orig != flip_byte_order) { - if (! using_shm) { + if (! using_shm || xform24to32) { do_new_fb(1); } else { rfbLog(" using shm, not resetting fb\n"); @@ -3282,6 +3319,19 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (*raw_fb_str == '\0') { free(raw_fb_str); raw_fb_str = NULL; + if (raw_fb_mmap) { + munmap(raw_fb_addr, raw_fb_mmap); + } + if (raw_fb_fd >= 0) { + close(raw_fb_fd); + } + raw_fb_fd = -1; + raw_fb = NULL; + raw_fb_addr = NULL; + raw_fb_offset = 0; + raw_fb_shm = 0; + raw_fb_mmap = 0; + raw_fb_seek = 0; rfbLog("restoring per-rawfb settings...\n"); set_raw_fb_params(1); } @@ -3976,7 +4026,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { if (dpy) { /* raw_fb hack */ set_x11vnc_remote_prop(buf); - XFlush(dpy); + XFlush_wr(dpy); } } #endif diff --git a/x11vnc/scan.c b/x11vnc/scan.c index c6dc481..32ac5b5 100644 --- a/x11vnc/scan.c +++ b/x11vnc/scan.c @@ -11,6 +11,7 @@ #include "pointer.h" #include "cleanup.h" #include "unixpw.h" +#include "screen.h" /* * routines for scanning and reading the X11 display for changes, and @@ -223,7 +224,7 @@ static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, X_LOCK; - if (! using_shm) { + if (! using_shm || xform24to32 || raw_fb) { /* we only need the XImage created */ xim = XCreateImage_wr(dpy, default_visual, depth, ZPixmap, 0, NULL, w, h, raw_fb ? 32 : BitmapPad(dpy), 0); @@ -260,6 +261,11 @@ static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, return 1; } + if (! dpy) { + X_UNLOCK; + return 0; + } + xim = XShmCreateImage_wr(dpy, default_visual, depth, ZPixmap, NULL, shm, w, h); @@ -347,7 +353,20 @@ void shm_clean(XShmSegmentInfo *shm, XImage *xim) { } #endif if (xim != NULL) { - XDestroyImage(xim); +#if 0 + /* + * This would be needed if you want to crazily switch + * back and forth between rawfb and X. You will also + * need to supply -noviewonly. xim->f is public ABI, + * but we choose not to use it. One could also + * clean up the switch. + */ + if (xim->f.destroy_image) { +#else + { +#endif + XDestroyImage(xim); + } xim = NULL; } X_UNLOCK; @@ -444,7 +463,7 @@ void initialize_polling_images(void) { } } if (!quiet) { - if (using_shm) { + if (using_shm && ! xform24to32) { rfbLog("created %d tile_row shm polling images.\n", tile_shm_count); } else { @@ -1959,6 +1978,7 @@ int copy_screen(void) { if (! main_fb) { return 0; } + fbp = main_fb; y = 0; @@ -1986,13 +2006,106 @@ int copy_screen(void) { return 0; } -int copy_snap(void) { +static void snap_all_rawfb(void) { int pixelsize = bpp/8; + int n, sz; + char *dst; + static char *unclipped_dst = NULL; + static int unclipped_len = 0; + + dst = snap->data; + + if (xform24to32 && bpp == 32) { + pixelsize = 3; + } + sz = dpy_x * dpy_y * pixelsize; + + if (wdpy_x > dpy_x || wdpy_y > dpy_y) { + sz = wdpy_x * wdpy_y * pixelsize; + if (sz > unclipped_len || unclipped_dst == NULL) { + if (unclipped_dst) { + free(unclipped_dst); + } + unclipped_dst = (char *) malloc(sz+4); + unclipped_len = sz; + } + dst = unclipped_dst; + } + + if (! raw_fb_seek) { + memcpy(dst, raw_fb_addr + raw_fb_offset, sz); + + } else { + int len = sz, del = 0; + off_t off = (off_t) raw_fb_offset; + + lseek(raw_fb_fd, off, SEEK_SET); + while (len > 0) { + n = read(raw_fb_fd, dst + del, len); + if (n > 0) { + del += n; + len -= n; + } else if (n == 0) { + break; + } else if (errno != EINTR && errno != EAGAIN) { + break; + } + } + } + + if (dst == unclipped_dst) { + char *src; + int h; + int x = off_x + coff_x; + int y = off_y + coff_y; + + src = unclipped_dst + y * wdpy_x * pixelsize + + x * pixelsize; + dst = snap->data; + + for (h = 0; h < dpy_y; h++) { + memcpy(dst, src, dpy_x * pixelsize); + src += wdpy_x * pixelsize; + dst += dpy_x * pixelsize; + } + } +} + +int copy_snap(void) { + int db = 1, pixelsize = bpp/8; char *fbp; int i, y, block_size; double dt; - static int first = 1; + static int first = 1, snapcnt = 0; + + if (raw_fb_str) { + int read_all_at_once = 1; + double start = dnow(); + if (rawfb_reset < 0) { + if (getenv("SNAPFB_RAWFB_RESET")) { + rawfb_reset = 1; + } else { + rawfb_reset = 0; + } + } + if (snap_fb == NULL || snap == NULL) { + rfbLog("copy_snap: rawfb mode and null snap fb\n"); + clean_up_exit(1); + } + if (rawfb_reset) { + initialize_raw_fb(1); + } + if (read_all_at_once) { + snap_all_rawfb(); + } else { + /* this goes line by line, XXX not working for video */ + copy_raw_fb(snap, 0, 0, dpy_x, dpy_y); + } +if (db && snapcnt++ < 5) rfbLog("rawfb copy_snap took: %.5f secs\n", dnow() - start); + return 0; + } + if (! fs_factor) { return 0; } @@ -2005,6 +2118,7 @@ int copy_snap(void) { fbp = snap_fb; y = 0; + dtime0(&dt); X_LOCK; diff --git a/x11vnc/screen.c b/x11vnc/screen.c index e85f2f1..5c2d7ee 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -19,7 +19,12 @@ #include "unixpw.h" #include "sslcmds.h" #include "sslhelper.h" +#include "v4l.h" +#include "linuxfb.h" +void set_greyscale_colormap(void); +void set_hi240_colormap(void); +void unset_colormap(void); void set_colormap(int reset); void set_nofb_params(int restore); void set_raw_fb_params(int restore); @@ -41,12 +46,14 @@ static void nofb_hook(rfbClientPtr cl); static void remove_fake_fb(void); static void install_fake_fb(int w, int h, int bpp); static void initialize_snap_fb(void); -static XImage *initialize_raw_fb(void); +XImage *initialize_raw_fb(int); static void initialize_clipshift(void); static int wait_until_mapped(Window win); static void announce(int lport, int ssl, char *iface); static void setup_scaling(int *width_in, int *height_in); +int rawfb_reset = -1; +int rawfb_dev_video = 0; /* * X11 and rfb display/screen related routines @@ -57,22 +64,96 @@ static void setup_scaling(int *width_in, int *height_in); * the clients and dynamically if -flashcmap is specified. */ #define NCOLOR 256 + +void set_greyscale_colormap(void) { + int i; + if (! screen) { + return; + } + if (screen->colourMap.data.shorts) { + free(screen->colourMap.data.shorts); + screen->colourMap.data.shorts = NULL; + } + +if (0) fprintf(stderr, "set_greyscale_colormap: %s\n", raw_fb_pixfmt); + screen->colourMap.count = NCOLOR; + screen->serverFormat.trueColour = FALSE; + screen->colourMap.is16 = TRUE; + screen->colourMap.data.shorts = (unsigned short *) + malloc(3*sizeof(unsigned short) * NCOLOR); + + for(i = 0; i < NCOLOR; i++) { + unsigned short lvl = i * 256; + + screen->colourMap.data.shorts[i*3+0] = lvl; + screen->colourMap.data.shorts[i*3+1] = lvl; + screen->colourMap.data.shorts[i*3+2] = lvl; + } + + rfbSetClientColourMaps(screen, 0, NCOLOR); +} + +/* this is specific to bttv rf tuner card */ +void set_hi240_colormap(void) { + int i; + if (! screen) { + return; + } +if (0) fprintf(stderr, "set_hi240_colormap: %s\n", raw_fb_pixfmt); + if (screen->colourMap.data.shorts) { + free(screen->colourMap.data.shorts); + screen->colourMap.data.shorts = NULL; + } + + screen->colourMap.count = 256; + screen->serverFormat.trueColour = FALSE; + screen->colourMap.is16 = TRUE; + screen->colourMap.data.shorts = (unsigned short *) + calloc(3*sizeof(unsigned short) * 256, 1); + + for(i = 0; i < 225; i++) { + int r, g, b; + + r = ( (i/5) % 5 ) * 255.0 / 4 + 0.5; + g = ( (i/25) ) * 255.0 / 8 + 0.5; + b = ( i % 5 ) * 255.0 / 4 + 0.5; + + screen->colourMap.data.shorts[(i+16)*3+0] = (unsigned short) (r * 256); + screen->colourMap.data.shorts[(i+16)*3+1] = (unsigned short) (g * 256); + screen->colourMap.data.shorts[(i+16)*3+2] = (unsigned short) (b * 256); + } + + rfbSetClientColourMaps(screen, 0, 256); +} +void unset_colormap(void) { + if (! screen) { + return; + } + if (screen->colourMap.data.shorts) { + free(screen->colourMap.data.shorts); + screen->colourMap.data.shorts = NULL; + } + screen->serverFormat.trueColour = TRUE; +if (0) fprintf(stderr, "unset_colormap: %s\n", raw_fb_pixfmt); +} + void set_colormap(int reset) { - static int first = 1; + static int init = 1; static XColor color[NCOLOR], prev[NCOLOR]; Colormap cmap; Visual *vis; int i, ncells, diffs = 0; if (reset) { - first = 1; + init = 1; if (screen->colourMap.data.shorts) { free(screen->colourMap.data.shorts); screen->colourMap.data.shorts = NULL; } } +if (0) fprintf(stderr, "unset_colormap: %d\n", reset); - if (first) { + if (init) { screen->colourMap.count = NCOLOR; screen->serverFormat.trueColour = FALSE; screen->colourMap.is16 = TRUE; @@ -86,6 +167,8 @@ void set_colormap(int reset) { prev[i].blue = color[i].blue; } + RAWFB_RET_VOID + X_LOCK; cmap = DefaultColormap(dpy, scr); @@ -103,7 +186,7 @@ void set_colormap(int reset) { } if (ncells != NCOLOR) { - if (first && ! quiet) { + if (init && ! quiet) { rfbLog("set_colormap: number of cells is %d " "instead of %d.\n", ncells, NCOLOR); } @@ -112,7 +195,7 @@ void set_colormap(int reset) { } } - if (flash_cmap && ! first) { + if (flash_cmap && ! init) { XWindowAttributes attr; Window c; int tries = 0; @@ -178,7 +261,7 @@ void set_colormap(int reset) { } } - if (diffs && ! first) { + if (diffs && ! init) { if (! all_clients_initialized()) { rfbLog("set_colormap: warning: sending cmap " "with uninitialized clients.\n"); @@ -190,7 +273,7 @@ void set_colormap(int reset) { } } - first = 0; + init = 0; } static void debug_colormap(XImage *fb) { @@ -248,10 +331,13 @@ static void debug_colormap(XImage *fb) { * visual_id and possibly visual_depth are set. */ static void set_visual(char *str) { - int vis, vdepth, defdepth = DefaultDepth(dpy, scr); + int vis, vdepth, defdepth; XVisualInfo vinfo; char *p, *vstring = strdup(str); + RAWFB_RET_VOID + + defdepth = DefaultDepth(dpy, scr); visual_id = (VisualID) 0; visual_depth = 0; @@ -410,7 +496,7 @@ static char *raw_fb_orig_dpy = NULL; void set_raw_fb_params(int restore) { static int first = 1; static int vo0, us0, sm0, ws0, wp0, wc0, wb0, na0, tn0; - static int xr0, sb0; + static int xr0, sb0, re0; static char *mc0; /* @@ -432,6 +518,7 @@ void set_raw_fb_params(int restore) { sm0 = using_shm; tn0 = take_naps; xr0 = xrandr; + re0 = noxrecord; mc0 = multiple_cursors_mode; first = 0; @@ -450,6 +537,7 @@ void set_raw_fb_params(int restore) { using_shm = sm0; take_naps = tn0; xrandr = xr0; + noxrecord = re0; multiple_cursors_mode = mc0; if (! dpy && raw_fb_orig_dpy) { @@ -484,56 +572,60 @@ void set_raw_fb_params(int restore) { } else { /* Normal case: */ if (! view_only) { - if (! quiet) rfbLog("rawfb: setting view_only\n"); + if (! quiet) rfbLog(" rawfb: setting view_only\n"); view_only = 1; } if (watch_selection) { - if (! quiet) rfbLog("rawfb: turning off " + if (! quiet) rfbLog(" rawfb: turning off " "watch_selection\n"); watch_selection = 0; } if (watch_primary) { - if (! quiet) rfbLog("rawfb: turning off " + if (! quiet) rfbLog(" rawfb: turning off " "watch_primary\n"); watch_primary = 0; } if (watch_clipboard) { - if (! quiet) rfbLog("rawfb: turning off " + if (! quiet) rfbLog(" rawfb: turning off " "watch_clipboard\n"); watch_clipboard = 0; } if (watch_bell) { - if (! quiet) rfbLog("rawfb: turning off watch_bell\n"); + if (! quiet) rfbLog(" rawfb: turning off watch_bell\n"); watch_bell = 0; } if (no_autorepeat) { - if (! quiet) rfbLog("rawfb: turning off " + if (! quiet) rfbLog(" rawfb: turning off " "no_autorepeat\n"); no_autorepeat = 0; } if (use_solid_bg) { - if (! quiet) rfbLog("rawfb: turning off " + if (! quiet) rfbLog(" rawfb: turning off " "use_solid_bg\n"); use_solid_bg = 0; } multiple_cursors_mode = strdup("arrow"); } - if (use_snapfb) { - if (! quiet) rfbLog("rawfb: turning off use_snapfb\n"); + if (0 && use_snapfb) { + if (! quiet) rfbLog(" rawfb: turning off use_snapfb\n"); use_snapfb = 0; } if (using_shm) { - if (! quiet) rfbLog("rawfb: turning off using_shm\n"); + if (! quiet) rfbLog(" rawfb: turning off using_shm\n"); using_shm = 0; } if (take_naps) { - if (! quiet) rfbLog("rawfb: turning off take_naps\n"); + if (! quiet) rfbLog(" rawfb: turning off take_naps\n"); take_naps = 0; } if (xrandr) { - if (! quiet) rfbLog("rawfb: turning off xrandr\n"); + if (! quiet) rfbLog(" rawfb: turning off xrandr\n"); xrandr = 0; } + if (! noxrecord) { + if (! quiet) rfbLog(" rawfb: turning off xrecord\n"); + noxrecord = 1; + } } /* @@ -545,8 +637,10 @@ void set_raw_fb_params(int restore) { */ static void nofb_hook(rfbClientPtr cl) { XImage *fb; + rfbLog("framebuffer requested in -nofb mode by client %s\n", cl->host); /* ignore xrandr */ + RAWFB_RET_VOID fb = XGetImage_wr(dpy, window, 0, 0, dpy_x, dpy_y, AllPlanes, ZPixmap); main_fb = fb->data; rfb_fb = main_fb; @@ -669,6 +763,7 @@ void install_padded_fb(char *geom) { } static void initialize_snap_fb(void) { + RAWFB_RET_VOID if (snap_fb) { free(snap_fb); } @@ -677,12 +772,63 @@ static void initialize_snap_fb(void) { snap_fb = snap->data; } -static XImage *initialize_raw_fb(void) { +#define RAWFB_MMAP 1 +#define RAWFB_FILE 2 +#define RAWFB_SHM 3 + +XImage *initialize_raw_fb(int reset) { char *str, *q; int w, h, b, shmid = 0; - unsigned long rm = 0, gm = 0, bm = 0; + unsigned long rm = 0, gm = 0, bm = 0, tm; static XImage ximage_struct; /* n.b.: not (XImage *) */ - int closedpy = 1, i, m; + static XImage ximage_struct_snap; + int closedpy = 1, i, m, db = 0; + + static char *last_file = NULL; + static int last_mode = 0; + + if (reset && last_mode) { + int fd; + if (last_mode != RAWFB_MMAP && last_mode != RAWFB_FILE) { + return NULL; + } + if (last_mode == RAWFB_MMAP) { + munmap(raw_fb_addr, raw_fb_mmap); + } + if (raw_fb_fd >= 0) { + close(raw_fb_fd); + } + raw_fb_fd = -1; +if (db) fprintf(stderr, "initialize_raw_fb reset\n"); + + fd = -1; + if (rawfb_dev_video) { + fd = open(last_file, O_RDWR); + } + if (fd < 0) { + fd = open(last_file, O_RDONLY); + } + if (fd < 0) { + rfbLogEnable(1); + rfbLog("failed to rawfb file: %s\n", last_file); + rfbLogPerror("open"); + clean_up_exit(1); + } + raw_fb_fd = fd; + if (last_mode == RAWFB_MMAP) { + raw_fb_addr = mmap(0, raw_fb_mmap, PROT_READ, + MAP_SHARED, fd, 0); + + if (raw_fb_addr == MAP_FAILED || raw_fb_addr == NULL) { + rfbLogEnable(1); + rfbLog("failed to mmap file: %s\n", last_file); + rfbLog(" raw_fb_addr: %p\n", raw_fb_addr); + rfbLogPerror("mmap"); + clean_up_exit(1); + } + } + return NULL; + } if (raw_fb_addr || raw_fb_seek) { if (raw_fb_shm) { @@ -693,13 +839,17 @@ static XImage *initialize_raw_fb(void) { if (raw_fb_fd >= 0) { close(raw_fb_fd); } + raw_fb_fd = -1; #endif } else if (raw_fb_seek) { if (raw_fb_fd >= 0) { close(raw_fb_fd); } + raw_fb_fd = -1; } raw_fb_addr = NULL; + raw_fb_mmap = 0; + raw_fb_seek = 0; } if (! raw_fb_str) { return NULL; @@ -750,22 +900,48 @@ static XImage *initialize_raw_fb(void) { } else { str = strdup(raw_fb_str); } - - /* - * uppercase means do not close the display (e.g. for remote control) - */ - if (strstr(str, "SHM:") == str) { - closedpy = 0; - str[0] = 's'; str[1] = 'h'; str[2] = 'm'; - } else if (strstr(str, "MAP:") == str) { - closedpy = 0; - str[0] = 'm'; str[1] = 'a'; str[2] = 'p'; - } else if (strstr(str, "MMAP:") == str) { - closedpy = 0; - str[0] = 'm'; str[1] = 'm'; str[2] = 'a'; str[3] = 'p'; - } else if (strstr(str, "FILE:") == str) { - str[0] = 'f'; str[1] = 'i'; str[2] = 'l'; str[3] = 'e'; + if (str[0] == '+') { + char *t = strdup(str+1); + free(str); + str = t; closedpy = 0; + if (! window) { + window = rootwin; + } + } + + raw_fb_shm = 0; + raw_fb_mmap = 0; + raw_fb_seek = 0; + raw_fb_fd = -1; + raw_fb_addr = NULL; + raw_fb_offset = 0; + + last_mode = 0; + if (last_file) { + free(last_file); + last_file = NULL; + } + + if (strstr(str, "video") == str || strstr(str, "/dev/video") == str) { + char *str2 = v4l_guess(str, &raw_fb_fd); + if (str2 == NULL) { + rfbLog("v4l_guess failed for: %s\n", str); + clean_up_exit(1); + } + str = str2; + rfbLog("v4l_guess returned: %s\n", str); + rawfb_dev_video = 1; + } else if (strstr(str, "dev/video")) { + rawfb_dev_video = 1; + } else if (strstr(str, "cons") == str || strstr(str, "/dev/fb") == str) { + char *str2 = console_guess(str, &raw_fb_fd); + if (str2 == NULL) { + rfbLog("console_guess failed for: %s\n", str); + clean_up_exit(1); + } + str = str2; + rfbLog("console_guess returned: %s\n", str); } if (closedpy && !view_only && got_noviewonly) { @@ -799,7 +975,6 @@ static XImage *initialize_raw_fb(void) { * -rawfb file:/path/to/file@640x480x32:ff/ff00/ff0000 */ - raw_fb_offset = 0; /* +O offset */ if ((q = strrchr(str, '+')) != NULL) { @@ -836,6 +1011,34 @@ static XImage *initialize_raw_fb(void) { } *q = '\0'; + dpy_x = wdpy_x = w; + dpy_y = wdpy_y = h; + off_x = 0; + off_y = 0; + + if (rawfb_dev_video) { + if (b == 24) { + rfbLog("enabling -24to32 for 24bpp video\n"); + xform24to32 = 1; + } else { + if (xform24to32) { + rfbLog("disabling -24to32 for 24bpp video\n"); + } + xform24to32 = 0; + } + } + + if (xform24to32) { + if (b != 24) { + rfbLog("warning: -24to32 mode and bpp=%d\n", b); + } + b = 32; + } + if (strstr(str, "snap:") == str) { + use_snapfb = 1; + str[0] = 'f'; str[1] = 'i'; str[2] = 'l'; str[3] = 'e'; + } + if (strstr(str, "shm:") != str && strstr(str, "mmap:") != str && strstr(str, "map:") != str && strstr(str, "file:") != str) { /* hmmm, not following directions, see if map: applies */ @@ -854,17 +1057,6 @@ static XImage *initialize_raw_fb(void) { } } - dpy_x = wdpy_x = w; - dpy_y = wdpy_y = h; - off_x = 0; - off_y = 0; - - raw_fb_shm = 0; - raw_fb_mmap = 0; - raw_fb_seek = 0; - raw_fb_fd = -1; - raw_fb_addr = NULL; - if (sscanf(str, "shm:%d", &shmid) == 1) { /* shm:N */ #if LIBVNCSERVER_HAVE_XSHM @@ -878,6 +1070,7 @@ static XImage *initialize_raw_fb(void) { raw_fb_shm = 1; rfbLog("rawfb: shm: %d W: %d H: %d B: %d addr: %p\n", shmid, w, h, b, raw_fb_addr); + last_mode = RAWFB_SHM; #else rfbLogEnable(1); rfbLog("x11vnc was compiled without shm support.\n"); @@ -896,7 +1089,15 @@ static XImage *initialize_raw_fb(void) { q = strchr(str, ':'); q++; - fd = open(q, O_RDONLY); + last_file = strdup(q); + + fd = raw_fb_fd; + if (fd < 0 && rawfb_dev_video) { + fd = open(q, O_RDWR); + } + if (fd < 0) { + fd = open(q, O_RDONLY); + } if (fd < 0) { rfbLogEnable(1); rfbLog("failed to open file: %s, %s\n", q, str); @@ -905,7 +1106,11 @@ static XImage *initialize_raw_fb(void) { } raw_fb_fd = fd; - size = w*h*b/8 + raw_fb_offset; + if (xform24to32) { + size = w*h*24/8 + raw_fb_offset; + } else { + size = w*h*b/8 + raw_fb_offset; + } if (fstat(fd, &sbuf) == 0) { if (S_ISREG(sbuf.st_mode)) { if (0) size = sbuf.st_size; @@ -931,13 +1136,16 @@ static XImage *initialize_raw_fb(void) { rfbLog("rawfb: mmap file: %s\n", q); rfbLog(" w: %d h: %d b: %d addr: %p sz: %d\n", w, h, b, raw_fb_addr, size); + last_mode = RAWFB_MMAP; #else rfbLog("mmap(2) not supported on system, using" " slower lseek(2)\n"); raw_fb_seek = size; + last_mode = RAWFB_FILE; #endif } else { raw_fb_seek = size; + last_mode = RAWFB_FILE; rfbLog("rawfb: seek file: %s\n", q); rfbLog(" W: %d H: %d B: %d sz: %d\n", w, h, b, size); @@ -962,6 +1170,24 @@ static XImage *initialize_raw_fb(void) { raw_fb_image->bits_per_pixel = b; raw_fb_image->bytes_per_line = dpy_x*b/8; + if (use_snapfb && (raw_fb_seek || raw_fb_mmap)) { + int b_use = b; + if (snap_fb) { + free(snap_fb); + } + if (b_use == 32 && xform24to32) { + b_use = 24; + } + snap_fb = (char *) malloc(dpy_x * dpy_y * b_use/8); + snap = &ximage_struct_snap; + snap->data = snap_fb; + snap->format = ZPixmap; + snap->width = dpy_x; + snap->height = dpy_y; + snap->bits_per_pixel = b_use; + snap->bytes_per_line = dpy_x*b_use/8; + } + if (rm == 0 && gm == 0 && bm == 0) { /* guess masks... */ if (b == 24 || b == 32) { @@ -978,6 +1204,26 @@ static XImage *initialize_raw_fb(void) { bm = 0xc0; } } + /* we can fake -flipbyteorder to some degree... */ + if (flip_byte_order) { + if (b == 24 || b == 32) { + tm = rm; + rm = bm; + bm = tm; + } else if (b == 16) { + unsigned short s1, s2; + s1 = (unsigned short) rm; + s2 = ((0xff & s1) << 8) | ((0xff00 & s1) >> 8); + rm = (unsigned long) s2; + s1 = (unsigned short) gm; + s2 = ((0xff & s1) << 8) | ((0xff00 & s1) >> 8); + gm = (unsigned long) s2; + s1 = (unsigned short) bm; + s2 = ((0xff & s1) << 8) | ((0xff00 & s1) >> 8); + bm = (unsigned long) s2; + } + } + raw_fb_image->red_mask = rm; raw_fb_image->green_mask = gm; @@ -1003,15 +1249,30 @@ static XImage *initialize_raw_fb(void) { depth = raw_fb_image->depth; + if (raw_fb_image->depth == 15) { + /* unresolved bug with RGB555... */ + depth++; + } + if (clipshift) { memset(raw_fb, 0xff, dpy_x * dpy_y * b/8); - } else if (raw_fb_addr) { + } else if (raw_fb_addr && ! xform24to32) { memcpy(raw_fb, raw_fb_addr + raw_fb_offset, dpy_x*dpy_y*b/8); } else { memset(raw_fb, 0xff, dpy_x * dpy_y * b/8); } - rfbLog("rawfb: raw_fb %p\n", raw_fb); + rfbLog("\n"); + rfbLog("rawfb: raw_fb %p\n", raw_fb); + rfbLog(" format %d\n", raw_fb_image->format); + rfbLog(" width %d\n", raw_fb_image->width); + rfbLog(" height %d\n", raw_fb_image->height); + rfbLog(" bpp %d\n", raw_fb_image->bits_per_pixel); + rfbLog(" depth %d\n", raw_fb_image->depth); + rfbLog(" bpl %d\n", raw_fb_image->bytes_per_line); + if (use_snapfb && snap_fb) { + rfbLog(" snap_fb %p\n", snap_fb); + } free(str); @@ -1073,7 +1334,7 @@ static int wait_until_mapped(Window win) { usleep(ms * 1000); continue; } - if (! XGetWindowAttributes(dpy, win, &attr)) { + if (dpy && ! XGetWindowAttributes(dpy, win, &attr)) { return 0; } if (attr.map_state == IsViewable) { @@ -1095,7 +1356,7 @@ XImage *initialize_xdisplay_fb(void) { int subwin_bs; if (raw_fb_str) { - return initialize_raw_fb(); + return initialize_raw_fb(0); } X_LOCK; @@ -1137,12 +1398,24 @@ XImage *initialize_xdisplay_fb(void) { vis_str = strdup(str); } + if (xform24to32) { + if (DefaultDepth(dpy, scr) == 24) { + vis_str = strdup("TrueColor:32"); + rfbLog("initialize_xdisplay_fb: vis_str set to: %s ", + vis_str); + visual_id = (VisualID) 0; + visual_depth = 0; + set_visual_str_to_something = 1; + } + } + if (vis_str != NULL) { set_visual(vis_str); if (vis_str != visual_str) { free(vis_str); } } +if (0) fprintf(stderr, "vis_str %s\n", vis_str ? vis_str : "notset"); /* set up parameters for subwin or non-subwin cases: */ @@ -1184,6 +1457,8 @@ XImage *initialize_xdisplay_fb(void) { /* initialize depth to reasonable value, visual_id may override */ depth = DefaultDepth(dpy, scr); +if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_id); + if (visual_id) { int n; XVisualInfo vinfo_tmpl, *vinfo; @@ -1272,7 +1547,7 @@ XImage *initialize_xdisplay_fb(void) { } XMapRaised(dpy, window); XRaiseWindow(dpy, window); - XFlush(dpy); + XFlush_wr(dpy); } try++; @@ -1533,6 +1808,9 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { fb_Bpl = (int) fb->bytes_per_line; fb_depth = (int) fb->depth; + rfbLog("initialize_screen: fb_depth/fb_bpp/fb_Bpl %d/%d/%d\n", fb_depth, + fb_depth, fb_Bpl); + main_bytes_per_line = fb->bytes_per_line; if (cmap8to24) { @@ -1675,7 +1953,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { have_masks = 2; /* need to fetch TrueColor visual */ X_LOCK; - if (XMatchVisualInfo(dpy, scr, 24, TrueColor, &vinfo)) { + if (dpy && XMatchVisualInfo(dpy, scr, 24, TrueColor, &vinfo)) { main_red_mask = vinfo.red_mask; main_green_mask = vinfo.green_mask; main_blue_mask = vinfo.blue_mask; @@ -1691,6 +1969,19 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { X_UNLOCK; } + if (raw_fb_str && raw_fb_pixfmt) { + char *fmt = strdup(raw_fb_pixfmt); + uppercase(fmt); + if (strstr(fmt, "GREY")) { + set_greyscale_colormap(); + } else if (strstr(fmt, "HI240")) { + set_hi240_colormap(); + } else { + unset_colormap(); + } + free(fmt); + } + if (! have_masks && screen->serverFormat.bitsPerPixel == 8 && dpy && CellsOfScreen(ScreenOfDisplay(dpy, scr))) { /* indexed color */ @@ -1966,8 +2257,6 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { screen->deferUpdateTime = defer_update; } - rfbSetServerVersionIdentity(screen, "x11vnc: %s", lastmod); - rfbInitServer(screen); if (use_openssl) { diff --git a/x11vnc/screen.h b/x11vnc/screen.h index 062207f..b14a62c 100644 --- a/x11vnc/screen.h +++ b/x11vnc/screen.h @@ -3,6 +3,9 @@ /* -- screen.h -- */ +extern void set_greyscale_colormap(void); +extern void set_hi240_colormap(void); +extern void unset_colormap(void); extern void set_colormap(int reset); extern void set_nofb_params(int restore); extern void set_raw_fb_params(int restore); @@ -11,10 +14,14 @@ extern void free_old_fb(char *old_main, char *old_rfb, char *old_8to24); extern void check_padded_fb(void); extern void install_padded_fb(char *geom); extern XImage *initialize_xdisplay_fb(void); +extern XImage *initialize_raw_fb(int); extern void parse_scale_string(char *str, double *factor, int *scaling, int *blend, int *nomult4, int *pad, int *interpolate, int *numer, int *denom); extern int scale_round(int len, double fac); extern void initialize_screen(int *argc, char **argv, XImage *fb); extern void set_vnc_desktop_name(void); +extern int rawfb_reset; +extern int rawfb_dev_video; + #endif /* _X11VNC_SCREEN_H */ diff --git a/x11vnc/selection.c b/x11vnc/selection.c index 6d652d6..cb2cce7 100644 --- a/x11vnc/selection.c +++ b/x11vnc/selection.c @@ -4,6 +4,7 @@ #include "cleanup.h" #include "connections.h" #include "unixpw.h" +#include "xwrappers.h" /* * Selection/Cutbuffer/Clipboard handlers. @@ -57,7 +58,11 @@ void selection_request(XEvent *ev, char *type) { unsigned int length; unsigned char *data; #ifndef XA_LENGTH - unsigned long XA_LENGTH = XInternAtom(dpy, "LENGTH", True); + unsigned long XA_LENGTH; +#endif + RAWFB_RET_VOID +#ifndef XA_LENGTH + XA_LENGTH = XInternAtom(dpy, "LENGTH", True); #endif req_event = &(ev->xselectionrequest); @@ -128,7 +133,7 @@ void selection_request(XEvent *ev, char *type) { XSetErrorHandler(old_handler); trapped_xerror = 0; - XFlush(dpy); + XFlush_wr(dpy); } int check_sel_direction(char *dir, char *label, char *sel, int len) { @@ -179,6 +184,7 @@ void cutbuffer_send(void) { cutbuffer_str[0] = '\0'; slen = 0; + RAWFB_RET_VOID /* read the property value into cutbuffer_str: */ do { @@ -248,6 +254,7 @@ void selection_send(XEvent *ev) { unsigned char* data = NULL; char *selection_str; + RAWFB_RET_VOID /* * remember info about our last value of PRIMARY (or CUT_BUFFER0) * so we can check for any changes below. diff --git a/x11vnc/solid.c b/x11vnc/solid.c index 9b85725..a40d0fd 100644 --- a/x11vnc/solid.c +++ b/x11vnc/solid.c @@ -2,6 +2,7 @@ #include "x11vnc.h" #include "win_utils.h" +#include "xwrappers.h" char *guess_desktop(void); void solid_bg(int restore); @@ -46,6 +47,8 @@ static void usr_bin_path(int restore) { static int dt_cmd(char *cmd) { int rc; + RAWFB_RET(0) + if (!cmd || *cmd == '\0') { return 0; } @@ -117,6 +120,8 @@ static void solid_root(char *color) { XColor cdef; Colormap cmap; + RAWFB_RET_VOID + if (subwin || window != rootwin) { rfbLog("cannot set subwin to solid color, must be rootwin\n"); return; @@ -159,7 +164,7 @@ static void solid_root(char *color) { XSetWindowBackgroundPixmap(dpy, window, pixmap); XFreePixmap(dpy, pixmap); XClearWindow(dpy, window); - XFlush(dpy); + XFlush_wr(dpy); /* generate exposures */ XMapWindow(dpy, expose); @@ -228,6 +233,8 @@ static void solid_cde(char *color) { Colormap cmap; int n; + RAWFB_RET_VOID + if (subwin || window != rootwin) { rfbLog("cannot set subwin to solid color, must be rootwin\n"); return; @@ -282,7 +289,7 @@ static void solid_cde(char *color) { XSetWindowBackgroundPixmap(dpy, twin, pixmap); XFreePixmap(dpy, pixmap); XClearWindow(dpy, twin); - XFlush(dpy); + XFlush_wr(dpy); } /* generate exposures */ @@ -481,6 +488,8 @@ static void solid_gnome(char *color) { static char *orig_color = NULL; static char *orig_option = NULL; char *cmd; + + RAWFB_RET_VOID if (! color) { if (! orig_color) { @@ -555,6 +564,8 @@ static void solid_kde(char *color) { char *cmd, *user = NULL; int len; + RAWFB_RET_VOID + user = get_user_name(); if (strstr(user, "'") != NULL) { rfbLog("invalid user: %s\n", user); @@ -595,6 +606,8 @@ static void solid_kde(char *color) { char *guess_desktop(void) { Atom prop; + RAWFB_RET("root") + if (wmdt_str && *wmdt_str != '\0') { char *s = wmdt_str; lowercase(s); @@ -647,6 +660,8 @@ void solid_bg(int restore) { static char *prev_str; char *dtname, *color; + RAWFB_RET_VOID + if (started_as_root == 1 && users_list) { /* we are still root, don't try. */ return; diff --git a/x11vnc/sslhelper.c b/x11vnc/sslhelper.c index a09f399..8aff624 100644 --- a/x11vnc/sslhelper.c +++ b/x11vnc/sslhelper.c @@ -1028,7 +1028,7 @@ if (db) fprintf(stderr, "tv_sec: %d - %s\n", (int) tv.tv_sec, last_get); return 1; } -#define BSIZE 16384 +#define ABSIZE 16384 static int watch_for_http_traffic(char *buf_a, int *n_a) { int is_http, err, n, n2; char *buf; @@ -1038,13 +1038,13 @@ static int watch_for_http_traffic(char *buf_a, int *n_a) { * if it is http or not. if we read them OK, we must read the * rest of the available data otherwise we may deadlock. * what has be read is returned in buf_a and n_a. - * *buf_a is BSIZE+1 long and zeroed. + * *buf_a is ABSIZE+1 long and zeroed. */ if (getenv("ACCEPT_OPENSSL_DEBUG")) { db = atoi(getenv("ACCEPT_OPENSSL_DEBUG")); } - buf = (char *) calloc(sizeof(BSIZE+1), 1); + buf = (char *) calloc(sizeof(ABSIZE+1), 1); *n_a = 0; n = SSL_read(ssl, buf, 2); @@ -1075,7 +1075,7 @@ static int watch_for_http_traffic(char *buf_a, int *n_a) { * better read all we can and fwd it along to avoid blocking * in ssl_xfer(). */ - n2 = SSL_read(ssl, buf + n, BSIZE - n); + n2 = SSL_read(ssl, buf + n, ABSIZE - n); if (n2 >= 0) { n += n2; } @@ -1376,8 +1376,8 @@ void accept_openssl(int mode) { char *iface = NULL; char *buf, *tbuf; - buf = (char *) calloc((BSIZE+1), 1); - tbuf = (char *) calloc((2*BSIZE+1), 1); + buf = (char *) calloc((ABSIZE+1), 1); + tbuf = (char *) calloc((2*ABSIZE+1), 1); if (mode == OPENSSL_HTTPS) { /* @@ -1857,7 +1857,7 @@ if (db > 1) write(2, buf, n); static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { int dbxfer = 0, db = 0, check_pending, fdmax, nfd, n, i, err; - char cbuf[BSIZE], sbuf[BSIZE]; + char cbuf[ABSIZE], sbuf[ABSIZE]; int cptr, sptr, c_rd, c_wr, s_rd, s_wr; fd_set rd, wr; struct timeval tv; @@ -1905,7 +1905,7 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { * cbuf[] is data from csock that we have read but not passed on to ssl * sbuf[] is data from ssl that we have read but not passed on to csock */ - for (i=0; i<BSIZE; i++) { + for (i=0; i<ABSIZE; i++) { cbuf[i] = '\0'; sbuf[i] = '\0'; } @@ -1927,7 +1927,7 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { s_rd = 1; /* ssl data (remote client) socket open for reading */ s_wr = 1; /* ssl data (remote client) socket open for writing */ - cptr = 0; /* offsets into BSIZE buffers */ + cptr = 0; /* offsets into ABSIZE buffers */ sptr = 0; while (1) { @@ -1966,7 +1966,7 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { FD_ZERO(&rd); - if (c_rd && cptr < BSIZE) { + if (c_rd && cptr < ABSIZE) { /* we could read more from C since cbuf is not full */ FD_SET(csock, &rd); } @@ -1976,7 +1976,7 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { * OR ssl is waiting for more BIO to be able to * read and we have some C data still buffered. */ - if (sptr < BSIZE || (cptr > 0 && SSL_want_read(ssl))) { + if (sptr < ABSIZE || (cptr > 0 && SSL_want_read(ssl))) { FD_SET(s_in, &rd); } } @@ -1993,7 +1993,7 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { * OR ssl is waiting for more BIO to be able * write and we haven't filled up sbuf yet. */ - if (cptr > 0 || (sptr < BSIZE && SSL_want_write(ssl))) { + if (cptr > 0 || (sptr < ABSIZE && SSL_want_write(ssl))) { FD_SET(s_out, &wr); } } @@ -2050,7 +2050,7 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { } else { /* shift over the data in sbuf by n */ memmove(sbuf, sbuf + n, sptr - n); - if (sptr == BSIZE) { + if (sptr == ABSIZE) { check_pending = 1; } sptr -= n; @@ -2111,7 +2111,7 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { /* try to read some data from C into our cbuf */ - n = read(csock, cbuf + cptr, BSIZE - cptr); + n = read(csock, cbuf + cptr, ABSIZE - cptr); if (n < 0) { if (errno != EINTR) { @@ -2135,13 +2135,13 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { } if (s_rd) { - if ((sptr < BSIZE && FD_ISSET(s_in, &rd)) || + if ((sptr < ABSIZE && FD_ISSET(s_in, &rd)) || (SSL_want_write(ssl) && FD_ISSET(s_out, &wr)) || (check_pending && SSL_pending(ssl))) { /* try to read some data from S into our sbuf */ - n = SSL_read(ssl, sbuf + sptr, BSIZE - sptr); + n = SSL_read(ssl, sbuf + sptr, ABSIZE - sptr); err = SSL_get_error(ssl, n); if (err == SSL_ERROR_NONE) { diff --git a/x11vnc/tkx11vnc b/x11vnc/tkx11vnc index 8e178ee..415ef50 100755 --- a/x11vnc/tkx11vnc +++ b/x11vnc/tkx11vnc @@ -178,6 +178,7 @@ Screen visual: rawfb: pipeinput: + 24to32 =GAL LOFF Keyboard diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h index 8bbffc9..dd94395 100644 --- a/x11vnc/tkx11vnc.h +++ b/x11vnc/tkx11vnc.h @@ -189,6 +189,7 @@ char gui_code[] = ""; " visual:\n" " rawfb:\n" " pipeinput:\n" +" 24to32\n" " =GAL LOFF\n" "\n" "Keyboard\n" diff --git a/x11vnc/unixpw.c b/x11vnc/unixpw.c index 2130e00..bb66cd7 100644 --- a/x11vnc/unixpw.c +++ b/x11vnc/unixpw.c @@ -67,6 +67,8 @@ static int db = 0; static int white(void) { static unsigned long black_pix = 0, white_pix = 1, set = 0; + RAWFB_RET(0xffffff) + if (depth <= 8 && ! set) { X_LOCK; black_pix = BlackPixel(dpy, scr); diff --git a/x11vnc/user.c b/x11vnc/user.c index eafbb2f..78eb6dd 100644 --- a/x11vnc/user.c +++ b/x11vnc/user.c @@ -445,10 +445,13 @@ void lurk_loop(char *str) { } static int guess_user_and_switch(char *str, int fb_mode) { - char *dstr, *d = DisplayString(dpy); + char *dstr, *d; char *p, *tstr = NULL, *allowed = NULL, *logins, **users = NULL; int dpy1, ret = 0; + RAWFB_RET(0) + + d = DisplayString(dpy); /* pick out ":N" */ dstr = strchr(d, ':'); if (! dstr) { @@ -639,7 +642,7 @@ static int switch_user_env(uid_t uid, char *name, char *home, int fb_mode) { * OK tricky here, we need to free the shm... otherwise * we won't be able to delete it as the other user... */ - if (fb_mode == 1 && using_shm) { + if (fb_mode == 1 && (using_shm && ! xform24to32)) { reset_fb = 1; clean_shm(0); free_tiles(); diff --git a/x11vnc/userinput.c b/x11vnc/userinput.c index 50128ae..ef1563f 100644 --- a/x11vnc/userinput.c +++ b/x11vnc/userinput.c @@ -96,6 +96,8 @@ int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h, int rootx, rooty, wx, wy; unsigned int mask; + RAWFB_RET(0) + ret = XQueryPointer(dpy, rootwin, &r, &c, &rootx, &rooty, &wx, &wy, &mask); @@ -2140,6 +2142,9 @@ static int check_xrecord_keys(void) { double set_repeat_in; static double set_repeat = 0.0; + + RAWFB_RET(0) + set_repeat_in = set_repeat; set_repeat = 0.0; @@ -2222,7 +2227,7 @@ if (db) fprintf(stderr, "check_xrecord_keys: BEGIN LOOP: scr_ev_cnt: " X_LOCK; flush1 = 1; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; if (set_repeat_in > 0.0) { @@ -2253,7 +2258,7 @@ if (0 || db) fprintf(stderr, "check_xrecord: more keys: %.3f 0x%x " " %.4f %s %s\n", spin, last_rfb_keysym, last_rfb_keytime - x11vnc_start, last_rfb_down ? "down":"up ", last_rfb_key_accepted ? "accept":"skip"); flush2 = 1; - XFlush(dpy); + XFlush_wr(dpy); } #if LIBVNCSERVER_HAVE_RECORD SCR_LOCK; @@ -2383,6 +2388,8 @@ static int check_xrecord_mouse(void) { int btn4 = (1<<3); int btn5 = (1<<4); + RAWFB_RET(0) + get_out = 1; if (button_mask) { get_out = 0; @@ -2540,7 +2547,7 @@ if (db) fprintf(stderr, "check_xrecord: BUTTON_UP_SCROLL: %.3f\n", spin); if (! already_down || (!scr_cnt && spin>flush1_time)) { flush1 = 1; X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; dtime0(&last_flush); } @@ -2624,7 +2631,7 @@ if (db) fprintf(stderr, "check_xrecord: BUTTON-UP-KEEP-GOING: %.3f/%.3f %d/%d % if (doflush) { flush1 = 1; X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; dtime0(&last_flush); } @@ -2679,8 +2686,8 @@ if (db) fprintf(stderr, " we decide to send ret=3\n"); if (flush2) { X_LOCK; - XFlush(dpy); - XFlush(rdpy_ctrl); + XFlush_wr(dpy); + XFlush_wr(rdpy_ctrl); X_UNLOCK; flush2 = 1; @@ -2708,6 +2715,8 @@ int check_xrecord(void) { int watch_keys = 0, watch_mouse = 0, consider_mouse; static int mouse_wants_back_in = 0; + RAWFB_RET(0) + if (! use_xrecord) { return 0; } @@ -3291,6 +3300,8 @@ int check_wireframe(void) { int try_it = 0; DB_SET + RAWFB_RET(0) + if (unixpw_in_progress) return 0; if (nofb) { return 0; @@ -3439,7 +3450,7 @@ if (db) fprintf(stderr, "INTERIOR\n"); while (1) { X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; /* try do induce/waitfor some more user input */ @@ -3504,7 +3515,7 @@ if (db) fprintf(stderr, " ++pointer event!! [%02d] dt: %.3f x: %d y: %d mas g = got_pointer_input; X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; /* periodically try to let the wm get moving: */ @@ -3849,7 +3860,7 @@ static void check_user_input2(double dt) { X_LOCK; do_flush = 0; if (0) fprintf(stderr, "check_user_input2-A: XFlush %.4f\n", tm); - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; if (eaten < max_eat) { continue; @@ -3864,7 +3875,7 @@ if (0) fprintf(stderr, "check_user_input2-A: XFlush %.4f\n", tm); if (do_flush) { X_LOCK; if (0) fprintf(stderr, "check_user_input2-B: XFlush %.4f\n", tm); - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; } @@ -3922,7 +3933,7 @@ if (0) fprintf(stderr, "check_user_input2-B: XFlush %.4f\n", tm); } X_LOCK; if (0) fprintf(stderr, "check_user_input2-C: XFlush %.4f\n", tm); - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; miss = 0; } else { @@ -4020,7 +4031,7 @@ static void check_user_input3(double dt, double dtr, int tile_diffs) { got_input = 1; g = got_pointer_input; X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; } else if (--allowed_misses <= 0) { /* too many misses */ @@ -4172,7 +4183,7 @@ static void check_user_input4(double dt, double dtr, int tile_diffs) { } if (iter) { X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; } push_frame = 0; @@ -4256,7 +4267,7 @@ static void check_user_input4(double dt, double dtr, int tile_diffs) { got_input = 1; g = got_pointer_input; X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; } else if (consecutive_misses >= 2) { @@ -4296,7 +4307,7 @@ static void check_user_input4(double dt, double dtr, int tile_diffs) { int check_user_input(double dt, double dtr, int tile_diffs, int *cnt) { - if (raw_fb && ! dpy) return 0; /* raw_fb hack */ + RAWFB_RET(0) if (use_xrecord) { int rc = check_xrecord(); @@ -4328,7 +4339,7 @@ if (debug_scroll && rc > 1) fprintf(stderr, " CXR: check_user_input ret %d\n", /* every ui_skip-th drops thru to scan */ *cnt++; X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; return 1; /* short circuit watch_loop */ } else { diff --git a/x11vnc/v4l.c b/x11vnc/v4l.c new file mode 100644 index 0000000..9722f38 --- /dev/null +++ b/x11vnc/v4l.c @@ -0,0 +1,1689 @@ +/* -- v4l.c -- */ + +#include "x11vnc.h" +#include "cleanup.h" +#include "scan.h" +#include "xinerama.h" +#include "screen.h" + +#if LIBVNCSERVER_HAVE_LINUX_VIDEODEV_H +#if LIBVNCSERVER_HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#include <linux/videodev.h> +#define V4L_OK +#endif +#endif + +char *v4l_guess(char *str, int *fd); +void v4l_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); +void v4l_pointer_command(int mask, int x, int y, rfbClientPtr client); + +static int v4l1_val(int pct); +static int v4l1_width(int w); +static int v4l1_height(int h); +static int v4l1_resize(int fd, int w, int h); +static void v4l1_setfreq(int fd, unsigned long freq, int verb); +static void v4l1_set_input(int fd, int which); +static int v4l1_setfmt(int fd, char *fmt); +static void apply_settings(char *dev, char *settings, int *fd); +static int v4l1_dpct(int old, int d); +static void v4l_requery(void); +static void v4l_br(int b); +static void v4l_hu(int b); +static void v4l_co(int b); +static void v4l_cn(int b); +static void v4l_sz(int b); +static void v4l_sta(int sta); +static void v4l_inp(int inp); +static void v4l_fmt(char *fmt); +static int colon_n(char *line); +static char *colon_str(char *line); +static char *colon_tag(char *line); +static void lookup_rgb(char *g_fmt, int *g_b, int *mask_rev); +static char *v4l1_lu_palette(unsigned short palette); +static unsigned short v4l1_lu_palette_str(char *name, int *bits, int *rev); +static char *v4l2_lu_palette(unsigned int palette); +static unsigned int v4l2_lu_palette_str(char *name, int *bits, int *rev); +static int v4l1_query(int fd, int verbose); +static int v4l2_query(int fd, int verbose); +static int open_dev(char *dev); +static char *guess_via_v4l(char *dev, int *fd); +static char *guess_via_v4l_info(char *dev, int *fd); +static void parse_str(char *str, char **dev, char **settings, char **atparms); +static unsigned long lookup_freqtab(int sta); +static unsigned long lookup_freq(int sta); +static int lookup_station(unsigned long freq); +static void init_freqtab(char *file); +static void init_freqs(void); +static void init_ntsc_cable(void); + +#define C_VIDEO_CAPTURE 1 +#define C_PICTURE 2 +#define C_WINDOW 3 + +#ifdef V4L_OK +static struct video_capability v4l1_capability; +static struct video_channel v4l1_channel; +static struct video_tuner v4l1_tuner; +static struct video_picture v4l1_picture; +static struct video_window v4l1_window; + +#if HAVE_V4L2 +static struct v4l2_capability v4l2_capability; +static struct v4l2_input v4l2_input; +static struct v4l2_tuner v4l2_tuner; +static struct v4l2_fmtdesc v4l2_fmtdesc; +static struct v4l2_format v4l2_format; +/*static struct v4l2_framebuffer v4l2_fbuf; */ +/*static struct v4l2_queryctrl v4l2_qctrl; */ +#endif +#endif + +static int v4l1_cap = -1; +static int v4l2_cap = -1; +#define V4L1_MAX 65535 + +#define CHANNEL_MAX 500 +static unsigned long ntsc_cable[CHANNEL_MAX]; +static unsigned long custom_freq[CHANNEL_MAX]; + +static unsigned long last_freq = 0; +static int last_channel = 0; + +static int v4l1_val(int pct) { + /* pct is % */ + int val, max = V4L1_MAX; + if (pct < 0) { + return 0; + } else if (pct > 100) { + return max; + } + val = (pct * max)/100; + + return val; +} +static int v4l1_width(int w) { +#ifdef V4L_OK + int min = v4l1_capability.minwidth; + int max = v4l1_capability.maxwidth; + if (w < min) { + w = min; + } + if (w > max) { + w = max; + } +#endif + return w; +} +static int v4l1_height(int h) { +#ifdef V4L_OK + int min = v4l1_capability.minheight; + int max = v4l1_capability.maxheight; + if (h < min) { + h = min; + } + if (h > max) { + h = max; + } +#endif + return h; +} + +static int v4l1_resize(int fd, int w, int h) { + int dowin = 0; + +#ifdef V4L_OK + memset(&v4l1_window, 0, sizeof(v4l1_window)); + if (ioctl(fd, VIDIOCGWIN, &v4l1_window) == -1) { + return 0; + } + + if (w > 0) w = v4l1_width(w); + + if (w > 0 && w != (int) v4l1_window.width) { + dowin = 1; + } + + if (h > 0) h = v4l1_height(h); + + if (h > 0 && h != (int) v4l1_window.height) { + dowin = 1; + } + + if (dowin) { + v4l1_window.x = 0; + v4l1_window.y = 0; + ioctl(fd, VIDIOCSWIN, &v4l1_window); + if (w > 0) v4l1_window.width = w; + if (h > 0) v4l1_window.height = h; + fprintf(stderr, "calling V4L_1: VIDIOCSWIN\n"); + fprintf(stderr, "trying new size %dx%d\n", + v4l1_window.width, v4l1_window.height); + if (ioctl(fd, VIDIOCSWIN, &v4l1_window) == -1) { + perror("ioctl VIDIOCSWIN"); + return 0; + } + } +#endif + return 1; +} + +static void v4l1_setfreq(int fd, unsigned long freq, int verb) { +#ifdef V4L_OK + unsigned long f0, f1; + f1 = (freq * 16) / 1000; + ioctl(fd, VIDIOCGFREQ, &f0); + if (verb) fprintf(stderr, "read freq: %d\n", (int) f0); + if (freq > 0) { + if (ioctl(fd, VIDIOCSFREQ, &f1) == -1) { + perror("ioctl VIDIOCSFREQ"); + } else { + ioctl(fd, VIDIOCGFREQ, &f0); + if (verb) fprintf(stderr, "read freq: %d\n", (int) f0); + last_freq = freq; + } + } +#endif +} + +static void v4l1_set_input(int fd, int which) { +#ifdef V4L_OK + if (which != -1) { + memset(&v4l1_channel, 0, sizeof(v4l1_channel)); + v4l1_channel.channel = which; + if (ioctl(fd, VIDIOCGCHAN, &v4l1_channel) != -1) { + v4l1_channel.channel = which; + fprintf(stderr, "setting input channel to %d: %s\n", + which, v4l1_channel.name); + last_channel = which; + ioctl(fd, VIDIOCSCHAN, &v4l1_channel); + } + } +#endif +} + +static int v4l1_setfmt(int fd, char *fmt) { +#ifdef V4L_OK + unsigned short fnew; + int bnew, rnew; + + fnew = v4l1_lu_palette_str(fmt, &bnew, &rnew); + if (fnew) { + v4l1_picture.depth = bnew; + v4l1_picture.palette = fnew; + } + fprintf(stderr, "calling V4L_1: VIDIOCSPICT\n"); + if (ioctl(fd, VIDIOCSPICT, &v4l1_picture) == -1) { + perror("ioctl VIDIOCSPICT"); + return 0; + } + if (raw_fb_pixfmt) { + free(raw_fb_pixfmt); + } + raw_fb_pixfmt = strdup(fmt); +#endif + return 1; +} + +static int ignore_all = 0; + +static void apply_settings(char *dev, char *settings, int *fd) { + char *str, *p, *fmt = NULL, *tun = NULL, *inp = NULL; + int br = -1, co = -1, cn = -1, hu = -1; + int w = -1, h = -1, b = -1; + int sta = -1; + int setcnt = 0; +#ifdef V4L_OK + if (! settings || settings[0] == '\0') { + return; + } + str = strdup(settings); + p = strtok(str, ","); + while (p) { + if (strstr(p, "br=") == p) { + br = atoi(p+3); + if (br >= 0) setcnt++; + } else if (strstr(p, "co=") == p) { + co = atoi(p+3); + if (co >= 0) setcnt++; + } else if (strstr(p, "cn=") == p) { + cn = atoi(p+3); + if (cn >= 0) setcnt++; + } else if (strstr(p, "hu=") == p) { + hu = atoi(p+3); + if (hu >= 0) setcnt++; + } else if (strstr(p, "w=") == p) { + w = atoi(p+2); + if (w > 0) setcnt++; + } else if (strstr(p, "h=") == p) { + h = atoi(p+2); + if (h > 0) setcnt++; + } else if (strstr(p, "bpp=") == p) { + b = atoi(p+4); + if (b > 0) setcnt++; + } else if (strstr(p, "fmt=") == p) { + fmt = strdup(p+4); + setcnt++; + } else if (strstr(p, "tun=") == p) { + tun = strdup(p+4); + setcnt++; + } else if (strstr(p, "inp=") == p) { + inp = strdup(p+4); + setcnt++; + } else if (strstr(p, "sta=") == p) { + sta = atoi(p+4); + setcnt++; + } + p = strtok(NULL, ","); + } + free(str); + if (! setcnt) { + return; + } + if (*fd < 0) { + *fd = open_dev(dev); + } + if (*fd < 0) { + return; + } + v4l1_cap = v4l1_query(*fd, 1); + v4l2_cap = v4l2_query(*fd, 1); + + if (v4l1_cap && ! ignore_all) { + if (br >= 0) v4l1_picture.brightness = v4l1_val(br); + if (hu >= 0) v4l1_picture.hue = v4l1_val(hu); + if (co >= 0) v4l1_picture.colour = v4l1_val(co); + if (cn >= 0) v4l1_picture.contrast = v4l1_val(cn); + + fprintf(stderr, "calling V4L_1: VIDIOCSPICT\n"); + if (ioctl(*fd, VIDIOCSPICT, &v4l1_picture) == -1) { + perror("ioctl VIDIOCSPICT"); + } + + if (fmt) { + v4l1_setfmt(*fd, fmt); + } else if (b > 0 && b != v4l1_picture.depth) { + if (b == 8) { + v4l1_setfmt(*fd, "HI240"); + } else if (b == 16) { + v4l1_setfmt(*fd, "RGB565"); + } else if (b == 24) { + v4l1_setfmt(*fd, "RGB24"); + } else if (b == 32) { + v4l1_setfmt(*fd, "RGB32"); + } + } + + v4l1_resize(*fd, w, h); + + if (tun) { + int mode = -1; + if (!strcasecmp(tun, "PAL")) { + mode = VIDEO_MODE_PAL; + } else if (!strcasecmp(tun, "NTSC")) { + mode = VIDEO_MODE_NTSC; + } else if (!strcasecmp(tun, "SECAM")) { + mode = VIDEO_MODE_SECAM; + } else if (!strcasecmp(tun, "AUTO")) { + mode = VIDEO_MODE_AUTO; + } + if (mode != -1) { + int i; + for (i=0; i< v4l1_capability.channels; i++) { + memset(&v4l1_channel, 0, sizeof(v4l1_channel)); + v4l1_channel.channel = i; + if (ioctl(*fd, VIDIOCGCHAN, &v4l1_channel) == -1) { + continue; + } + if (! v4l1_channel.tuners) { + continue; + } + if (v4l1_channel.norm == mode) { + continue; + } + v4l1_channel.norm = mode; + ioctl(*fd, VIDIOCSCHAN, &v4l1_channel); + } + } + } + if (inp) { + char s[2]; + int i, chan = -1; + + s[0] = inp[0]; + s[1] = '\0'; + if (strstr("0123456789", s)) { + chan = atoi(inp); + } else { + for (i=0; i< v4l1_capability.channels; i++) { + memset(&v4l1_channel, 0, sizeof(v4l1_channel)); + v4l1_channel.channel = i; + if (ioctl(*fd, VIDIOCGCHAN, &v4l1_channel) == -1) { + continue; + } + if (!strcmp(v4l1_channel.name, inp)) { + chan = i; + break; + } + } + } + v4l1_set_input(*fd, chan); + } + if (sta >= 0) { + unsigned long freq = lookup_freq(sta); + v4l1_setfreq(*fd, freq, 1); + } + } + v4l1_cap = v4l1_query(*fd, 1); + v4l2_cap = v4l2_query(*fd, 1); +#else + return; +#endif +} + +static double dval = 0.05; + +static int v4l1_dpct(int old, int d) { + int new, max = V4L1_MAX; + + /* -1 and 1 are special cases for "small increments" */ + if (d == -1) { + new = old - (int) (dval * max); + } else if (d == 1) { + new = old + (int) (dval * max); + } else { + new = (d * max)/100; + } + if (new < 0) { + new = 0; + } + if (new > max) { + new = max; + } + return new; +} + +static void v4l_requery(void) { + if (raw_fb_fd < 0) { + return; + } + v4l1_cap = v4l1_query(raw_fb_fd, 1); + v4l2_cap = v4l2_query(raw_fb_fd, 1); +} + +static void v4l_br(int b) { +#ifdef V4L_OK + int old = v4l1_picture.brightness; + + v4l1_picture.brightness = v4l1_dpct(old, b); + ioctl(raw_fb_fd, VIDIOCSPICT, &v4l1_picture); + v4l_requery(); +#endif +} + +static void v4l_hu(int b) { +#ifdef V4L_OK + int old = v4l1_picture.hue; + + v4l1_picture.hue = v4l1_dpct(old, b); + ioctl(raw_fb_fd, VIDIOCSPICT, &v4l1_picture); + v4l_requery(); +#endif +} + +static void v4l_co(int b) { +#ifdef V4L_OK + int old = v4l1_picture.colour; + + v4l1_picture.colour = v4l1_dpct(old, b); + ioctl(raw_fb_fd, VIDIOCSPICT, &v4l1_picture); + v4l_requery(); +#endif +} + +static void v4l_cn(int b) { +#ifdef V4L_OK + int old = v4l1_picture.contrast; + + v4l1_picture.contrast = v4l1_dpct(old, b); + ioctl(raw_fb_fd, VIDIOCSPICT, &v4l1_picture); + v4l_requery(); +#endif +} + +static void v4l_sz(int b) { +#ifdef V4L_OK + int w_old = v4l1_window.width; + int h_old = v4l1_window.height; + int w, h; + + if (w_old == 0) { + w_old = 160; + } + if (h_old == 0) { + h_old = 120; + } + + if (b == 1) { + w = w_old + (int) (0.15 * w_old); + h = h_old + (int) (0.15 * h_old); + } else if (b == -1) { + w = w_old - (int) (0.15 * w_old); + h = h_old - (int) (0.15 * h_old); + } else { + return; + } + + if (! v4l1_resize(raw_fb_fd, w, h)) { + return; + } + + v4l_requery(); + + push_black_screen(4); + + ignore_all = 1; + do_new_fb(1); + ignore_all = 0; +#endif +} + +static void v4l_sta(int sta) { +#ifdef V4L_OK + unsigned long freq = 0; + int cur = lookup_station(last_freq); + + if (! last_freq) { + if (sta == 0 || sta == -1) { + sta = 11; + } + } + + if (sta == -1) { + while (cur > 0) { + freq = lookup_freq(--cur); + if (freq) { + break; + } + } + } else if (sta == 0) { + while (cur < CHANNEL_MAX - 1) { + freq = lookup_freq(++cur); + if (freq) { + break; + } + } + } else { + freq = lookup_freq(sta); + cur = sta; + } + fprintf(stderr, "to station %d / %d\n", cur, (int) freq); + v4l1_setfreq(raw_fb_fd, freq, 0); +#endif +} + +static void v4l_inp(int inp) { +#ifdef V4L_OK + int next = -1; + if (inp == -1) { + inp = last_channel + 1; + if (inp >= v4l1_capability.channels) { + inp = 0; + } + next = inp; + } else if (inp == -2) { + inp = last_channel - 1; + if (inp < 0) { + inp = v4l1_capability.channels - 1; + } + next = inp; + } else { + next = inp; + } + v4l1_set_input(raw_fb_fd, next); +#endif +} + +static void v4l_fmt(char *fmt) { + if (v4l1_setfmt(raw_fb_fd, fmt)) { + v4l_requery(); + + ignore_all = 1; + do_new_fb(1); + ignore_all = 0; + } +} + +void v4l_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { + if (raw_fb_fd < 0) { + return; + } + if (! down) { + return; + } + if (keysym == XK_b) { + v4l_br(-1); + } else if (keysym == XK_B) { + v4l_br(+1); + } else if (keysym == XK_h) { + v4l_hu(-1); + } else if (keysym == XK_H) { + v4l_hu(+1); + } else if (keysym == XK_c) { + v4l_co(-1); + } else if (keysym == XK_C) { + v4l_co(+1); + } else if (keysym == XK_n) { + v4l_cn(-1); + } else if (keysym == XK_N) { + v4l_cn(+1); + } else if (keysym == XK_s) { + v4l_sz(-1); + } else if (keysym == XK_S) { + v4l_sz(+1); + } else if (keysym == XK_i) { + v4l_inp(-1); + } else if (keysym == XK_I) { + v4l_inp(-2); + } else if (keysym == XK_Up) { + v4l_sta(+0); + } else if (keysym == XK_Down) { + v4l_sta(-1); + } else if (keysym == XK_F1) { + v4l_fmt("HI240"); + } else if (keysym == XK_F2) { + v4l_fmt("RGB565"); + } else if (keysym == XK_F3) { + v4l_fmt("RGB24"); + } else if (keysym == XK_F4) { + v4l_fmt("RGB32"); + } else if (keysym == XK_F5) { + v4l_fmt("RGB555"); + } else if (keysym == XK_F6) { + v4l_fmt("GREY"); + } + if (client) {} +} + + +void v4l_pointer_command(int mask, int x, int y, rfbClientPtr client) { + if (mask || x || y || client) {} +} + +static int colon_n(char *line) { + char *q; + int n; + q = strrchr(line, ':'); + if (! q) { + return 0; + } + q = lblanks(q+1); + if (sscanf(q, "%d", &n) == 1) { + return n; + } + return 0; +} + +static char *colon_str(char *line) { + char *q, *p, *t; + q = strrchr(line, ':'); + if (! q) { + return strdup(""); + } + q = lblanks(q+1); + p = strpbrk(q, " \t\n"); + if (p) { + *p = '\0'; + } + t = strdup(q); + *p = '\n'; + return t; +} + +static char *colon_tag(char *line) { + char *q, *p, *t; + q = strrchr(line, '['); + if (! q) { + return strdup(""); + } + q++; + p = strrchr(q, ']'); + if (! p) { + return strdup(""); + } + *p = '\0'; + t = strdup(q); + *p = ']'; + return t; +} + +static void lookup_rgb(char *fmt, int *bits, int *rev) { + int tb, tr; + + if (v4l2_lu_palette_str(fmt, &tb, &tr)) { + *bits = tb; + *rev = tr; + return; + } + if (v4l1_lu_palette_str(fmt, &tb, &tr)) { + *bits = tb; + *rev = tr; + return; + } +} + +static char *v4l1_lu_palette(unsigned short palette) { + switch(palette) { +#ifdef V4L_OK + case VIDEO_PALETTE_GREY: return "GREY"; + case VIDEO_PALETTE_HI240: return "HI240"; + case VIDEO_PALETTE_RGB565: return "RGB565"; + case VIDEO_PALETTE_RGB24: return "RGB24"; + case VIDEO_PALETTE_RGB32: return "RGB32"; + case VIDEO_PALETTE_RGB555: return "RGB555"; + case VIDEO_PALETTE_YUV422: return "YUV422"; + case VIDEO_PALETTE_YUYV: return "YUYV"; + case VIDEO_PALETTE_UYVY: return "UYVY"; + case VIDEO_PALETTE_YUV420: return "YUV420"; + case VIDEO_PALETTE_YUV411: return "YUV411"; + case VIDEO_PALETTE_RAW: return "RAW"; + case VIDEO_PALETTE_YUV422P: return "YUV422P"; + case VIDEO_PALETTE_YUV411P: return "YUV411P"; + case VIDEO_PALETTE_YUV420P: return "YUV420P"; + case VIDEO_PALETTE_YUV410P: return "YUV410P"; +#endif + default: return "unknown"; + } +} + +static unsigned short v4l1_lu_palette_str(char *name, int *bits, int *rev) { +#ifdef V4L_OK + *rev = 0; + if (!strcmp(name, "RGB555")) { + *bits = 16; + return VIDEO_PALETTE_RGB555; + } else if (!strcmp(name, "RGB565")) { + *bits = 16; + return VIDEO_PALETTE_RGB565; + } else if (!strcmp(name, "RGB24")) { + *bits = 24; + return VIDEO_PALETTE_RGB24; + } else if (!strcmp(name, "RGB32")) { + *bits = 32; + return VIDEO_PALETTE_RGB32; + } else if (!strcmp(name, "HI240")) { + *bits = 8; + return VIDEO_PALETTE_HI240; + } else if (!strcmp(name, "GREY")) { + *bits = 8; + return VIDEO_PALETTE_GREY; + } +#endif + return 0; +} + +static char *v4l2_lu_palette(unsigned int fmt) { + switch(fmt) { +#if defined(V4L_OK) && HAVE_V4L2 + case V4L2_PIX_FMT_RGB332: return "RGB332"; + case V4L2_PIX_FMT_RGB555: return "RGB555"; + case V4L2_PIX_FMT_RGB565: return "RGB565"; + case V4L2_PIX_FMT_RGB555X: return "RGB555X"; + case V4L2_PIX_FMT_RGB565X: return "RGB565X"; + case V4L2_PIX_FMT_BGR24: return "BGR24"; + case V4L2_PIX_FMT_RGB24: return "RGB24"; + case V4L2_PIX_FMT_BGR32: return "BGR32"; + case V4L2_PIX_FMT_RGB32: return "RGB32"; + case V4L2_PIX_FMT_GREY: return "GREY"; + case V4L2_PIX_FMT_YVU410: return "YVU410"; + case V4L2_PIX_FMT_YVU420: return "YVU420"; + case V4L2_PIX_FMT_YUYV: return "YUYV"; + case V4L2_PIX_FMT_UYVY: return "UYVY"; + case V4L2_PIX_FMT_YUV422P: return "YUV422P"; + case V4L2_PIX_FMT_YUV411P: return "YUV411P"; + case V4L2_PIX_FMT_Y41P: return "Y41P"; + case V4L2_PIX_FMT_NV12: return "NV12"; + case V4L2_PIX_FMT_NV21: return "NV21"; + case V4L2_PIX_FMT_YUV410: return "YUV410"; + case V4L2_PIX_FMT_YUV420: return "YUV420"; + case V4L2_PIX_FMT_YYUV: return "YYUV"; + case V4L2_PIX_FMT_HI240: return "HI240"; + case V4L2_PIX_FMT_MJPEG: return "MJPEG"; + case V4L2_PIX_FMT_JPEG: return "JPEG"; + case V4L2_PIX_FMT_DV: return "DV"; + case V4L2_PIX_FMT_MPEG: return "MPEG"; +#endif + default: return "unknown"; + } +} + +static unsigned int v4l2_lu_palette_str(char *name, int *bits, int *rev) { +#if defined(V4L_OK) && HAVE_V4L2 + if (!strcmp(name, "RGB1") || !strcmp(name, "RGB332")) { + *bits = 8; + *rev = 0; + return V4L2_PIX_FMT_RGB332; + } else if (!strcmp(name, "RGBO") || !strcmp(name, "RGB555")) { + *bits = 16; + *rev = 0; + return V4L2_PIX_FMT_RGB555; + } else if (!strcmp(name, "RGBP") || !strcmp(name, "RGB565")) { + *bits = 16; + *rev = 0; + return V4L2_PIX_FMT_RGB565; + } else if (!strcmp(name, "RGBQ") || !strcmp(name, "RGB555X")) { + *bits = 16; + *rev = 1; + return V4L2_PIX_FMT_RGB555X; + } else if (!strcmp(name, "RGBR") || !strcmp(name, "RGB565X")) { + *bits = 16; + *rev = 1; + return V4L2_PIX_FMT_RGB565X; + } else if (!strcmp(name, "BGR3") || !strcmp(name, "BGR24")) { + *bits = 24; + *rev = 1; + return V4L2_PIX_FMT_BGR24; + } else if (!strcmp(name, "RGB3") || !strcmp(name, "RGB24")) { + *bits = 24; + *rev = 0; + return V4L2_PIX_FMT_RGB24; + } else if (!strcmp(name, "BGR4") || !strcmp(name, "BGR32")) { + *bits = 32; + *rev = 1; + return V4L2_PIX_FMT_BGR32; + } else if (!strcmp(name, "RGB4") || !strcmp(name, "RGB32")) { + *bits = 32; + *rev = 0; + return V4L2_PIX_FMT_RGB32; + } else if (!strcmp(name, "GREY")) { + *bits = 8; + *rev = 0; + return V4L2_PIX_FMT_GREY; + } +#endif + return 0; +} + +static int v4l1_query(int fd, int v) { +#ifdef V4L_OK + unsigned int i; + + memset(&v4l1_capability, 0, sizeof(v4l1_capability)); + memset(&v4l1_channel, 0, sizeof(v4l1_channel)); + memset(&v4l1_tuner, 0, sizeof(v4l1_tuner)); + memset(&v4l1_picture, 0, sizeof(v4l1_picture)); + memset(&v4l1_window, 0, sizeof(v4l1_window)); + + if (v) fprintf(stderr, "\nV4L_1 query:\n"); +#ifdef VIDIOCGCAP + if (ioctl(fd, VIDIOCGCAP, &v4l1_capability) == -1) { + perror("ioctl VIDIOCGCAP"); + fprintf(stderr, "\n"); + return 0; + } +#else + return 0; +#endif + if (v) fprintf(stderr, "v4l-1 capability:\n"); + if (v) fprintf(stderr, " name: %s\n", v4l1_capability.name); + if (v) fprintf(stderr, " channels: %d\n", v4l1_capability.channels); + if (v) fprintf(stderr, " audios: %d\n", v4l1_capability.audios); + if (v) fprintf(stderr, " maxwidth: %d\n", v4l1_capability.maxwidth); + if (v) fprintf(stderr, " maxheight: %d\n", v4l1_capability.maxheight); + if (v) fprintf(stderr, " minwidth: %d\n", v4l1_capability.minwidth); + if (v) fprintf(stderr, " minheight: %d\n", v4l1_capability.minheight); + + for (i=0; (int) i < v4l1_capability.channels; i++) { + char *type = "unknown"; + memset(&v4l1_channel, 0, sizeof(v4l1_channel)); + v4l1_channel.channel = i; + if (ioctl(fd, VIDIOCGCHAN, &v4l1_channel) == -1) { + perror("ioctl VIDIOCGCHAN"); + continue; + } + if (v4l1_channel.type == VIDEO_TYPE_TV) { + type = "TV"; + } else if (v4l1_channel.type == VIDEO_TYPE_CAMERA) { + type = "CAMERA"; + } + if (v) fprintf(stderr, " channel[%d]: %s\ttuners: %d norm: %d type: %d %s\n", + i, v4l1_channel.name, v4l1_channel.tuners, v4l1_channel.norm, + v4l1_channel.type, type); + } + + memset(&v4l1_tuner, 0, sizeof(v4l1_tuner)); + if (ioctl(fd, VIDIOCGTUNER, &v4l1_tuner) != -1) { + char *mode = "unknown"; + if (v4l1_tuner.mode == VIDEO_MODE_PAL) { + mode = "PAL"; + } else if (v4l1_tuner.mode == VIDEO_MODE_NTSC) { + mode = "NTSC"; + } else if (v4l1_tuner.mode == VIDEO_MODE_SECAM) { + mode = "SECAM"; + } else if (v4l1_tuner.mode == VIDEO_MODE_AUTO) { + mode = "AUTO"; + } + + if (v) fprintf(stderr, " tuner[%d]: %s\tflags: 0x%x mode: %s\n", + v4l1_tuner.tuner, v4l1_tuner.name, v4l1_tuner.flags, mode); + + } + + if (ioctl(fd, VIDIOCGPICT, &v4l1_picture) == -1) { + perror("ioctl VIDIOCGCHAN"); + return 0; + } + if (v) fprintf(stderr, "v4l-1 picture:\n"); + if (v) fprintf(stderr, " brightness: %d\n", v4l1_picture.brightness); + if (v) fprintf(stderr, " hue: %d\n", v4l1_picture.hue); + if (v) fprintf(stderr, " colour: %d\n", v4l1_picture.colour); + if (v) fprintf(stderr, " contrast: %d\n", v4l1_picture.contrast); + if (v) fprintf(stderr, " whiteness: %d\n", v4l1_picture.whiteness); + if (v) fprintf(stderr, " depth: %d\n", v4l1_picture.depth); + if (v) fprintf(stderr, " palette: %d %s\n", v4l1_picture.palette, + v4l1_lu_palette(v4l1_picture.palette)); + + if (ioctl(fd, VIDIOCGWIN, &v4l1_window) == -1) { + perror("ioctl VIDIOCGWIN"); + if (v) fprintf(stderr, "\n"); + return 0; + } + if (v) fprintf(stderr, "v4l-1 window:\n"); + if (v) fprintf(stderr, " x: %d\n", v4l1_window.x); + if (v) fprintf(stderr, " y: %d\n", v4l1_window.y); + if (v) fprintf(stderr, " width: %d\n", v4l1_window.width); + if (v) fprintf(stderr, " height: %d\n", v4l1_window.height); + if (v) fprintf(stderr, " chromakey: %d\n", v4l1_window.chromakey); + if (v) fprintf(stderr, "\n"); + + return 1; +#else + return 0; +#endif /* V4L_OK */ + +} +static int v4l2_query(int fd, int v) { +#if defined(V4L_OK) && HAVE_V4L2 + unsigned int i; + + memset(&v4l2_capability, 0, sizeof(v4l2_capability)); + memset(&v4l2_input, 0, sizeof(v4l2_input)); + memset(&v4l2_tuner, 0, sizeof(v4l2_tuner)); + memset(&v4l2_fmtdesc, 0, sizeof(v4l2_fmtdesc)); + memset(&v4l2_format, 0, sizeof(v4l2_format)); + + if (v) fprintf(stderr, "\nV4L_2 query:\n"); +#ifdef VIDIOC_QUERYCAP + if (ioctl(fd, VIDIOC_QUERYCAP, &v4l2_capability) == -1) { + perror("ioctl VIDIOC_QUERYCAP"); + if (v) fprintf(stderr, "\n"); + return 0; + } +#else + return 0; +#endif + + if (v) fprintf(stderr, "v4l-2 capability:\n"); + if (v) fprintf(stderr, " driver: %s\n", v4l2_capability.driver); + if (v) fprintf(stderr, " card: %s\n", v4l2_capability.card); + if (v) fprintf(stderr, " bus_info: %s\n", v4l2_capability.bus_info); + if (v) fprintf(stderr, " version: %d\n", v4l2_capability.version); + if (v) fprintf(stderr, " capabilities: %u\n", v4l2_capability.capabilities); + + for (i=0; ; i++) { + memset(&v4l2_input, 0, sizeof(v4l2_input)); + v4l2_input.index = i; + if (ioctl(fd, VIDIOC_ENUMINPUT, &v4l2_input) == -1) { + break; + } + if (v) fprintf(stderr, " input[%d]: %s\ttype: %d tuner: %d\n", + i, v4l2_input.name, v4l2_input.type, v4l2_input.tuner); + } + if (v4l2_capability.capabilities & V4L2_CAP_TUNER) { + for (i=0; ; i++) { + memset(&v4l2_tuner, 0, sizeof(v4l2_tuner)); + v4l2_tuner.index = i; + if (ioctl(fd, VIDIOC_G_TUNER, &v4l2_tuner) == -1) { + break; + } + if (v) fprintf(stderr, " tuner[%d]: %s\ttype: %d\n", + i, v4l2_tuner.name, v4l2_tuner.type); + } + } + if (v4l2_capability.capabilities & V4L2_CAP_VIDEO_CAPTURE) { + for (i=0; ; i++) { + memset(&v4l2_fmtdesc, 0, sizeof(v4l2_fmtdesc)); + v4l2_fmtdesc.index = i; + v4l2_fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + if (ioctl(fd, VIDIOC_ENUM_FMT, &v4l2_fmtdesc) == -1) { + break; + } + if (v) fprintf(stderr, " fmtdesc[%d]: %s\ttype: %d" + " pixelformat: %d\n", + i, v4l2_fmtdesc.description, v4l2_fmtdesc.type, + v4l2_fmtdesc.pixelformat); + } + v4l2_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (ioctl(fd, VIDIOC_G_FMT, &v4l2_format) == -1) { + perror("ioctl VIDIOC_G_FMT"); + } else { + if (v) fprintf(stderr, " width: %d\n", v4l2_format.fmt.pix.width); + if (v) fprintf(stderr, " height: %d\n", v4l2_format.fmt.pix.height); + if (v) fprintf(stderr, " format: %u %s\n", + v4l2_format.fmt.pix.pixelformat, + v4l2_lu_palette(v4l2_format.fmt.pix.pixelformat)); + } + } + + return 1; +#else + return 0; +#endif /* V4L_OK && HAVE_V4L2 */ + +} + +static int open_dev(char *dev) { + int dfd = -1; + if (! dev) { + return dfd; + } + dfd = open(dev, O_RDWR); + if (dfd < 0) { + rfbLog("failed to rawfb file: %s O_RDWR\n", dev); + rfbLogPerror("open"); + dfd = open(dev, O_RDONLY); + } + if (dfd < 0) { + rfbLog("failed to rawfb file: %s\n", dev); + rfbLog("failed to rawfb file: %s O_RDONLY\n", dev); + rfbLogPerror("open"); + } + return dfd; +} + +static char *guess_via_v4l(char *dev, int *fd) { +#ifdef V4L_OK + int dfd; + + if (*fd < 0) { + dfd = open_dev(dev); + *fd = dfd; + } + dfd = *fd; + if (dfd < 0) { + return NULL; + } + if (v4l1_cap < 0) { + v4l1_cap = v4l1_query(dfd, 1); + } + if (v4l2_cap < 0) { + v4l2_cap = v4l2_query(dfd, 1); + } + + if (v4l2_cap) { +#if HAVE_V4L2 + int g_w = v4l2_format.fmt.pix.width; + int g_h = v4l2_format.fmt.pix.height; + int g_d = 0, g_rev; + + if (v4l2_format.fmt.pix.pixelformat) { + char *str = v4l2_lu_palette(v4l2_format.fmt.pix.pixelformat); + if (strcmp(str, "unknown")) { + v4l2_lu_palette_str(str, &g_d, &g_rev); + } + } + + if (g_w > 0 && g_h > 0 && g_d > 0) { + char *atparms = (char *) malloc(200); + char *pal = v4l2_lu_palette(v4l2_format.fmt.pix.pixelformat); + sprintf(atparms, "%dx%dx%d", g_w, g_h, g_d); + if (strstr(pal, "RGB555")) { + strcat(atparms, ":7c00/3e0/1f"); + } + *fd = dfd; + return atparms; + } +#endif + } + if (v4l1_cap) { + int g_w = v4l1_window.width; + int g_h = v4l1_window.height; + int g_d = v4l1_picture.depth; + int g_rev; + if (g_d == 0) { + char *str = v4l1_lu_palette(v4l1_picture.palette); + if (strcmp(str, "unknown")) { + v4l1_lu_palette_str(str, &g_d, &g_rev); + } + } +if (0) fprintf(stderr, "v4l1: %d %d %d\n", g_w, g_h, g_d); + if (g_w > 0 && g_h > 0 && g_d > 0) { + char *atparms = (char *) malloc(200); + char *pal = v4l1_lu_palette(v4l1_picture.palette); + fprintf(stderr, "palette: %s\n", pal); + sprintf(atparms, "%dx%dx%d", g_w, g_h, g_d); + if (strstr(pal, "RGB555")) { + strcat(atparms, ":7c00/3e0/1f"); + } + *fd = dfd; + return atparms; + } + } + + /* failure */ + close(dfd); + return NULL; +#else + return NULL; +#endif +} + +static char *guess_via_v4l_info(char *dev, int *fd) { + char *atparms, *cmd; + char line[1024], tmp[] = "/tmp/x11vnc-tmp.XXXXXX"; + FILE *out; + int tmp_fd, len, rc, curr = 0; + int g_w = 0, g_h = 0, g_b = 0, mask_rev = 0; + char *g_fmt = NULL; + + if (*fd) {} + + if (no_external_cmds) { + rfbLog("guess_via_v4l_info: cannot run external " + "command: v4l-info\n"); + return NULL; + } + + if (strchr(dev, '\'')) { + rfbLog("guess_via_v4l_info: bad dev string: %s\n", dev); + return NULL; + } + + tmp_fd = mkstemp(tmp); + if (tmp_fd < 0) { + return NULL; + } + + len = strlen("v4l-info")+1+1+strlen(dev)+1+1+1+1+strlen(tmp)+1; + cmd = (char *) malloc(len); + rfbLog("guess_via_v4l_info running: v4l-info '%s'\n", dev); + sprintf(cmd, "v4l-info '%s' > %s", dev, tmp); + + close(tmp_fd); + rc = system(cmd); + if (rc != 0) { + unlink(tmp); + return NULL; + } + + out = fopen(tmp, "r"); + if (out == NULL) { + unlink(tmp); + return NULL; + } + + curr = 0; + while (fgets(line, 1024, out) != NULL) { + char *lb = lblanks(line); + if (strstr(line, "video capture") == line) { + curr = C_VIDEO_CAPTURE; + } else if (strstr(line, "picture") == line) { + curr = C_PICTURE; + } else if (strstr(line, "window") == line) { + curr = C_WINDOW; + } + +if (0) fprintf(stderr, "lb: %s", lb); + + if (curr == C_VIDEO_CAPTURE) { + if (strstr(lb, "pixelformat ") == lb) { + fprintf(stderr, "%s", line); + } else if (strstr(lb, "fmt.pix.width ") == lb) { + if (! g_w) { + g_w = colon_n(line); + } + } else if (strstr(lb, "fmt.pix.height ") == lb) { + if (! g_h) { + g_h = colon_n(line); + } + } else if (strstr(lb, "fmt.pix.pixelformat ") == lb) { + if (! g_fmt) { + g_fmt = colon_tag(line); + } + } + } else if (curr == C_PICTURE) { + if (strstr(lb, "depth ") == lb) { + if (! g_b) { + g_b = colon_n(line); + } + } else if (strstr(lb, "palette ") == lb) { + if (! g_fmt) { + g_fmt = colon_str(line); + } + } + } else if (curr == C_WINDOW) { + if (strstr(lb, "width ") == lb) { + if (! g_w) { + g_w = colon_n(line); + } + } else if (strstr(lb, "height ") == lb) { + if (! g_h) { + g_h = colon_n(line); + } + } + } + } + fclose(out); + unlink(tmp); + + if (! g_w) { + rfbLog("could not guess device width.\n"); + return NULL; + } + rfbLog("guessed device width: %d\n", g_w); + + if (! g_h) { + rfbLog("could not guess device height.\n"); + return NULL; + } + rfbLog("guessed device height: %d\n", g_h); + + if (g_fmt) { + rfbLog("guessed pixel fmt: %s\n", g_fmt); + lookup_rgb(g_fmt, &g_b, &mask_rev); + } + if (! g_b) { + rfbLog("could not guess device bpp.\n"); + return NULL; + } + rfbLog("guessed device bpp: %d\n", g_b); + + atparms = (char *) malloc(100); + sprintf(atparms, "%dx%dx%d", g_w, g_h, g_b); + return atparms; +} + +static void parse_str(char *str, char **dev, char **settings, char **atparms) { + char *p, *q, *s = NULL; + + q = strchr(str, '@'); + if (q && strlen(q+1) > 0) { + /* ends @WxHXB... */ + *atparms = strdup(q+1); + *q = '\0'; + } + + q = strchr(str, ':'); + if (q && strlen(q+1) > 0) { + /* ends :br=N,w=N... */ + s = strdup(q+1); + *settings = s; + *q = '\0'; + } + + if (s != NULL) { + /* see if fn=filename */ + q = strstr(s, "fn="); + if (q) { + q += strlen("fn="); + p = strchr(q, ','); + if (p) { + *p = '\0'; + *dev = strdup(q); + *p = ','; + } else { + *dev = strdup(q); + } + rfbLog("set video device to: '%s'\n", *dev); + } + } + + if (*dev == NULL) { + s = (char *) malloc(strlen("/dev/") + strlen(str) + 1); + if (strstr(str, "/dev/") == str) { + sprintf(s, "%s", str); + } else { + sprintf(s, "/dev/%s", str); + } + *dev = s; + rfbLog("set video device to: '%s'\n", *dev); + } +} + +char *v4l_guess(char *str, int *fd) { + char *dev = NULL, *settings = NULL, *atparms = NULL; + + parse_str(str, &dev, &settings, &atparms); + + init_freqs(); + + v4l1_cap = -1; + v4l2_cap = -1; + *fd = -1; + + if (dev == NULL) { + rfbLog("v4l_guess: could not find device in: %s\n", str); + return NULL; + } + + if (settings) { + apply_settings(dev, settings, fd); + } + + if (atparms) { + /* use user's parameters. */ + char *t = (char *) malloc(5+strlen(dev)+1+strlen(atparms)+1); + sprintf(t, "snap:%s@%s", dev, atparms); + return t; + } + + /* try to query the device for parameters. */ + atparms = guess_via_v4l(dev, fd); + if (atparms == NULL) { + /* try again with v4l-info(1) */ + atparms = guess_via_v4l_info(dev, fd); + } + + if (atparms == NULL) { + /* bad news */ + if (*fd >= 0) { + close(*fd); + } + *fd = -1; + return NULL; + } else { + char *t = (char *) malloc(5+strlen(dev)+1+strlen(atparms)+1); + sprintf(t, "snap:%s@%s", dev, atparms); + return t; + } +} + +static unsigned long lookup_freqtab(int sta) { + + if (sta >= CHANNEL_MAX) { + return (unsigned long) sta; + } + if (sta < 0 || sta >= CHANNEL_MAX) { + return 0; + } + return custom_freq[sta]; +} + +static unsigned long lookup_freq(int sta) { + if (freqtab) { + return lookup_freqtab(sta); + } + if (sta >= CHANNEL_MAX) { + return (unsigned long) sta; + } + if (sta < 1 || sta > 125) { + return 0; + } + return ntsc_cable[sta]; +} + +static int lookup_station(unsigned long freq) { + int i; + if (freqtab) { + for (i = 0; i < CHANNEL_MAX; i++) { +if (0) fprintf(stderr, "%lu %lu\n", freq, custom_freq[i]); + if (freq == custom_freq[i]) { + return i; + } + } + } else { + for (i = 1; i <= 125; i++) { + if (freq == ntsc_cable[i]) { + return i; + } + } + } + return 0; +} + +static void init_freqtab(char *file) { + char *p, *q, *dir, *file2; + char line[1024], inc[1024]; + char *text, *str; + int size = 0, maxn, extra, currn; + FILE *in1, *in2; + static int v = 1; + if (quiet) { + v = 0; + } + + /* YUCK */ + + dir = strdup(file); + q = strrchr(dir, '/'); + if (q) { + *(q+1) = '\0'; + } else { + free(dir); + dir = strdup("./"); + } + file2 = (char *) malloc(strlen(dir) + 1024 + 1); + in1 = fopen(file, "r"); + if (in1 == NULL) { + rfbLog("error opening freqtab: %s\n", file); + clean_up_exit(1); + } + if (v) fprintf(stderr, "loading frequencies from: %s\n", file); + while (fgets(line, 1024, in1) != NULL) { + char *lb; + char line2[1024]; + size += strlen(line); + lb = lblanks(line); + if (strstr(lb, "#include") == lb && + sscanf(lb, "#include %s", inc) == 1) { + char *q, *s = inc; + if (s[0] == '"') { + s++; + } + q = strrchr(s, '"'); + if (q) { + *q = '\0'; + } + sprintf(file2, "%s%s", dir, s); + in2 = fopen(file2, "r"); + if (in2 == NULL) { + rfbLog("error opening freqtab include: %s %s\n", line, file2); + clean_up_exit(1); + } + if (v) fprintf(stderr, "loading frequencies from: %s\n", file2); + while (fgets(line2, 1024, in2) != NULL) { + size += strlen(line2); + } + fclose(in2); + } + } + fclose(in1); + + size = 4*(size + 10000); + + text = (char *) malloc(size); + + text[0] = '\0'; + + in1 = fopen(file, "r"); + if (in1 == NULL) { + rfbLog("error opening freqtab: %s\n", file); + clean_up_exit(1); + } + while (fgets(line, 1024, in1) != NULL) { + char *lb; + char line2[1024]; + lb = lblanks(line); + if (lb[0] == '[') { + strcat(text, lb); + } else if (strstr(lb, "freq")) { + strcat(text, lb); + } else if (strstr(lb, "#include") == lb && + sscanf(lb, "#include %s", inc) == 1) { + char *lb2; + char *q, *s = inc; + if (s[0] == '"') { + s++; + } + q = strrchr(s, '"'); + if (q) { + *q = '\0'; + } + sprintf(file2, "%s%s", dir, s); + in2 = fopen(file2, "r"); + if (in2 == NULL) { + rfbLog("error opening freqtab include: %s %s\n", line, file2); + clean_up_exit(1); + } + while (fgets(line2, 1024, in2) != NULL) { + lb2 = lblanks(line2); + if (lb2[0] == '[') { + strcat(text, lb2); + } else if (strstr(lb2, "freq")) { + strcat(text, lb2); + } + if ((int) strlen(text) > size/2) { + break; + } + } + fclose(in2); + } + if ((int) strlen(text) > size/2) { + break; + } + } + fclose(in1); + + if (0) fprintf(stderr, "%s", text); + + str = strdup(text); + p = strtok(str, "\n"); + maxn = -1; + extra = 0; + while (p) { + if (p[0] == '[') { + int ok = 1; + q = p+1; + while (*q) { + if (*q == ']') { + break; + } + if (! isdigit(*q)) { + if (0) fprintf(stderr, "extra: %s\n", p); + extra++; + ok = 0; + break; + } + q++; + } + if (ok) { + int n; + if (sscanf(p, "[%d]", &n) == 1) { + if (n > maxn) { + maxn = n; + } + if (0) fprintf(stderr, "maxn: %d %d\n", maxn, n); + } + } + + } + p = strtok(NULL, "\n"); + } + free(str); + + str = strdup(text); + p = strtok(str, "\n"); + extra = 0; + currn = 0; + if (v) fprintf(stderr, "\nname\tstation\tfreq (KHz)\n"); + while (p) { + if (p[0] == '[') { + int ok = 1; + strncpy(line, p, 100); + q = p+1; + while (*q) { + if (*q == ']') { + break; + } + if (! isdigit(*q)) { + extra++; + currn = maxn + extra; + ok = 0; + break; + } + q++; + } + if (ok) { + int n; + if (sscanf(p, "[%d]", &n) == 1) { + currn = n; + } + } + } + if (strstr(p, "freq") && (q = strchr(p, '=')) != NULL) { + int n; + q = lblanks(q+1); + if (sscanf(q, "%d", &n) == 1) { + if (currn >= 0 && currn < CHANNEL_MAX) { + if (v) fprintf(stderr, "%s\t%d\t%d\n", line, currn, n); + custom_freq[currn] = (unsigned long) n; + if (last_freq == 0) { + last_freq = custom_freq[currn]; + } + } + } + } + p = strtok(NULL, "\n"); + } + if (v) fprintf(stderr, "\n"); + v = 0; + free(str); + free(text); + free(dir); + free(file2); +} + +static void init_freqs(void) { + int i; + for (i=0; i<CHANNEL_MAX; i++) { + ntsc_cable[i] = 0; + custom_freq[i] = 0; + } + + init_ntsc_cable(); + last_freq = ntsc_cable[1]; + + if (freqtab) { + init_freqtab(freqtab); + } +} + +static void init_ntsc_cable(void) { + ntsc_cable[1] = 73250; + ntsc_cable[2] = 55250; + ntsc_cable[3] = 61250; + ntsc_cable[4] = 67250; + ntsc_cable[5] = 77250; + ntsc_cable[6] = 83250; + ntsc_cable[7] = 175250; + ntsc_cable[8] = 181250; + ntsc_cable[9] = 187250; + ntsc_cable[10] = 193250; + ntsc_cable[11] = 199250; + ntsc_cable[12] = 205250; + ntsc_cable[13] = 211250; + ntsc_cable[14] = 121250; + ntsc_cable[15] = 127250; + ntsc_cable[16] = 133250; + ntsc_cable[17] = 139250; + ntsc_cable[18] = 145250; + ntsc_cable[19] = 151250; + ntsc_cable[20] = 157250; + ntsc_cable[21] = 163250; + ntsc_cable[22] = 169250; + ntsc_cable[23] = 217250; + ntsc_cable[24] = 223250; + ntsc_cable[25] = 229250; + ntsc_cable[26] = 235250; + ntsc_cable[27] = 241250; + ntsc_cable[28] = 247250; + ntsc_cable[29] = 253250; + ntsc_cable[30] = 259250; + ntsc_cable[31] = 265250; + ntsc_cable[32] = 271250; + ntsc_cable[33] = 277250; + ntsc_cable[34] = 283250; + ntsc_cable[35] = 289250; + ntsc_cable[36] = 295250; + ntsc_cable[37] = 301250; + ntsc_cable[38] = 307250; + ntsc_cable[39] = 313250; + ntsc_cable[40] = 319250; + ntsc_cable[41] = 325250; + ntsc_cable[42] = 331250; + ntsc_cable[43] = 337250; + ntsc_cable[44] = 343250; + ntsc_cable[45] = 349250; + ntsc_cable[46] = 355250; + ntsc_cable[47] = 361250; + ntsc_cable[48] = 367250; + ntsc_cable[49] = 373250; + ntsc_cable[50] = 379250; + ntsc_cable[51] = 385250; + ntsc_cable[52] = 391250; + ntsc_cable[53] = 397250; + ntsc_cable[54] = 403250; + ntsc_cable[55] = 409250; + ntsc_cable[56] = 415250; + ntsc_cable[57] = 421250; + ntsc_cable[58] = 427250; + ntsc_cable[59] = 433250; + ntsc_cable[60] = 439250; + ntsc_cable[61] = 445250; + ntsc_cable[62] = 451250; + ntsc_cable[63] = 457250; + ntsc_cable[64] = 463250; + ntsc_cable[65] = 469250; + ntsc_cable[66] = 475250; + ntsc_cable[67] = 481250; + ntsc_cable[68] = 487250; + ntsc_cable[69] = 493250; + ntsc_cable[70] = 499250; + ntsc_cable[71] = 505250; + ntsc_cable[72] = 511250; + ntsc_cable[73] = 517250; + ntsc_cable[74] = 523250; + ntsc_cable[75] = 529250; + ntsc_cable[76] = 535250; + ntsc_cable[77] = 541250; + ntsc_cable[78] = 547250; + ntsc_cable[79] = 553250; + ntsc_cable[80] = 559250; + ntsc_cable[81] = 565250; + ntsc_cable[82] = 571250; + ntsc_cable[83] = 577250; + ntsc_cable[84] = 583250; + ntsc_cable[85] = 589250; + ntsc_cable[86] = 595250; + ntsc_cable[87] = 601250; + ntsc_cable[88] = 607250; + ntsc_cable[89] = 613250; + ntsc_cable[90] = 619250; + ntsc_cable[91] = 625250; + ntsc_cable[92] = 631250; + ntsc_cable[93] = 637250; + ntsc_cable[94] = 643250; + ntsc_cable[95] = 91250; + ntsc_cable[96] = 97250; + ntsc_cable[97] = 103250; + ntsc_cable[98] = 109250; + ntsc_cable[99] = 115250; + ntsc_cable[100] = 649250; + ntsc_cable[101] = 655250; + ntsc_cable[102] = 661250; + ntsc_cable[103] = 667250; + ntsc_cable[104] = 673250; + ntsc_cable[105] = 679250; + ntsc_cable[106] = 685250; + ntsc_cable[107] = 691250; + ntsc_cable[108] = 697250; + ntsc_cable[109] = 703250; + ntsc_cable[110] = 709250; + ntsc_cable[111] = 715250; + ntsc_cable[112] = 721250; + ntsc_cable[113] = 727250; + ntsc_cable[114] = 733250; + ntsc_cable[115] = 739250; + ntsc_cable[116] = 745250; + ntsc_cable[117] = 751250; + ntsc_cable[118] = 757250; + ntsc_cable[119] = 763250; + ntsc_cable[120] = 769250; + ntsc_cable[121] = 775250; + ntsc_cable[122] = 781250; + ntsc_cable[123] = 787250; + ntsc_cable[124] = 793250; + ntsc_cable[125] = 799250; +} + diff --git a/x11vnc/v4l.h b/x11vnc/v4l.h new file mode 100644 index 0000000..aeaddf5 --- /dev/null +++ b/x11vnc/v4l.h @@ -0,0 +1,10 @@ +#ifndef _X11VNC_V4L_H +#define _X11VNC_V4L_H + +/* -- v4l.h -- */ +extern char *v4l_guess(char *str, int *fd); +extern void v4l_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); +extern void v4l_pointer_command(int mask, int x, int y, rfbClientPtr client); + + +#endif /* _X11VNC_V4L_H */ diff --git a/x11vnc/win_utils.c b/x11vnc/win_utils.c index aad1362..a7ebe06 100644 --- a/x11vnc/win_utils.c +++ b/x11vnc/win_utils.c @@ -4,6 +4,7 @@ #include "xinerama.h" #include "winattr_t.h" #include "cleanup.h" +#include "xwrappers.h" winattr_t *stack_list = NULL; int stack_list_len = 0; @@ -32,6 +33,7 @@ Window parent_window(Window win, char **name) { if (name != NULL) { *name = NULL; } + RAWFB_RET(None) old_handler = XSetErrorHandler(trap_xerror); trapped_xerror = 0; @@ -68,6 +70,7 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) { if (win == None) { return 0; } + RAWFB_RET(0) old_handler = XSetErrorHandler(trap_xerror); trapped_xerror = 0; @@ -92,6 +95,8 @@ Bool xtranslate(Window src, Window dst, int src_x, int src_y, int *dst_x, XErrorHandler old_handler; Bool ok = False; + RAWFB_RET(False) + trapped_xerror = 0; old_handler = XSetErrorHandler(trap_xerror); if (XTranslateCoordinates(dpy, src, dst, src_x, src_y, dst_x, @@ -157,6 +162,8 @@ void snapshot_stack_list(int free_only, double allowed_age) { stack_list_num = 0; last_free = now; + RAWFB_RET_VOID + X_LOCK; /* no need to trap error since rootwin */ rc = XQueryTree(dpy, rootwin, &r, &w, &list, &ui); @@ -261,6 +268,7 @@ Window query_pointer(Window start) { Window r, c; int rx, ry, wx, wy; unsigned int mask; + RAWFB_RET(None) if (start == None) { start = rootwin; } @@ -276,6 +284,8 @@ int pick_windowid(unsigned long *num) { int ok = 0, n = 0, msec = 10, secmax = 15; FILE *p; + RAWFB_RET(0) + if (use_dpy) { set_env("DISPLAY", use_dpy); } @@ -319,7 +329,7 @@ int pick_windowid(unsigned long *num) { * note this rfbPE takes about 30ms too: */ rfbPE(-1); - XFlush(dpy); + XFlush_wr(dpy); continue; } } @@ -353,6 +363,8 @@ Window descend_pointer(int depth, Window start, char *name_info, int len) { static int nm_cache_len = 0; static Window prev_start = None; + RAWFB_RET(None) + if (! classhint) { classhint = XAllocClassHint(); } diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index df46062..cb232aa 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -1,8 +1,8 @@ .\" This file was automatically generated from x11vnc -help output. -.TH X11VNC "1" "April 2006" "x11vnc " "User Commands" +.TH X11VNC "1" "May 2006" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.8.1, lastmod: 2006-04-25 + version: 0.8.1, lastmod: 2006-05-06 .SH SYNOPSIS .B x11vnc [OPTION]... @@ -261,6 +261,21 @@ response. Debugging for this mode can be enabled by setting "dbg=1", "dbg=2", or "dbg=3". .PP +\fB-24to32\fR +.IP +Very rare problem: if the framebuffer (X display +or \fB-rawfb)\fR is 24bpp instead of the usual 32bpp, then +dynamically transform the pixels to 32bpp. This will be +slower, but can be used to work around problems where +VNC viewers cannot handle 24bpp (e.g. "main: setPF: +not 8, 16 or 32 bpp?"). See the FAQ for more info. +.IP +In the case of \fB-rawfb\fR mode, the pixels are directly +modified by inserting a 0 byte to pad them out to 32bpp. +For X displays, a kludge is done that is equivalent to +"\fB-noshm\fR \fI\fB-visual\fR TrueColor:32\fR". (If better performance +is needed for the latter, feel free to ask). +.PP \fB-scale\fR \fIfraction\fR .IP Scale the framebuffer by factor \fIfraction\fR. Values @@ -2579,16 +2594,21 @@ or where window tearing is a problem. \fB-rawfb\fR \fIstring\fR .IP Experimental option, instead of polling X, poll the -memory object specified in \fIstring\fR. For shared -memory segments it is of the form: "shm:N@WxHxB" -which specifies a shmid N and framebuffer Width, Height, -and Bits per pixel. To memory map +memory object specified in \fIstring\fR. +.IP +For shared memory segments string is of the +form: "shm:N@WxHxB" which specifies a shmid +N and framebuffer Width, Height, and Bits +per pixel. To memory map .IR mmap (2) a file use: "map:/path/to/a/file@WxHxB". If there is trouble with mmap, use "file:/..." for slower .IR lseek (2) -based reading. If you do not supply a type "map" +based +reading. Use "snap:..." to imply \fB-snapfb\fR mode and the +"file:" access (this is for devices that only provide +the fb all at once). If you do not supply a type "map" is assumed if the file exists. .IP If string is "setup:cmd", then the command "cmd" @@ -2597,6 +2617,14 @@ as \fIstring\fR. This allows initializing the device, determining WxHxB, etc. These are often done as root so take care. .IP +If the string begins with "video", see the video4linux +discusion below where the device may be queried for +(and possibly set) the framebuffer parameters. +.IP +If the strings begins with "cons", see the linux +console discussion below where the framebuffer device +is opened and keystrokes are inserted into the console. +.IP Optional suffixes are ":R/G/B" and "+O" to specify red, green, and blue masks and an offset into the memory object. If the masks are not provided x11vnc @@ -2612,6 +2640,12 @@ Examples: .IP \fB-rawfb\fR file:/tmp/my.pnm@250x200x24+37 .IP +\fB-rawfb\fR file:/dev/urandom@128x128x8 +\fB-rawfb\fR snap:/dev/video0@320x240x24 \fB-24to32\fR +\fB-rawfb\fR video0 +\fB-rawfb\fR video \fB-pipeinput\fR VID +\fB-rawfb\fR console +.IP (see .IR ipcs (1) and @@ -2622,16 +2656,163 @@ All user input is discarded by default (but see the \fB-pipeinput\fR option). Most of the X11 (screen, keyboard, mouse) options do not make sense and many will cause this mode to crash, so please think twice before -setting/changing them. +setting or changing them in a running x11vnc. +.IP +If you DO NOT want x11vnc to close the X DISPLAY in +rawfb mode, prepend a "+" e.g. +file:/dev/fb0... +Keeping the display open enables the default +remote-control channel, which could be useful. +Alternatively, if you specify \fB-noviewonly,\fR then the +mouse and keyboard input are STILL sent to the X +display, this usage should be very rare, i.e. doing +something strange with /dev/fb0. +.IP +If the device is not "seekable" try reading it all +at once in full snaps via the "snap:" mode (note: +this is a resource hog). If you are using file: or +map: and the device needs to be reopened for *every* +snapfb snapshot, set the environment variable: +SNAPFB_RAWFB_RESET=1 as well. +.IP +If you want x11vnc to dynamically transform a 24bpp +rawfb to 32bpp (note that this will be slower) use +the \fB-24to32\fR option. This would be useful for, say, +for a video camera that delivers the pixel data as +24bpp packed RGB. This is the default under "video" +mode if the bpp is 24. +.IP +video4linux: on Linux some attempt is made to handle +video devices (webcams or tv tuners) automatically. +The idea is the WxHxB will be extracted from the +device itself. So if you do not supply "@WxHxB... +parameters x11vnc will try to determine them. It first +tries the v4l API if that support has been compiled in. +Otherwise it will run the v4l- +.IR info (1) +external program +if it is available. +.IP +The simplest examples are "\fB-rawfb\fR \fIvideo\fR" and "-rawfb +video1" which imply the device file /dev/video and +/dev/video1, respectively. You can also supply the +/dev if you like, e.g. "\fB-rawfb\fR \fI/dev/video0\fR" +.IP +Since the video capture device framebuffer usually +changes continuously (e.g. brightness fluctuations), +you may want to use the \fB-wait,\fR \fB-slow_fb,\fR or \fB-defer\fR +options to lower the "framerate" to cut down on +network VNC traffic. +.IP +A more sophisticated video device scheme allows +initializing the device's settings using: +.IP +\fB-rawfb\fR video:<settings> +.IP +The prefix could also be, as above, e.g. "video1:" to +specify the device file. The v4l API must be available +for this to work. Otherwise, you will need to try +to initialize the device with an external program, +e.g. xawtv, spcaview, and hope they persist when x11vnc +re-opens the device. +.IP +<settings> is a comma separated list of key=value pairs. +The device's brightness, color, contrast, and hue can +be set to percentages, e.g. br=80,co=50,cn=44,hu=60. +.IP +The device filename can be set too if needed (if it +does not start with "video"), e.g. fn=/dev/qcam. +.IP +The width, height and bpp of the framebuffer can be +set via, e.g., w=160,h=120,bpp=16. +.IP +Related to the bpp above, the pixel format can be set +via the fmt=XXX, where XXX can be one of: GREY, HI240, +RGB555, RGB565, RGB24, and RGB32 (with bpp 8, 8, 16, 16, +24, and 32 respectively). See http://www.linuxtv.org +for more info (V4L api). +.IP +For tv/rf tuner cards one can set the tuning mode +via tun=XXX where XXX can be one of PAL, NTSC, SECAM, +or AUTO. +.IP +One can switch the input channel by the inp=XXX setting, +where XXX is the name of the input channel (Television, +Composite1, S-Video, etc). Use the name that is in the +information about the device that is printed at startup. +.IP +For input channels with tuners (e.g. Television) one +can change which station is selected by the sta=XXX +setting. XXX is the station number. Currently only +the ntsc-cable-us (US cable) channels are built into +x11vnc. See the \fB-freqtab\fR option below to supply one +from xawtv. If XXX is greater than 500, then it is +interpreted as a raw frequency in KHz. +.IP +Example: +.IP +\fB-rawfb\fR video:br=80,w=320,h=240,fmt=RGB32,tun=NTSC,sta=47 +.IP +one might need to add inp=Television too for the input +channel to be TV if the card doesn't come up by default +in that one. +.IP +Note that not all video capture devices will support +all of the above settings. +.IP +See the \fB-pipeinput\fR VID option below for a way to control +the settings through the VNC Viewer via keystrokes. +.IP +As above, if you specify a "@WxHxB..." after the +<settings> string they are used verbatim: the device +is not queried for the current values. Otherwise the +device will be queried. +.IP +Linux console: If the libvncserver LinuxVNC command is +on your system use that instead of the following method +because it will be faster and more accurate for Linux +text console. +.IP +If the rawfb string begins with "cons" the framebuffer +device /dev/fb0 is opened (this requires the appropriate +kernel modules) and so is /dev/tty0. The latter is +used to inject keystrokes (not all are supported, +but the basic ones are). You will need to be root to +inject keystrokes. /dev/tty0 refers to the active VT, +to indicate one explicitly, use "cons2", etc. using +the VT number. Note you can change VT remotely using +the +.IR chvt (1) +command. Sometimes switching out and back +corrects the framebuffer. To skip injecting entirely +use "consx". +.IP +The strings "console", or "/dev/fb0" can be used +instead of "cons". The latter can be used to specify +a different framebuffer device, e.g. /dev/fb1. If the +name is something nonstandard, use "cons:/dev/foofb" +.IP +If you do not want x11vnc to guess the framebuffer's +WxHxB and masks automatically, specify them with a +@WxHxB at the end of the string. .IP -If you don't want x11vnc to close the X DISPLAY in -rawfb mode, then capitalize the prefix, SHM:, MAP:, -FILE: Keeping the display open enables the default -remote-control channel, which could be useful. Also, -if you also specify \fB-noviewonly,\fR then the mouse and -keyboard input are STILL sent to the X display, this -usage should be very rare, i.e. doing something strange -with /dev/fb0. +Examples: +\fB-rawfb\fR cons (same as \fB-rawfb\fR console) +\fB-rawfb\fR /dev/fb0 (same) +\fB-rawfb\fR cons3 (force /dev/tty3) +\fB-rawfb\fR consx (no keystrokes) +\fB-rawfb\fR console:/dev/nonstd +.PP +\fB-freqtab\fR \fIfile\fR +.IP +For use with "\fB-rawfb\fR \fIvideo\fR" for TV tuner devices to +specify station frequencies. Instead of using the built +in ntsc-cable-us mapping of station number to frequency, +use the data in file. For stations that are not +numeric, e.g. SE20, they are placed above the highest +numbered station in the order they are found. Example: +"\fB-freqtab\fR \fI/usr/X11R6/share/xawtv/europe-west.list\fR" +You can make your own freqtab by copying the xawtv +format. .PP \fB-pipeinput\fR \fIcmd\fR .IP @@ -2651,6 +2832,22 @@ do amusing things (e.g. control non-X devices). To facilitate this, if \fB-rawfb\fR is in effect then the value is stored in X11VNC_RAWFB_STR for the pipe command to use if it wants. Do 'env | grep X11VNC' for more. +.IP +If cmd is "VID" and you are using the \fB-rawfb\fR for a +video capture device, then an internal list of keyboard +mappings is used to set parameters of the video. +The mappings are: +.IP +"B" and "b" adjust the brightness up and down. +"H" and "h" adjust the hue. +"C" and "c" adjust the colour. +"N" and "n" adjust the contrast. +"S" and "s" adjust the size of the capture screen. +"I" and "i" cycle through input channels. +Up and Down arrows adjust the station (if a tuner) +F1, F2, ..., F6 will switch the video capture pixel +format to HI240, RGB565, RGB24, RGB32, RGB555, and +GREY respectively. See \fB-rawfb\fR video for details. .PP \fB-gui\fR \fI[gui-opts]\fR .IP @@ -2829,6 +3026,10 @@ no8to24 disable \fB-8to24\fR mode. .IP 8to24_opts:str set the \fB-8to24\fR opts to "str". .IP +24to32 enable \fB-24to32\fR mode (if applicable). +.IP +no24to32 disable \fB-24to32\fR mode. +.IP visual:vis set \fB-visual\fR to "vis" .IP scale:frac set \fB-scale\fR to "frac" @@ -3294,15 +3495,15 @@ nowaitmapped clip flashcmap noflashcmap shiftcmap truecolor notruecolor overlay nooverlay overlay_cursor overlay_yescursor nooverlay_nocursor nooverlay_cursor nooverlay_yescursor overlay_nocursor 8to24 no8to24 -8to24_opts visual scale scale_cursor viewonly noviewonly -shared noshared forever noforever once timeout filexfer -nofilexfer deny lock nodeny unlock connect allowonce -allow localhost nolocalhost listen lookup nolookup -accept afteraccept gone shm noshm flipbyteorder -noflipbyteorder onetile noonetile solid_color -solid nosolid blackout xinerama noxinerama xtrap -noxtrap xrandr noxrandr xrandr_mode padgeom quiet q -noquiet modtweak nomodtweak xkb noxkb skip_keycodes +8to24_opts 24to32 no24to32 visual scale scale_cursor +viewonly noviewonly shared noshared forever noforever +once timeout filexfer nofilexfer deny lock nodeny +unlock connect allowonce allow localhost nolocalhost +listen lookup nolookup accept afteraccept gone shm +noshm flipbyteorder noflipbyteorder onetile noonetile +solid_color solid nosolid blackout xinerama noxinerama +xtrap noxtrap xrandr noxrandr xrandr_mode padgeom quiet +q noquiet modtweak nomodtweak xkb noxkb skip_keycodes sloppy_keys nosloppy_keys skip_dups noskip_dups add_keysyms noadd_keysyms clear_mods noclear_mods clear_keys noclear_keys remap repeat norepeat fb nofb diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 6e435eb..d9c0341 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -524,7 +524,7 @@ if (debug_scroll) fprintf(stderr, "watch_loop: LOOP-BACK: %d\n", ret); * screen, but do flush the X11 display. */ X_LOCK; - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; dt = 0.0; } else { @@ -540,7 +540,7 @@ if (debug_scroll) fprintf(stderr, "watch_loop: LOOP-BACK: %d\n", ret); } dtime0(&tm); if (use_snapfb) { - int t, tries = 5; + int t, tries = 3; copy_snap(); for (t =0; t < tries; t++) { tile_diffs = scan_for_updates(0); @@ -599,7 +599,7 @@ static char *choose_title(char *display) { strncat(title, display, MAXN - strlen(title)); if (subwin && valid_window(subwin, NULL, 0)) { char *name; - if (XFetchName(dpy, subwin, &name)) { + if (dpy && XFetchName(dpy, subwin, &name)) { strncat(title, " ", MAXN - strlen(title)); strncat(title, name, MAXN - strlen(title)); } @@ -1030,6 +1030,7 @@ static void print_settings(int try_http, int bg, char *gui_str) { fprintf(stderr, " cmap8to24: %d\n", cmap8to24); fprintf(stderr, " 8to24_opts: %s\n", cmap8to24_str ? cmap8to24_str : "null"); + fprintf(stderr, " 24to32: %d\n", xform24to32); fprintf(stderr, " visual: %s\n", visual_str ? visual_str : "null"); fprintf(stderr, " overlay: %d\n", overlay); @@ -1521,6 +1522,8 @@ int main(int argc, char* argv[]) { } } #endif + } else if (!strcmp(arg, "-24to32")) { + xform24to32 = 1; } else if (!strcmp(arg, "-visual")) { CHECK_ARGC visual_str = strdup(argv[++i]); @@ -2111,6 +2114,9 @@ int main(int argc, char* argv[]) { } else if (!strcmp(arg, "-rawfb")) { CHECK_ARGC raw_fb_str = strdup(argv[++i]); + } else if (!strcmp(arg, "-freqtab")) { + CHECK_ARGC + freqtab = strdup(argv[++i]); } else if (!strcmp(arg, "-pipeinput")) { CHECK_ARGC pipeinput_str = strdup(argv[++i]); @@ -2782,7 +2788,7 @@ int main(int argc, char* argv[]) { if (remote_cmd || query_cmd) { int rc = do_remote_query(remote_cmd, query_cmd, remote_sync, query_default); - XFlush(dpy); + XFlush_wr(dpy); fflush(stderr); fflush(stdout); usleep(30 * 1000); /* still needed? */ diff --git a/x11vnc/x11vnc.h b/x11vnc/x11vnc.h index f47cb89..e017857 100644 --- a/x11vnc/x11vnc.h +++ b/x11vnc/x11vnc.h @@ -310,6 +310,9 @@ extern int xfixes_base_event_type; #endif extern int xdamage_base_event_type; +#define RAWFB_RET(y) if (raw_fb && ! dpy) return y; +#define RAWFB_RET_VOID if (raw_fb && ! dpy) return; + extern char lastmod[]; /* X display info */ diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c index 2448689..272e017 100644 --- a/x11vnc/x11vnc_defs.c +++ b/x11vnc/x11vnc_defs.c @@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; int xdamage_base_event_type = 0; /* date +'lastmod: %Y-%m-%d' */ -char lastmod[] = "0.8.1 lastmod: 2006-04-25"; +char lastmod[] = "0.8.1 lastmod: 2006-05-06"; /* X display info */ diff --git a/x11vnc/xdamage.c b/x11vnc/xdamage.c index 0c3e5d5..4c9319a 100644 --- a/x11vnc/xdamage.c +++ b/x11vnc/xdamage.c @@ -169,6 +169,8 @@ void clear_xdamage_mark_region(sraRegionPtr markregion, int flush) { sraRegionPtr tmpregion; int count = 0; + RAWFB_RET_VOID + if (! xdamage_present || ! use_xdamage) { return; } @@ -182,7 +184,7 @@ void clear_xdamage_mark_region(sraRegionPtr markregion, int flush) { X_LOCK; if (flush) { - XFlush(dpy); + XFlush_wr(dpy); } while (XCheckTypedEvent(dpy, xdamage_base_event_type+XDamageNotify, &ev)) { count++; @@ -225,6 +227,8 @@ int collect_xdamage(int scancnt, int call) { int dup_x[DUPSZ], dup_y[DUPSZ], dup_w[DUPSZ], dup_h[DUPSZ]; double tm, dt; + RAWFB_RET(0) + if (scancnt) {} /* unused vars warning: */ if (! xdamage_present || ! use_xdamage) { @@ -252,7 +256,7 @@ int collect_xdamage(int scancnt, int call) { X_LOCK; -if (0) XFlush(dpy); +if (0) XFlush_wr(dpy); if (0) XEventsQueued(dpy, QueuedAfterFlush); while (XCheckTypedEvent(dpy, xdamage_base_event_type+XDamageNotify, &ev)) { /* @@ -472,7 +476,7 @@ void initialize_xdamage(void) { void create_xdamage_if_needed(void) { - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID #if LIBVNCSERVER_HAVE_LIBXDAMAGE if (! xdamage) { @@ -487,14 +491,14 @@ void create_xdamage_if_needed(void) { void destroy_xdamage_if_needed(void) { - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID #if LIBVNCSERVER_HAVE_LIBXDAMAGE if (xdamage) { XEvent ev; X_LOCK; XDamageDestroy(dpy, xdamage); - XFlush(dpy); + XFlush_wr(dpy); if (xdamage_base_event_type) { while (XCheckTypedEvent(dpy, xdamage_base_event_type+XDamageNotify, &ev)) { diff --git a/x11vnc/xevents.c b/x11vnc/xevents.c index 173db1c..951253b 100644 --- a/x11vnc/xevents.c +++ b/x11vnc/xevents.c @@ -38,15 +38,18 @@ static void grab_buster_watch(int parent, char *dstr); void initialize_vnc_connect_prop(void) { vnc_connect_str[0] = '\0'; + RAWFB_RET_VOID vnc_connect_prop = XInternAtom(dpy, "VNC_CONNECT", False); } void initialize_x11vnc_remote_prop(void) { x11vnc_remote_str[0] = '\0'; + RAWFB_RET_VOID x11vnc_remote_prop = XInternAtom(dpy, "X11VNC_REMOTE", False); } void initialize_clipboard_atom(void) { + RAWFB_RET_VOID clipboard_atom = XInternAtom(dpy, "CLIPBOARD", False); if (clipboard_atom == None) { if (! quiet) rfbLog("could not find atom CLIPBOARD\n"); @@ -69,6 +72,7 @@ static void initialize_xevents(void) { static int did_xdamage = 0; static int did_xrandr = 0; + RAWFB_RET_VOID if ((watch_selection || vnc_connect) && !did_xselect_input) { /* * register desired event(s) for notification. @@ -143,6 +147,7 @@ static void get_prop(char *str, int len, Atom prop) { if (prop == None) { return; } + RAWFB_RET_VOID slen = 0; @@ -224,7 +229,7 @@ static void bust_grab(int reset) { fprintf(stderr, "**bust_grab: button%d %.4f\n", button, dnowx()); XTestFakeButtonEvent_wr(dpy, button, True, CurrentTime); - XFlush(dpy); + XFlush_wr(dpy); usleep(50 * 1000); XTestFakeButtonEvent_wr(dpy, button, False, CurrentTime); } else if (x > 0) { @@ -234,14 +239,14 @@ static void bust_grab(int reset) { fprintf(stderr, "**bust_grab: x=%d y=%d %.4f\n", x, y, dnowx()); XTestFakeMotionEvent_wr(dpy, scr, x, y, CurrentTime); - XFlush(dpy); + XFlush_wr(dpy); usleep(50 * 1000); /* followed by button press */ button = 1; fprintf(stderr, "**bust_grab: button%d\n", button); XTestFakeButtonEvent_wr(dpy, button, True, CurrentTime); - XFlush(dpy); + XFlush_wr(dpy); usleep(50 * 1000); XTestFakeButtonEvent_wr(dpy, button, False, CurrentTime); } else { @@ -249,11 +254,11 @@ static void bust_grab(int reset) { fprintf(stderr, "**bust_grab: keycode: %d %.4f\n", (int) key, dnowx()); XTestFakeKeyEvent_wr(dpy, key, True, CurrentTime); - XFlush(dpy); + XFlush_wr(dpy); usleep(50 * 1000); XTestFakeKeyEvent_wr(dpy, key, False, CurrentTime); } - XFlush(dpy); + XFlush_wr(dpy); last_bust = time(0); } @@ -429,6 +434,8 @@ static void grab_buster_watch(int parent, char *dstr) { int ev, er, maj, min; int db = 0; + RAWFB_RET_VOID + if (grab_buster > 1) { db = 1; } @@ -496,6 +503,8 @@ void spawn_grab_buster(void) { int parent = (int) getpid(); char *dstr = strdup(DisplayString(dpy)); + RAWFB_RET_VOID + XCloseDisplay(dpy); dpy = NULL; @@ -534,6 +543,8 @@ void sync_tod_with_servertime(void) { static unsigned long xserver_ticks = 1; int i, db = 0; + RAWFB_RET_VOID + if (! ticker_atom) { ticker_atom = XInternAtom(dpy, "X11VNC_TICKER", False); } @@ -586,7 +597,7 @@ void check_keycode_state(void) { return; } - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (unixpw_in_progress) return; @@ -689,7 +700,7 @@ void check_xevents(void) { time_t now = time(0); static double last_request = 0.0; - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (unixpw_in_progress) return; @@ -1043,7 +1054,7 @@ void check_xevents(void) { void xcut_receive(char *text, int len, rfbClientPtr cl) { allowed_input_t input; - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (unixpw_in_progress) return; @@ -1072,7 +1083,7 @@ void xcut_receive(char *text, int len, rfbClientPtr cl) { own_primary = 1; /* we need to grab the PRIMARY selection */ XSetSelectionOwner(dpy, XA_PRIMARY, selwin, CurrentTime); - XFlush(dpy); + XFlush_wr(dpy); if (debug_sel) { rfbLog("Own PRIMARY.\n"); } @@ -1082,7 +1093,7 @@ void xcut_receive(char *text, int len, rfbClientPtr cl) { own_clipboard = 1; /* we need to grab the CLIPBOARD selection */ XSetSelectionOwner(dpy, clipboard_atom, selwin, CurrentTime); - XFlush(dpy); + XFlush_wr(dpy); if (debug_sel) { rfbLog("Own CLIPBOARD.\n"); } @@ -1117,7 +1128,7 @@ void xcut_receive(char *text, int len, rfbClientPtr cl) { /* copy this text to CUT_BUFFER0 as well: */ XChangeProperty(dpy, rootwin, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, (unsigned char *) text, len); - XFlush(dpy); + XFlush_wr(dpy); X_UNLOCK; diff --git a/x11vnc/xinerama.c b/x11vnc/xinerama.c index 229816f..ddc2da7 100644 --- a/x11vnc/xinerama.c +++ b/x11vnc/xinerama.c @@ -240,7 +240,7 @@ static void initialize_xinerama (void) { char *bstr, *tstr; int ev, er, i, n, rcnt; - if (raw_fb && ! dpy) return; /* raw_fb hack */ + RAWFB_RET_VOID if (! XineramaQueryExtension(dpy, &ev, &er)) { rfbLog("Xinerama: disabling: display does not support it.\n"); diff --git a/x11vnc/xkb_bell.c b/x11vnc/xkb_bell.c index 2476390..1c01f7e 100644 --- a/x11vnc/xkb_bell.c +++ b/x11vnc/xkb_bell.c @@ -23,6 +23,8 @@ void initialize_xkb(void) { int ir, reason; int op, ev, er, maj, min; + RAWFB_RET_VOID + if (xkbcompat) { xkb_present = 0; } else if (! XkbQueryExtension(dpy, &op, &ev, &er, &maj, &min)) { @@ -60,6 +62,8 @@ void initialize_watch_bell(void) { return; } + RAWFB_RET_VOID + XkbSelectEvents(dpy, XkbUseCoreKbd, XkbBellNotifyMask, 0); if (! watch_bell) { @@ -88,6 +92,7 @@ void check_bell_event(void) { if (! xkb_base_event_type) { return; } + RAWFB_RET_VOID /* caller does X_LOCK */ if (! XCheckTypedEvent(dpy, xkb_base_event_type, &xev)) { diff --git a/x11vnc/xrandr.c b/x11vnc/xrandr.c index 61cd24e..0420718 100644 --- a/x11vnc/xrandr.c +++ b/x11vnc/xrandr.c @@ -28,7 +28,7 @@ static void handle_xrandr_change(int new_x, int new_y); void initialize_xrandr(void) { - if (xrandr_present) { + if (xrandr_present && dpy) { #if LIBVNCSERVER_HAVE_LIBXRANDR Rotation rot; @@ -110,6 +110,8 @@ static void handle_xrandr_change(int new_x, int new_y) { rfbClientIteratorPtr iter; rfbClientPtr cl; + RAWFB_RET_VOID + /* sanity check xrandr_mode */ if (! xrandr_mode) { xrandr_mode = strdup("default"); @@ -148,6 +150,9 @@ static void handle_xrandr_change(int new_x, int new_y) { int check_xrandr_event(char *msg) { XEvent xev; + + RAWFB_RET(0) + if (subwin) { return handle_subwin_resize(msg); } diff --git a/x11vnc/xrecord.c b/x11vnc/xrecord.c index b388c3a..ed087b5 100644 --- a/x11vnc/xrecord.c +++ b/x11vnc/xrecord.c @@ -101,7 +101,7 @@ static void xrecord_grabserver(int start) { } XRecordDisableContext(gdpy_ctrl, rc_grab); XRecordFreeContext(gdpy_ctrl, rc_grab); - XFlush(gdpy_ctrl); + XFlush_wr(gdpy_ctrl); rc_grab = 0; return; } @@ -135,7 +135,7 @@ static void xrecord_grabserver(int start) { return; } XSetErrorHandler(old_handler); - XFlush(gdpy_data); + XFlush_wr(gdpy_data); #endif if (debug_grabs) { fprintf(stderr, "xrecord_grabserver-done: %.5f\n", dnowx()); @@ -153,6 +153,7 @@ void initialize_xrecord(void) { if (noxrecord) { return; } + RAWFB_RET_VOID #if LIBVNCSERVER_HAVE_RECORD if (rr_CA) XFree(rr_CA); @@ -1307,7 +1308,7 @@ static void check_xrecord_grabserver(void) { if (unixpw_in_progress) return; dtime0(&d); - XFlush(gdpy_ctrl); + XFlush_wr(gdpy_ctrl); for (i=0; i<max; i++) { last_val = xserver_grabbed; XRecordProcessReplies(gdpy_data); @@ -1318,7 +1319,7 @@ static void check_xrecord_grabserver(void) { } } if (cnt) { - XFlush(gdpy_ctrl); + XFlush_wr(gdpy_ctrl); } if (debug_grabs && cnt > 0) { d = dtime(&d); @@ -1332,6 +1333,7 @@ static void shutdown_record_context(XRecordContext rc, int bequiet, int reopen) int ret1, ret2; int verb = (!bequiet && !quiet); + RAWFB_RET_VOID if (0 || debug_scroll) { rfbLog("shutdown_record_context(0x%lx, %d, %d)\n", rc, bequiet, reopen); @@ -1346,7 +1348,7 @@ static void shutdown_record_context(XRecordContext rc, int bequiet, int reopen) if (!ret2 && verb) { rfbLog("XRecordFreeContext(0x%lx) failed.\n", rc); } - XFlush(rdpy_ctrl); + XFlush_wr(rdpy_ctrl); if (reopen == 2 && ret1 && ret2) { reopen = 0; /* 2 means reopen only on failure */ @@ -1607,7 +1609,7 @@ if (db > 1) fprintf(stderr, "=== disab-scroll 0x%lx 0x%lx\n", rc_scroll, rcs_scr XRecordUnregisterClients(rdpy_ctrl, rc_scroll, &rcs_scroll, 1); XRecordDisableContext(rdpy_ctrl, rc_scroll); - XFlush(rdpy_ctrl); + XFlush_wr(rdpy_ctrl); XRecordProcessReplies(rdpy_data); if (trapped_record_xerror) { @@ -1633,7 +1635,7 @@ if (db > 1) fprintf(stderr, "=== disab-scroll 0x%lx 0x%lx\n", rc_scroll, rcs_scr SCR_UNLOCK; /* - * XXX if we do a XFlush(rdpy_ctrl) here we get: + * XXX if we do a XFlush_wr(rdpy_ctrl) here we get: * X Error of failed request: XRecordBadContext @@ -1830,7 +1832,7 @@ if (db > 1) fprintf(stderr, "=-= reg-scroll 0x%lx 0x%lx\n", rc_scroll, rcs_scr } } - XFlush(rdpy_ctrl); + XFlush_wr(rdpy_ctrl); if (db) fprintf(stderr, "rc_scroll: 0x%lx\n", rc_scroll); if (trapped_record_xerror) { @@ -1896,7 +1898,7 @@ if (db) fprintf(stderr, "rc_scroll: 0x%lx\n", rc_scroll); /* XXX this may cause more problems than it solves... */ if (use_xrecord) { - XFlush(rdpy_data); + XFlush_wr(rdpy_data); } X_UNLOCK; diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c index 40fd8fa..181c4f1 100644 --- a/x11vnc/xwrappers.c +++ b/x11vnc/xwrappers.c @@ -18,6 +18,8 @@ int clipshift = 0; int guess_bits_per_color(int bits_per_pixel); +int XFlush_wr(Display *disp); + Status XShmGetImage_wr(Display *disp, Drawable d, XImage *image, int x, int y, unsigned long mask); XImage *XShmCreateImage_wr(Display* disp, Visual* vis, unsigned int depth, @@ -66,11 +68,9 @@ void disable_grabserver(Display *in_dpy, int change); Bool XRecordQueryVersion_wr(Display *dpy, int *maj, int *min); - -static void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h); +void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h); static void upup_downdown_warning(KeyCode key, Bool down); - /* * used in rfbGetScreen and rfbNewFramebuffer: and estimate to the number * of bits per color, of course for some visuals, e.g. 565, the number @@ -96,6 +96,14 @@ int guess_bits_per_color(int bits_per_pixel) { return bits_per_color; } +int XFlush_wr(Display *disp) { + if (disp) { + return XFlush(disp); + } else { + return 1; + } +} + /* * Kludge to interpose image gets and limit to a subset rectangle of * the rootwin. This is the -sid option trying to work around invisible @@ -277,17 +285,161 @@ XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth, width, height, bitmap_pad, bytes_per_line); } -static void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h) { +static void copy_raw_fb_24_to_32(XImage *dest, int x, int y, unsigned int w, + unsigned int h) { + /* + * kludge to read 1 byte at a time and dynamically transform + * 24bpp -> 32bpp by inserting a extra 0 byte into dst. + */ + char *src, *dst; + unsigned int line; + static char *buf = NULL; + static int buflen = -1; + int bpl = wdpy_x * 3; /* pixelsize == 3 */ + int LE, n, stp, len, del, sz = w * 3; + int insert_zeroes = 1; + +#define INSERT_ZEROES \ + len = sz; \ + del = 0; \ + stp = 0; \ + while (len > 0) { \ + if (insert_zeroes && (del - LE) % 4 == 0) { \ + *(dst + del) = 0; \ + del++; \ + } \ + *(dst + del) = *(buf + stp); \ + del++; \ + len--; \ + stp++; \ + } + + if (rfbEndianTest) { + LE = 3; /* little endian */ + } else { + LE = 0; /* big endian */ + } + + if (sz > buflen || buf == NULL) { + if (buf) { + free(buf); + } + buf = (char *) malloc(4*(sz + 1000)); + } + + if (clipshift && ! use_snapfb) { + x += coff_x; + y += coff_y; + } + + if (use_snapfb && dest != snap) { + /* snapfb src */ + src = snap->data + snap->bytes_per_line*y + 3*x; + dst = dest->data; + for (line = 0; line < h; line++) { + memcpy(buf, src, sz); + + INSERT_ZEROES + + src += snap->bytes_per_line; + dst += dest->bytes_per_line; + } + + } else if (! raw_fb_seek) { + /* mmap */ + src = raw_fb_addr + raw_fb_offset + bpl*y + 3*x; + dst = dest->data; + + if (use_snapfb && dest == snap) { + /* + * writing *to* snap_fb: need the x,y offset, + * and also do not do inserts. + */ + dst += bpl*y + 3*x; + insert_zeroes = 0; + } + + for (line = 0; line < h; line++) { + memcpy(buf, src, sz); + + INSERT_ZEROES + + src += bpl; + dst += dest->bytes_per_line; + } + + } else { + /* lseek */ + off_t off = (off_t) (raw_fb_offset + bpl*y + 3*x); + + lseek(raw_fb_fd, off, SEEK_SET); + dst = dest->data; + + if (use_snapfb && dest == snap) { + /* + * writing *to* snap_fb: need the x,y offset, + * and also do not do inserts. + */ + dst += bpl*y + 3*x; + insert_zeroes = 0; + } + + for (line = 0; line < h; line++) { + len = sz; + del = 0; + while (len > 0) { + n = read(raw_fb_fd, buf + del, len); + + if (n > 0) { + del += n; + len -= n; + } else if (n == 0) { + break; + } else if (errno != EINTR && errno != EAGAIN) { + break; + } + } + + INSERT_ZEROES + + if (bpl > sz) { + off = (off_t) (bpl - sz); + lseek(raw_fb_fd, off, SEEK_CUR); + } + dst += dest->bytes_per_line; + } + } +} + +void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h) { char *src, *dst; unsigned int line; int pixelsize = bpp/8; int bpl = wdpy_x * pixelsize; - if (clipshift) { + if (xform24to32) { + copy_raw_fb_24_to_32(dest, x, y, w, h); + return; + } + + if (clipshift && ! use_snapfb) { x += coff_x; y += coff_y; } - if (! raw_fb_seek) { + + if (use_snapfb && dest != snap) { + /* snapfb src */ + src = snap->data + snap->bytes_per_line*y + pixelsize*x; + dst = dest->data; + + for (line = 0; line < h; line++) { + memcpy(dst, src, w * pixelsize); + src += snap->bytes_per_line; + dst += dest->bytes_per_line; + } + + } else if (! raw_fb_seek) { + /* mmap */ src = raw_fb_addr + raw_fb_offset + bpl*y + pixelsize*x; dst = dest->data; @@ -296,32 +448,35 @@ static void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int src += bpl; dst += dest->bytes_per_line; } - } else{ + + } else { + /* lseek */ int n, len, del, sz = w * pixelsize; off_t off = (off_t) (raw_fb_offset + bpl*y + pixelsize*x); lseek(raw_fb_fd, off, SEEK_SET); dst = dest->data; +if (0) fprintf(stderr, "lseek 0 ps: %d sz: %d off: %d bpl: %d\n", pixelsize, sz, (int) off, bpl); + for (line = 0; line < h; line++) { len = sz; del = 0; while (len > 0) { n = read(raw_fb_fd, dst + del, len); +if (0) fprintf(stderr, "len: %d n: %d\n", len, n); if (n > 0) { del += n; len -= n; } else if (n == 0) { break; - } else { - /* overkill... */ - if (errno != EINTR && errno != EAGAIN) { - break; - } + } else if (errno != EINTR && errno != EAGAIN) { + break; } } if (bpl > sz) { +if (0) fprintf(stderr, "bpl>sz %d %d\n", bpl, sz); off = (off_t) (bpl - sz); lseek(raw_fb_fd, off, SEEK_CUR); } @@ -332,6 +487,9 @@ static void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int void copy_image(XImage *dest, int x, int y, unsigned int w, unsigned int h) { /* default (w=0, h=0) is the fill the entire XImage */ + if (dest == NULL) { + return; + } if (w < 1) { w = dest->width; } @@ -339,7 +497,10 @@ void copy_image(XImage *dest, int x, int y, unsigned int w, unsigned int h) { h = dest->height; } - if (use_snapfb && snap_fb && dest != snaprect) { + if (raw_fb) { + copy_raw_fb(dest, x, y, w, h); + + } else if (use_snapfb && snap_fb && dest != snaprect) { char *src, *dst; unsigned int line; int pixelsize = bpp/8; @@ -352,10 +513,7 @@ void copy_image(XImage *dest, int x, int y, unsigned int w, unsigned int h) { dst += dest->bytes_per_line; } - } else if (raw_fb) { - copy_raw_fb(dest, x, y, w, h); - - } else if (using_shm && (int) w == dest->width && + } else if ((using_shm && ! xform24to32) && (int) w == dest->width && (int) h == dest->height) { XShmGetImage_wr(dpy, window, dest, x, y, AllPlanes); @@ -379,6 +537,8 @@ void init_track_keycode_state(void) { } static void upup_downdown_warning(KeyCode key, Bool down) { + RAWFB_RET_VOID + if ((down ? 1:0) == keycode_state[(int) key]) { rfbLog("XTestFakeKeyEvent: keycode=0x%x \"%s\" is *already* " "%s\n", key, XKeysymToString(XKeycodeToKeysym(dpy, key, 0)), @@ -394,12 +554,14 @@ static void upup_downdown_warning(KeyCode key, Bool down) { void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down, unsigned long delay) { + RAWFB_RET_VOID + if (! xtrap_present) { DEBUG_SKIPPED_INPUT(debug_keyboard, "keyboard: no-XTRAP"); return; } /* unused vars warning: */ - if (dpy || key || down || delay) {} + if (key || down || delay) {} #if LIBVNCSERVER_HAVE_LIBXTRAP XESimulateXEventRequest(trap_ctx, down ? KeyPress : KeyRelease, @@ -416,6 +578,9 @@ void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down, void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down, unsigned long delay) { static int first = 1; + + RAWFB_RET_VOID + if (debug_keyboard) { rfbLog("XTestFakeKeyEvent(dpy, keycode=0x%x \"%s\", %s)\n", key, XKeysymToString(XKeycodeToKeysym(dpy, key, 0)), @@ -456,12 +621,14 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down, void XTRAP_FakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press, unsigned long delay) { + RAWFB_RET_VOID + if (! xtrap_present) { DEBUG_SKIPPED_INPUT(debug_keyboard, "button: no-XTRAP"); return; } /* unused vars warning: */ - if (dpy || button || is_press || delay) {} + if (button || is_press || delay) {} #if LIBVNCSERVER_HAVE_LIBXTRAP XESimulateXEventRequest(trap_ctx, @@ -474,6 +641,8 @@ void XTRAP_FakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press, void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press, unsigned long delay) { + RAWFB_RET_VOID + if (xtrap_input) { XTRAP_FakeButtonEvent_wr(dpy, button, is_press, delay); return; @@ -495,6 +664,8 @@ void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press, void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y, unsigned long delay) { + RAWFB_RET_VOID + if (! xtrap_present) { DEBUG_SKIPPED_INPUT(debug_keyboard, "motion: no-XTRAP"); return; @@ -512,6 +683,8 @@ void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y, void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y, unsigned long delay) { + RAWFB_RET_VOID + if (xtrap_input) { XTRAP_FakeMotionEvent_wr(dpy, screen, x, y, delay); return; @@ -530,6 +703,8 @@ Bool XTestCompareCurrentCursorWithWindow_wr(Display* dpy, Window w) { if (! xtest_present) { return False; } + RAWFB_RET(False) + #if LIBVNCSERVER_HAVE_XTEST return XTestCompareCurrentCursorWithWindow(dpy, w); #else @@ -541,6 +716,7 @@ Bool XTestCompareCursorWithWindow_wr(Display* dpy, Window w, Cursor cursor) { if (! xtest_present) { return False; } + RAWFB_RET(False) #if LIBVNCSERVER_HAVE_XTEST return XTestCompareCursorWithWindow(dpy, w, cursor); #else @@ -550,6 +726,7 @@ Bool XTestCompareCursorWithWindow_wr(Display* dpy, Window w, Cursor cursor) { Bool XTestQueryExtension_wr(Display *dpy, int *ev, int *er, int *maj, int *min) { + RAWFB_RET(False) #if LIBVNCSERVER_HAVE_XTEST return XTestQueryExtension(dpy, ev, er, maj, min); #else @@ -561,18 +738,20 @@ void XTestDiscard_wr(Display *dpy) { if (! xtest_present) { return; } + RAWFB_RET_VOID #if LIBVNCSERVER_HAVE_XTEST XTestDiscard(dpy); #endif } Bool XETrapQueryExtension_wr(Display *dpy, int *ev, int *er, int *op) { + RAWFB_RET(False) #if LIBVNCSERVER_HAVE_LIBXTRAP return XETrapQueryExtension(dpy, (INT32 *)ev, (INT32 *)er, (INT32 *)op); #else /* unused vars warning: */ - if (dpy || ev || er || op) {} + if (ev || er || op) {} return False; #endif } @@ -581,6 +760,7 @@ int XTestGrabControl_wr(Display *dpy, Bool impervious) { if (! xtest_present) { return 0; } + RAWFB_RET(0) #if LIBVNCSERVER_HAVE_XTEST && LIBVNCSERVER_HAVE_XTESTGRABCONTROL XTestGrabControl(dpy, impervious); return 1; @@ -595,6 +775,7 @@ int XTRAP_GrabControl_wr(Display *dpy, Bool impervious) { if (dpy || impervious) {} return 0; } + RAWFB_RET(0) #if LIBVNCSERVER_HAVE_LIBXTRAP else { ReqFlags requests; @@ -685,10 +866,11 @@ void disable_grabserver(Display *in_dpy, int change) { rfbLog("* DEADLOCK if your window manager calls XGrabServer !!! *\n"); rfbLog("*********************************************************\n"); } - XFlush(in_dpy); + XFlush_wr(in_dpy); } Bool XRecordQueryVersion_wr(Display *dpy, int *maj, int *min) { + RAWFB_RET(False) #if LIBVNCSERVER_HAVE_RECORD return XRecordQueryVersion(dpy, maj, min); #else diff --git a/x11vnc/xwrappers.h b/x11vnc/xwrappers.h index 601c582..e464636 100644 --- a/x11vnc/xwrappers.h +++ b/x11vnc/xwrappers.h @@ -17,6 +17,8 @@ extern int clipshift; extern int guess_bits_per_color(int bits_per_pixel); +extern int XFlush_wr(Display *disp); + extern Status XShmGetImage_wr(Display *disp, Drawable d, XImage *image, int x, int y, unsigned long mask); extern XImage *XShmCreateImage_wr(Display* disp, Visual* vis, unsigned int depth, @@ -38,6 +40,7 @@ extern XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth int format, int offset, char *data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line); extern void copy_image(XImage *dest, int x, int y, unsigned int w, unsigned int h); +extern void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h); extern void init_track_keycode_state(void); extern void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down, |