From owner-freebsd-usb@FreeBSD.ORG Sun Jul 23 22:43:26 2006 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C109116A4DA; Sun, 23 Jul 2006 22:43:26 +0000 (UTC) (envelope-from qemu-l@saturn.kn-bremen.de) Received: from gwyn.kn-bremen.de (gwyn.kn-bremen.de [212.63.36.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5EF943D45; Sun, 23 Jul 2006 22:43:25 +0000 (GMT) (envelope-from qemu-l@saturn.kn-bremen.de) Received: from gwyn.kn-bremen.de (gwyn [127.0.0.1]) by gwyn.kn-bremen.de (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k6NMhM9a012123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 24 Jul 2006 00:43:22 +0200 Received: from saturn.kn-bremen.de (uucp@localhost) by gwyn.kn-bremen.de (8.13.4/8.13.4/Submit) with UUCP id k6NMhMFQ012121; Mon, 24 Jul 2006 00:43:22 +0200 Received: from saturn.kn-bremen.de (nox@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.13.6/8.13.6) with ESMTP id k6NMeh2c020372; Mon, 24 Jul 2006 00:40:43 +0200 (CEST) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.13.6/8.13.6/Submit) id k6NMegnL020371; Mon, 24 Jul 2006 00:40:42 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Mon, 24 Jul 2006 00:40:41 +0200 To: freebsd-emulation@freebsd.org, freebsd-usb@freebsd.org, qemu-devel@nongnu.org Message-ID: <20060723224041.GA20196@saturn.kn-bremen.de> Mail-Followup-To: freebsd-emulation@freebsd.org, freebsd-usb@freebsd.org, qemu-devel@nongnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11 Cc: Subject: qemu 0.8.2 update - please test! (and usb cardreader SET_ADDR_FAILED) X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2006 22:43:27 -0000 With the help of Lonnie Mendez (he updated his usb host support patch) I just put together an experimental qemu port update. For some reason my usb cardreader didnt want to work today: uhub1: device problem (SET_ADDR_FAILED), disabling port 1 (anyone have an idea about this one? this is the first time i tried using it since I updated this box to 6.1), so the usb host support is untested. To test usb best run qemu with -monitor stdio, then do `info usbhost' when its running and then `usb_add host:' where x.y is the host device you want to add (`plug into' the guest). also see the port's pkg-message. enjoy, Juergen Removed files: files/patch-malc-17h_aqemu files/patch-sdl.c files/patch-vl.c Index: Makefile =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/Makefile,v retrieving revision 1.53 diff -u -r1.53 Makefile --- Makefile 23 Jul 2006 00:04:01 -0000 1.53 +++ Makefile 23 Jul 2006 15:51:45 -0000 @@ -6,8 +6,7 @@ # PORTNAME= qemu -PORTVERSION= 0.8.1 -PORTREVISION= 2 +PORTVERSION= 0.8.2 CATEGORIES= emulators MASTER_SITES= http://www.qemu.org/:release \ http://people.fruitsalad.org/nox/qemu/:snapshot \ Index: distinfo =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/distinfo,v retrieving revision 1.31 diff -u -r1.31 distinfo --- distinfo 6 May 2006 16:15:41 -0000 1.31 +++ distinfo 23 Jul 2006 15:52:26 -0000 @@ -1,6 +1,6 @@ -MD5 (qemu/qemu-0.8.1.tar.gz) = 67d924324a5ab79d017bd97a1e767285 -SHA256 (qemu/qemu-0.8.1.tar.gz) = a1f83666f5c05eaee9bfc608a3a5034ad95d0fd3c99937bb399bf9235a6aa0c9 -SIZE (qemu/qemu-0.8.1.tar.gz) = 1623264 +MD5 (qemu/qemu-0.8.2.tar.gz) = 5b3a89eb2f256a8a6f3bb07f7b3f1b07 +SHA256 (qemu/qemu-0.8.2.tar.gz) = 2a20d811296c859d678bdd002222aa7ca7951a641327234f3af144e822d078f3 +SIZE (qemu/qemu-0.8.2.tar.gz) = 1810909 MD5 (qemu/patch3_cirrus) = ebe7ed9fce804c49e024bc93bfdfc810 SHA256 (qemu/patch3_cirrus) = e862371834b7d895a896fbdb84fd9f70d17b5729a6f6789a48a61504fc941e11 SIZE (qemu/patch3_cirrus) = 8817 Index: pkg-descr =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/pkg-descr,v retrieving revision 1.3 diff -u -r1.3 pkg-descr --- pkg-descr 19 Jul 2005 06:06:56 -0000 1.3 +++ pkg-descr 23 Jul 2006 17:46:11 -0000 @@ -12,9 +12,9 @@ cross-debugging. As QEMU requires no host kernel patches to run, it is very safe and easy to use. -(but kqemu is now also supported for the i386 on i386 case) +(but kqemu is now also supported for the i386 on i386 and amd64 case) See also the preconfigured system images on http://oszoo.org/ Many live cd isos also work. -WWW: http://fabrice.bellard.free.fr/qemu/ +WWW: http://qemu.org/ Index: pkg-plist =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/pkg-plist,v retrieving revision 1.15 diff -u -r1.15 pkg-plist --- pkg-plist 19 May 2006 08:17:54 -0000 1.15 +++ pkg-plist 23 Jul 2006 17:41:29 -0000 @@ -13,7 +13,7 @@ %%DATADIR%%/vgabios.bin %%DATADIR%%/vgabios-cirrus.bin %%DATADIR%%/ppc_rom.bin -%%DATADIR%%/proll.elf +%%DATADIR%%/openbios-sparc32 %%DATADIR%%/video.x %%DATADIR%%/keymaps/ar %%DATADIR%%/keymaps/common Index: files/patch-be =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/files/patch-be,v retrieving revision 1.2 diff -u -r1.2 patch-be --- files/patch-be 1 May 2005 07:39:11 -0000 1.2 +++ files/patch-be 23 Jul 2006 16:30:16 -0000 @@ -1,16 +1,12 @@ -Index: qemu/vl.c -@@ -662,6 +662,14 @@ - case QEMU_TIMER_REALTIME: - #ifdef _WIN32 - return GetTickCount(); -+#elif defined(_BSD) -+ { -+ struct timeval r; -+ if (!gettimeofday(&r, NULL)) { -+ return ((timer_freq * 1000LL) * (int64_t)r.tv_sec -+ + ((int64_t)r.tv_usec * timer_freq) / 1000) / timer_freq; -+ } -+ } - #else - { - struct tms tp; +Index: qemu/Makefile.target +@@ -404,7 +404,9 @@ + ifndef CONFIG_DARWIN + ifndef CONFIG_WIN32 + ifndef CONFIG_SOLARIS +-VL_LIBS=-lutil -lrt ++#VL_LIBS=-lutil -lrt ++# XXX this cant be just merged back... ++VL_LIBS=-lutil + endif + endif + endif Index: files/patch-bsdusb.patch =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/files/patch-bsdusb.patch,v retrieving revision 1.4 diff -u -r1.4 patch-bsdusb.patch --- files/patch-bsdusb.patch 29 Apr 2006 09:15:50 -0000 1.4 +++ files/patch-bsdusb.patch 23 Jul 2006 19:58:22 -0000 @@ -1,6 +1,5 @@ Index: qemu/configure -@@ -122,7 +122,8 @@ - *) +@@ -134,6 +134,7 @@ oss="yes" linux="yes" user="yes" @@ -8,18 +7,19 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes" fi -@@ -131,6 +132,7 @@ +@@ -143,6 +144,7 @@ if [ "$bsd" = "yes" ] ; then - if [ ! "$darwin" = "yes" ] ; then + if [ "$darwin" != "yes" ] ; then make="gmake" + usb="bsd" fi fi -@@ -656,6 +675,19 @@ - echo "#define _BSD 1" >> $config_h +@@ -724,6 +726,19 @@ fi + echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h ++ +# USB host support +case "$usb" in +linux) @@ -32,20 +32,19 @@ + echo "HOST_USB=stub" >> $config_mak +;; +esac -+ - for target in $target_list; do + for target in $target_list; do target_dir="$target" Index: qemu/Makefile.target -@@ -303,7 +303,7 @@ - endif +@@ -329,7 +329,7 @@ + VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o # USB layer --VL_OBJS+= usb.o usb-hub.o usb-uhci.o usb-linux.o usb-hid.o -+VL_OBJS+= usb.o usb-hub.o usb-uhci.o usb-$(HOST_USB).o usb-hid.o +-VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o ++VL_OBJS+= usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-ohci.o usb-msd.o # PCI network cards - VL_OBJS+= ne2000.o rtl8139.o + VL_OBJS+= ne2000.o rtl8139.o pcnet.o Index: qemu/usb-stub.c @@ -0,0 +1,11 @@ +#include "vl.h" @@ -60,11 +59,11 @@ + return NULL; +} Index: qemu/usb-bsd.c -@@ -0,0 +1,592 @@ +@@ -0,0 +1,603 @@ +/* + * BSD host USB redirector + * -+ * Copyright (c) 2005 Lonnie Mendez ++ * Copyright (c) 2006 Lonnie Mendez + * Portions of code and concepts borrowed from + * usb-linux.c and libusb's bsd.c and are copyright their respective owners. + * @@ -336,6 +335,23 @@ + } +} + ++static void usb_host_handle_destroy(USBDevice *opaque) ++{ ++ USBHostDevice *s = (USBHostDevice *)opaque; ++ int i; ++ ++ for (i = 0; i < USB_MAX_ENDPOINTS; i++) ++ if (s->ep_fd[i] >= 0) ++ close(s->ep_fd[i]); ++ ++ if (s->devfd < 0) ++ return; ++ ++ close(s->devfd); ++ ++ qemu_free(s); ++} ++ +USBDevice *usb_host_device_open(const char *devname) +{ + struct usb_device_info bus_info, dev_info; @@ -409,8 +425,16 @@ + dev->dev.handle_reset = usb_host_handle_reset; + dev->dev.handle_control = usb_host_handle_control; + dev->dev.handle_data = usb_host_handle_data; ++ dev->dev.handle_destroy = usb_host_handle_destroy; ++ ++ if (strncmp(dev_info.udi_product, "product", 7) != 0) ++ pstrcpy(dev->dev.devname, sizeof(dev->dev.devname), ++ dev_info.udi_product); ++ else ++ snprintf(dev->dev.devname, sizeof(dev->dev.devname), ++ "host:%s", devname); + -+ strcpy(dev->devpath, "/dev/"); ++ pstrcpy(dev->devpath, sizeof(dev->devpath), "/dev/"); + strcat(dev->devpath, dev_info.udi_devnames[0]); + + /* Mark the endpoints as not yet open */ @@ -426,21 +450,6 @@ + return NULL; +} + -+void usb_host_device_close(USBDevice *opaque) -+{ -+ USBHostDevice *s = (USBHostDevice *)opaque; -+ int i; -+ -+ for (i = 0; i < USB_MAX_ENDPOINTS; i++) -+ if (s->ep_fd[i] >= 0) -+ close(s->ep_fd[i]); -+ -+ if (s->devfd < 0) -+ return; -+ -+ close(s->devfd); -+} -+ +static int usb_host_scan(void *opaque, USBScanFunc *func) +{ + struct usb_device_info bus_info; @@ -494,7 +503,8 @@ + speed = dev_info.udi_speed; + + if (strncmp(dev_info.udi_product, "product", 7) != 0) -+ strcpy(product_name, dev_info.udi_product); ++ pstrcpy(product_name, sizeof(product_name), ++ dev_info.udi_product); + else + product_name[0] = '\0'; + @@ -653,55 +663,6 @@ +{ + usb_host_scan(NULL, usb_host_info_device); +} -Index: qemu/vl.c -@@ -3245,14 +3258,17 @@ - dev = usb_host_device_open(p); - if (!dev) - return -1; -+ dev->isproxied = 1; - } else if (!strcmp(devname, "mouse")) { - dev = usb_mouse_init(); - if (!dev) - return -1; -+ dev->isproxied = 0; - } else if (!strcmp(devname, "tablet")) { - dev = usb_tablet_init(); - if (!dev) - return -1; -+ dev->isproxied = 0; - } else { - return -1; - } -@@ -3281,6 +3297,8 @@ - if (dev && dev->addr == addr) - break; - } -+ if (dev && dev->isproxied) -+ usb_host_device_close(dev); - if (i == MAX_VM_USB_PORTS) - return -1; - usb_attach(vm_usb_ports[i], NULL); -Index: qemu/hw/usb.h -@@ -135,6 +146,8 @@ - int setup_state; - int setup_len; - int setup_index; -+ -+ int isproxied; - }; - - /* USB port on which a device can be connected */ -@@ -157,8 +170,9 @@ - /* usb-uhci.c */ - void usb_uhci_init(PCIBus *bus, USBPort **usb_ports); - --/* usb-linux.c */ -+/* host proxy functions */ - USBDevice *usb_host_device_open(const char *devname); -+void usb_host_device_close(USBDevice *dev); - void usb_host_info(void); - - /* usb-hid.c */ Index: qemu/usb-linux.c @@ -23,7 +23,6 @@ */ @@ -710,23 +671,8 @@ -#if defined(__linux__) #include #include - #include -@@ -255,6 +254,14 @@ - return q - buf; - } - -+void usb_host_device_close(USBDevice *opaque) -+{ -+ USBHostDevice *s = (USBHostDevice *)opaque; -+ -+ if (s->fd >= 0) -+ close(s->fd); -+} -+ - static int usb_host_scan(void *opaque, USBScanFunc *func) - { - FILE *f; -@@ -468,18 +475,3 @@ + #include +@@ -505,18 +504,3 @@ { usb_host_scan(NULL, usb_host_info_device); } Index: files/patch-fbsd =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/files/patch-fbsd,v retrieving revision 1.7 diff -u -r1.7 patch-fbsd --- files/patch-fbsd 6 May 2006 16:15:41 -0000 1.7 +++ files/patch-fbsd 23 Jul 2006 16:15:26 -0000 @@ -1,21 +1,17 @@ Index: qemu/Makefile -@@ -13,11 +13,14 @@ +@@ -25,7 +25,10 @@ + DOCS= endif - DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 - --all: dyngen$(EXESUF) $(TOOLS) $(DOCS) -+all: bsd/libmath.a dyngen$(EXESUF) $(TOOLS) $(DOCS) - for d in $(TARGET_DIRS); do \ - $(MAKE) -C $$d $@ || exit 1 ; \ - done +-all: $(TOOLS) $(DOCS) recurse-all ++all: bsd/libmath.a $(TOOLS) $(DOCS) recurse-all ++ +bsd/libmath.a: + ( cd bsd ; $(BSD_MAKE) CC=$(CC) ) -+ - qemu-img$(EXESUF): qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c - $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS) -@@ -26,6 +29,7 @@ + subdir-%: dyngen$(EXESUF) + $(MAKE) -C $(subst subdir-,,$@) all +@@ -40,6 +43,7 @@ clean: # avoid old build problems by removing potentially incorrect old files @@ -36,7 +32,7 @@ cocoa.o: cocoa.m $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< Index: qemu/fpu/softfloat-native.c -@@ -2,11 +2,15 @@ +@@ -2,11 +2,14 @@ context is supported */ #include "softfloat.h" #include @@ -47,21 +43,20 @@ void set_float_rounding_mode(int val STATUS_PARAM) { STATUS(float_rounding_mode) = val; --#if defined(_BSD) && !defined(__APPLE__) -+#if defined(_BSD) && !defined(__APPLE__) && \ -+ (defined(__FreeBSD__) && __FreeBSD_version < 500000) +-#if defined(_BSD) && !defined(__APPLE__) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) ++#if (defined(_BSD) && (defined(__FreeBSD__) && __FreeBSD_version < 500000)) && !defined(__APPLE__) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) fpsetround(val); #elif defined(__arm__) /* nothing to do */ -@@ -22,7 +26,7 @@ +@@ -22,7 +25,7 @@ } #endif --#if defined(_BSD) -+#if defined(_BSD) && !defined(__FreeBSD__) - #define lrint(d) ((long)rint(d)) - #define llrint(d) ((long long)rint(d)) - #endif +-#if defined(_BSD) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) ++#if (defined(_BSD) && !defined(__FreeBSD__)) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) + #define lrint(d) ((int32_t)rint(d)) + #define llrint(d) ((int64_t)rint(d)) + #define lrintf(f) ((int32_t)rint(f)) Index: qemu/fpu/softfloat-native.h @@ -1,8 +1,28 @@ /* Native implementation of soft float functions */