qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] VNC patch


From: Piotr R .
Subject: [Qemu-devel] VNC patch
Date: Fri, 19 Nov 2004 19:13:28 +0100

Hello,

I am working witch qemu rfb9 patch and I found it useful to specify 
local port on wchich vnc server would listen. Here is a patch for 
that. 

Does anyone have a solution for mouse/vnc problems (calibration etc.
)??

Apply it after rfb9 patch.

diff -C4 qemu_cvs/vl.c qemu_cvs_mod/vl.c
*** qemu_cvs/vl.c       2004-11-10 16:03:59.000000000 +0100
--- qemu_cvs_mod/vl.c   2004-11-17 12:17:31.433395968 +0100
***************
*** 112,119 ****
--- 112,120 ----
  int bios_size;
  static DisplayState display_state;
  int nographic;
  int usevnc; /* 1=vnc only, 2=vnc and sdl */
+ int vnc_port;
  const char* keyboard_layout = 0;
  int64_t ticks_per_sec;
  int boot_device = 'c';
  int ram_size;
***************
*** 2504,2511 ****
--- 2505,2513 ----
             "-m megs         set virtual RAM size to megs MB 
[default=%d]\n"
             "-nographic      disable graphical output and redirect 
serial I/Os to console\n"
  #ifdef CONFIG_VNC
           "-vnc            use vnc instead of sdl\n"
+          "-vnc_port       set vnc listen port\n"
  #ifdef CONFIG_SDL
           "-vnc-and-sdl    use vnc and sdl simultaneously\n"
  #endif
  #endif
***************
*** 2600,2607 ****
--- 2602,2610 ----
      QEMU_OPTION_m,
      QEMU_OPTION_nographic,
  #ifdef CONFIG_VNC
      QEMU_OPTION_vnc,
+     QEMU_OPTION_vnc_port,
  #ifdef CONFIG_SDL
      QEMU_OPTION_vnc_and_sdl,
  #endif
  #endif
***************
*** 2663,2670 ****
--- 2666,2674 ----
      { "m", HAS_ARG, QEMU_OPTION_m },
      { "nographic", 0, QEMU_OPTION_nographic },
  #ifdef CONFIG_VNC
      { "vnc", 0, QEMU_OPTION_vnc },
+     { "vnc_port", HAS_ARG, QEMU_OPTION_vnc_port },
  #ifdef CONFIG_SDL
      { "vnc-and-sdl", 0, QEMU_OPTION_vnc_and_sdl },
  #endif
  #endif
***************
*** 2807,2814 ****
--- 2811,2819 ----
  #endif
      snapshot = 0;
      nographic = 0;
      usevnc = 0;
+     vnc_port = -1;
      kernel_filename = NULL;
      kernel_cmdline = "";
      has_cdrom = 1;
      cyls = heads = secs = 0;
***************
*** 2903,2910 ****
--- 2908,2922 ----
  #ifdef CONFIG_VNC
            case QEMU_OPTION_vnc:
                usevnc = 1;
                break;
+           case QEMU_OPTION_vnc_port:
+                 vnc_port = atoi(optarg);
+               if( vnc_port < 0 )
+               {
+                   fprintf(stderr,"qemu: invalid vnc port %s\n", optarg);
+               }
+               break;
  #ifdef CONFIG_SDL
            case QEMU_OPTION_vnc_and_sdl:
                usevnc = 2;
                break;
***************
*** 3312,3320 ****
          dumb_display_init(ds);
      } else {
        if (usevnc) {
  #ifdef CONFIG_VNC
!           vnc_display_init(ds, (usevnc==2));
  #else
            perror("qemu not configured with vnc support");
  #endif
        } else {
--- 3324,3332 ----
          dumb_display_init(ds);
      } else {
        if (usevnc) {
  #ifdef CONFIG_VNC
!           vnc_display_init(ds, (usevnc==2), vnc_port);
  #else
            perror("qemu not configured with vnc support");
  #endif
        } else {
diff -C4 qemu_cvs/vl.h qemu_cvs_mod/vl.h
*** qemu_cvs/vl.h       2004-11-10 16:04:00.000000000 +0100
--- qemu_cvs_mod/vl.h   2004-11-17 12:10:13.466976984 +0100
***************
*** 537,545 ****
  void vga_invalidate_display(void);
  void vga_screen_dump(const char *filename);
  
  /* vnc.c */
! void vnc_display_init(DisplayState *ds, int useAlsoSDL);
  
  /* cirrus_vga.c */
  void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t 
*vga_ram_base, 
                           unsigned long vga_ram_offset, int 
vga_ram_size);
--- 537,545 ----
  void vga_invalidate_display(void);
  void vga_screen_dump(const char *filename);
  
  /* vnc.c */
! void vnc_display_init(DisplayState *ds, int useAlsoSDL, int 
vncport);
  
  /* cirrus_vga.c */
  void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t 
*vga_ram_base, 
                           unsigned long vga_ram_offset, int 
vga_ram_size);
diff -C4 qemu_cvs/vnc.c qemu_cvs_mod/vnc.c
*** qemu_cvs/vnc.c      2004-11-10 16:04:00.000000000 +0100
--- qemu_cvs_mod/vnc.c  2004-11-17 12:09:53.465017744 +0100
***************
*** 489,497 ****
  {
        rfbScreenCleanup(screen);
  }
  
! void vnc_display_init(DisplayState *ds, int useAlsoSDL)
  {
        if(!keyboard_layout) {
                fprintf(stderr, "No keyboard language specified\n");
                exit(1);
--- 489,497 ----
  {
        rfbScreenCleanup(screen);
  }
  
! void vnc_display_init(DisplayState *ds, int useAlsoSDL, int 
vncport)
  {
        if(!keyboard_layout) {
                fprintf(stderr, "No keyboard language specified\n");
                exit(1);
***************
*** 519,526 ****
--- 519,529 ----
        screen->serverFormat.redMax = 31;
        screen->serverFormat.greenMax = 63;
        screen->serverFormat.blueMax = 31;
  
+       if( vncport > 0 )
+           screen->port = vncport;
+ 
        if(useAlsoSDL) {
                ds_sdl=(DisplayState*)malloc(sizeof(DisplayState));
                sdl_display_init(ds_sdl,0);
                screen->frameBuffer = ds_sdl->data;


Is this the right way to do this?

Peter Reiter





reply via email to

[Prev in Thread] Current Thread [Next in Thread]