I didn't see a way so here is a patch for it work on 0.9.0

-Christopher

On Friday 16 February 2007 14:02, Christopher Olsen wrote:
> Anyone here know if there is a way to append to the VNC display header?
>
> -Christopher

-- 
Christopher Olsen
[EMAIL PROTECTED]
Tel: 631-676-4877
Fax: 631-249-3036
*** vl.c	Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vl.c	Fri Feb 16 13:30:09 2007
***************
*** 1,9 ****
--- 1,10 ----
  /*
   * QEMU System Emulator
   * 
   * Copyright (c) 2003-2007 Fabrice Bellard
+  * Copyright (C) 2007 Christopher Olsen <[EMAIL PROTECTED]>
   * 
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 45,54 ****
--- 46,60 ----
  #ifdef _BSD
  #include <sys/stat.h>
  #ifndef __APPLE__
  #include <libutil.h>
  #endif
+ #ifdef __FreeBSD__
+ #include <sys/module.h>
+ #include <dev/ppbus/ppi.h>
+ #include <dev/ppbus/ppbconf.h>
+ #endif
  #else
  #ifndef __sun__
  #include <linux/if.h>
  #include <linux/if_tun.h>
  #include <pty.h>
***************
*** 87,101 ****
--- 93,109 ----
  #include "disas.h"
  
  #include "exec-all.h"
  
  #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
+ #ifndef SMBD_COMMAND
  #ifdef __sun__
  #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
  #else
  #define SMBD_COMMAND "/usr/sbin/smbd"
  #endif
+ #endif
  
  //#define DEBUG_UNUSED_IOPORT
  //#define DEBUG_IOPORT
  
  #define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024)
***************
*** 156,165 ****
--- 164,174 ----
  #endif
  int usb_enabled = 0;
  static VLANState *first_vlan;
  int smp_cpus = 1;
  const char *vnc_display;
+ const char *vnc_name;
  #if defined(TARGET_SPARC)
  #define MAX_CPUS 16
  #elif defined(TARGET_I386)
  #define MAX_CPUS 255
  #else
***************
*** 626,636 ****
  static int use_rt_clock;
  
  static void init_get_clock(void)
  {
      use_rt_clock = 0;
! #if defined(__linux__)
      {
          struct timespec ts;
          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
              use_rt_clock = 1;
          }
--- 635,645 ----
  static int use_rt_clock;
  
  static void init_get_clock(void)
  {
      use_rt_clock = 0;
! #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
      {
          struct timespec ts;
          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
              use_rt_clock = 1;
          }
***************
*** 638,648 ****
  #endif
  }
  
  static int64_t get_clock(void)
  {
! #if defined(__linux__)
      if (use_rt_clock) {
          struct timespec ts;
          clock_gettime(CLOCK_MONOTONIC, &ts);
          return ts.tv_sec * 1000000000LL + ts.tv_nsec;
      } else 
--- 647,657 ----
  #endif
  }
  
  static int64_t get_clock(void)
  {
! #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
      if (use_rt_clock) {
          struct timespec ts;
          clock_gettime(CLOCK_MONOTONIC, &ts);
          return ts.tv_sec * 1000000000LL + ts.tv_nsec;
      } else 
***************
*** 1639,1649 ****
          term_init();
      }
      return chr;
  }
  
! #if defined(__linux__)
  static CharDriverState *qemu_chr_open_pty(void)
  {
      struct termios tty;
      char slave_name[1024];
      int master_fd, slave_fd;
--- 1648,1658 ----
          term_init();
      }
      return chr;
  }
  
! #if defined(__linux__) || defined(__FreeBSD__)
  static CharDriverState *qemu_chr_open_pty(void)
  {
      struct termios tty;
      char slave_name[1024];
      int master_fd, slave_fd;
***************
*** 1718,1731 ****
  
      cfsetispeed(&tty, spd);
      cfsetospeed(&tty, spd);
  
      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
!                           |INLCR|IGNCR|ICRNL|IXON);
!     tty.c_oflag |= OPOST;
      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
      switch(data_bits) {
      default:
      case 8:
          tty.c_cflag |= CS8;
          break;
--- 1727,1743 ----
  
      cfsetispeed(&tty, spd);
      cfsetospeed(&tty, spd);
  
      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
!                           |INLCR|IGNCR|ICRNL|IXON|IMAXBEL);
!     tty.c_oflag &= ~OPOST; /* Don't do any output processing! */
      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
+ #ifdef __FreeBSD__
+     cfmakeraw(&tty);
+ #endif
      switch(data_bits) {
      default:
      case 8:
          tty.c_cflag |= CS8;
          break;
***************
*** 1797,1806 ****
--- 1809,1819 ----
      chr->chr_ioctl = tty_serial_ioctl;
      qemu_chr_reset(chr);
      return chr;
  }
  
+ #if defined(__linux__)
  static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
  {
      int fd = (int)chr->opaque;
      uint8_t b;
  
***************
*** 1861,1870 ****
--- 1874,1941 ----
  
      qemu_chr_reset(chr);
  
      return chr;
  }
+ #elif defined(__FreeBSD__)
+ static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
+ {
+     int fd = (int)chr->opaque;
+     uint8_t b;
+ 
+     switch(cmd) {
+     case CHR_IOCTL_PP_READ_DATA:
+         if (ioctl(fd, PPIGDATA, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     case CHR_IOCTL_PP_WRITE_DATA:
+         b = *(uint8_t *)arg;
+         if (ioctl(fd, PPISDATA, &b) < 0)
+             return -ENOTSUP;
+         break;
+     case CHR_IOCTL_PP_READ_CONTROL:
+         if (ioctl(fd, PPIGCTRL, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     case CHR_IOCTL_PP_WRITE_CONTROL:
+         b = *(uint8_t *)arg;
+         if (ioctl(fd, PPISCTRL, &b) < 0)
+             return -ENOTSUP;
+         break;
+     case CHR_IOCTL_PP_READ_STATUS:
+         if (ioctl(fd, PPIGSTATUS, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     default:
+         return -ENOTSUP;
+     }
+     return 0;
+ }
+ 
+ CharDriverState *qemu_chr_open_pp(const char *filename)
+ {
+     CharDriverState *chr;
+     int fd;
+ 
+     fd = open(filename, O_RDWR);
+     if (fd < 0)
+         return NULL;
+ 
+     chr = qemu_mallocz(sizeof(CharDriverState));
+     if (!chr) {
+         close(fd);
+         return NULL;
+     }
+     chr->opaque = (void *)fd;
+     chr->chr_write = null_chr_write;
+     chr->chr_ioctl = pp_ioctl;
+     return chr;
+ }
+ #endif
  
  #else
  static CharDriverState *qemu_chr_open_pty(void)
  {
      return NULL;
***************
*** 2737,2746 ****
--- 2808,2824 ----
          return qemu_chr_open_pp(filename);
      } else 
      if (strstart(filename, "/dev/", NULL)) {
          return qemu_chr_open_tty(filename);
      } else 
+ #elif defined(__FreeBSD__)
+     if (strstart(filename, "/dev/ppi", NULL)) {
+         return qemu_chr_open_pp(filename);
+     } else 
+     if (strstart(filename, "/dev/", NULL)) {
+         return qemu_chr_open_tty(filename);
+     } else 
  #endif
  #ifdef _WIN32
      if (strstart(filename, "COM", NULL)) {
          return qemu_chr_open_win(filename);
      } else
***************
*** 3169,3178 ****
--- 3247,3284 ----
  
  #endif /* !defined(_WIN32) */
  
  #endif /* CONFIG_SLIRP */
  
+ #ifdef __FreeBSD__
+ #define LOAD_QUIETLY	1
+ #define LOAD_VERBOSLY	2
+ 
+ int
+ loadmodules(int how, const char *module, ...)
+ {
+   int loaded = 0;
+   va_list ap;
+ 
+   va_start(ap, module);
+ #ifndef NO_MODULES
+   while (module != NULL) {
+     if (modfind(module) == -1) {
+       if (kldload(module) == -1) {
+         if (how == LOAD_VERBOSLY)
+           fprintf(stderr, "%s: Cannot load module\n", module);
+       } else
+         loaded++;
+     }
+     module = va_arg(ap, const char *);
+   }
+   va_end(ap);
+ #endif
+   return loaded;
+ }
+ #endif
+ 
  #if !defined(_WIN32)
  
  typedef struct TAPState {
      VLANClientState *vc;
      int fd;
***************
*** 3224,3238 ****
  {
      int fd;
      char *dev;
      struct stat s;
  
      fd = open("/dev/tap", O_RDWR);
      if (fd < 0) {
!         fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
          return -1;
      }
  
      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
      pstrcpy(ifname, ifname_size, dev);
  
--- 3330,3388 ----
  {
      int fd;
      char *dev;
      struct stat s;
  
+ #ifdef __FreeBSD__
+     int i, kldtried = 0, enoentcount = 0, err = 0;
+     char dname[100];
+ #ifdef USE_DEVTAP
+     /*
+      * 5.x has /dev/tap, but that seems to just blindly increase its
+      * couter on every open() for some people(??), i.e. on every qemu run.
+      */
+     i = -1;
+ #else
+     i = 0;
+ #endif
+     for (; i < 10; i++) {
+         if (i == -1)
+ 	    strcpy(dname, "/dev/tap");
+         else
+ 	    snprintf(dname, sizeof dname, "%s%d",
+ 		     "/dev/tap", i);
+         fd = open(dname, O_RDWR);
+         if (fd >= 0)
+             break;
+         else if (errno == ENXIO || errno == ENOENT) {
+             if (i == 0 && !kldtried++) {
+                 /*
+                  * Attempt to load the tunnel interface KLD if it isn't loaded
+                  * already.
+                  */
+                 if (loadmodules(LOAD_VERBOSLY, "if_tap", NULL))
+                     i = -1;
+                 continue;
+             }
+             if (errno != ENOENT || ++enoentcount > 3) {
+                 err = errno;
+ 	        break;
+             }
+         } else
+             err = errno;
+     }
+     if (fd < 0) {
+         fprintf(stderr, "warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(err));
+         return -1;
+     }
+ #else
      fd = open("/dev/tap", O_RDWR);
      if (fd < 0) {
!         fprintf(stderr, "warning: could not open /dev/tap (%s): no virtual network emulation\n", strerror(errno));
          return -1;
      }
+ #endif
  
      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
      pstrcpy(ifname, ifname_size, dev);
  
***************
*** 6199,6208 ****
--- 6349,6359 ----
      QEMU_OPTION_win2k_hack,
      QEMU_OPTION_usb,
      QEMU_OPTION_usbdevice,
      QEMU_OPTION_smp,
      QEMU_OPTION_vnc,
+     QEMU_OPTION_vncname,
      QEMU_OPTION_no_acpi,
      QEMU_OPTION_no_reboot,
      QEMU_OPTION_daemonize,
      QEMU_OPTION_option_rom,
      QEMU_OPTION_semihosting
***************
*** 6279,6288 ****
--- 6430,6440 ----
      { "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
      { "win2k-hack", 0, QEMU_OPTION_win2k_hack },
      { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
      { "smp", HAS_ARG, QEMU_OPTION_smp },
      { "vnc", HAS_ARG, QEMU_OPTION_vnc },
+     { "vncname", HAS_ARG, QEMU_OPTION_vncname },
  
      /* temporary options */
      { "usb", 0, QEMU_OPTION_usb },
      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
      { "no-acpi", 0, QEMU_OPTION_no_acpi },
***************
*** 6704,6713 ****
--- 6856,6866 ----
                  }
                  break;
              case QEMU_OPTION_nographic:
                  pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
                  pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio");
+                 pstrcpy(parallel_devices[0], sizeof(parallel_devices[0]), "null");
                  nographic = 1;
                  break;
              case QEMU_OPTION_kernel:
                  kernel_filename = optarg;
                  break;
***************
*** 6936,6945 ****
--- 7089,7101 ----
                  }
                  break;
  	    case QEMU_OPTION_vnc:
  		vnc_display = optarg;
  		break;
+             case QEMU_OPTION_vncname:
+                 vnc_name = optarg;
+                 break;
              case QEMU_OPTION_no_acpi:
                  acpi_enabled = 0;
                  break;
              case QEMU_OPTION_no_reboot:
                  no_reboot = 1;
*** vl.h	Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vl.h	Fri Feb 16 13:30:23 2007
***************
*** 1,9 ****
--- 1,10 ----
  /*
   * QEMU System Emulator header
   * 
   * Copyright (c) 2003 Fabrice Bellard
+  * Copyright (C) 2007 Christopher Olsen <[EMAIL PROTECTED]>
   * 
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 28,37 ****
--- 29,44 ----
  #include <stdlib.h>
  #include <stdio.h>
  #include <stdarg.h>
  #include <string.h>
  #include <inttypes.h>
+ #ifndef PRId64
+ #define	PRId64	"lld"	/* int64_t */
+ #define	PRIo64	"llo"	/* int64_t */
+ #define	PRIx64	"llx"	/* int64_t */
+ #define	PRIu64	"llu"	/* int64_t */
+ #endif
  #include <limits.h>
  #include <time.h>
  #include <ctype.h>
  #include <errno.h>
  #include <unistd.h>
***************
*** 110,119 ****
--- 117,129 ----
  uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
  
  void hw_error(const char *fmt, ...);
  
  extern const char *bios_dir;
+ 
+ //UBU
+ extern const char *vnc_name;
  
  extern int vm_running;
  
  typedef struct vm_change_state_entry VMChangeStateEntry;
  typedef void VMChangeStateHandler(void *opaque, int running);
*** vnc.c	Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vnc.c	Fri Feb 16 13:29:13 2007
***************
*** 1,10 ****
--- 1,11 ----
  /*
   * QEMU VNC display driver
   * 
   * Copyright (C) 2006 Anthony Liguori <[EMAIL PROTECTED]>
   * Copyright (C) 2006 Fabrice Bellard
+  * Copyright (C) 2007 Christopher Olsen <[EMAIL PROTECTED]>
   * 
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 1054,1063 ****
--- 1055,1065 ----
  }
  
  static int protocol_client_init(VncState *vs, char *data, size_t len)
  {
      char pad[3] = { 0, 0, 0 };
+     char name[64];
  
      vs->width = vs->ds->width;
      vs->height = vs->ds->height;
      vnc_write_u16(vs, vs->ds->width);
      vnc_write_u16(vs, vs->ds->height);
***************
*** 1098,1109 ****
      }
      vs->write_pixels = vnc_write_pixels_copy;
  	
      vnc_write(vs, pad, 3);           /* padding */
  
!     vnc_write_u32(vs, 4);        
!     vnc_write(vs, "QEMU", 4);
      vnc_flush(vs);
  
      vnc_read_when(vs, protocol_client_msg, 1);
  
      return 0;
--- 1100,1115 ----
      }
      vs->write_pixels = vnc_write_pixels_copy;
  	
      vnc_write(vs, pad, 3);           /* padding */
  
!     if (vnc_name == 0x0)
!       sprintf(name, "QEMU: Unknown");
!     else
!       sprintf(name, "QEMU: %s",vnc_name);
!     vnc_write_u32(vs, strlen(name));
!     vnc_write(vs, name, strlen(name));
      vnc_flush(vs);
  
      vnc_read_when(vs, protocol_client_msg, 1);
  
      return 0;
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to