Browse Source

Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20200713-pull-request' into staging

bugfixes for audio, usb, ui and docs.

# gpg: Signature made Mon 13 Jul 2020 15:10:35 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/fixes-20200713-pull-request:
  usb: fix usb-host build on windows.
  ui: fix vc_chr_write call in text_console_do_init
  docs/qdev-device-use: Clean up the sentences related to -usbdevice
  ossaudio: fix out of bounds write

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Peter Maydell 5 years ago
parent
commit
20c1df5476
4 changed files with 10 additions and 31 deletions
  1. 1 0
      audio/ossaudio.c
  2. 3 25
      docs/qdev-device-use.txt
  3. 2 2
      hw/usb/host-libusb.c
  4. 4 4
      ui/console.c

+ 1 - 0
audio/ossaudio.c

@@ -691,6 +691,7 @@ static size_t oss_read(HWVoiceIn *hw, void *buf, size_t len)
                            len, dst);
                            len, dst);
                 break;
                 break;
             }
             }
+            break;
         }
         }
 
 
         pos += nread;
         pos += nread;

+ 3 - 25
docs/qdev-device-use.txt

@@ -125,12 +125,7 @@ The -device argument differs in detail for each type of drive:
 
 
 * if=pflash, if=mtd, if=sd, if=xen are not yet available with -device
 * if=pflash, if=mtd, if=sd, if=xen are not yet available with -device
 
 
-For USB devices, the old way is actually different:
-
-    -usbdevice disk:format=FMT:FILENAME
-
-Provides much less control than -drive's OPTS...  The new way fixes
-that:
+For USB storage devices, you can use something like:
 
 
     -device usb-storage,drive=DRIVE-ID,removable=RMB
     -device usb-storage,drive=DRIVE-ID,removable=RMB
 
 
@@ -177,8 +172,6 @@ The appropriate DEVNAME depends on the machine type.  For type "pc":
 
 
   This lets you control I/O ports and IRQs.
   This lets you control I/O ports and IRQs.
 
 
-* -usbdevice serial::chardev becomes -device usb-serial,chardev=dev.
-
 * -usbdevice braille doesn't support LEGACY-CHARDEV syntax.  It always
 * -usbdevice braille doesn't support LEGACY-CHARDEV syntax.  It always
   uses "braille".  With -device, this useful default is gone, so you
   uses "braille".  With -device, this useful default is gone, so you
   have to use something like
   have to use something like
@@ -238,10 +231,6 @@ The old way to define the guest part looks like this:
 
 
     -net nic,netdev=NET-ID,macaddr=MACADDR,model=MODEL,name=ID,addr=STR,vectors=V
     -net nic,netdev=NET-ID,macaddr=MACADDR,model=MODEL,name=ID,addr=STR,vectors=V
 
 
-Except for USB it looks like this:
-
-    -usbdevice net:netdev=NET-ID,macaddr=MACADDR,name=ID
-
 The new way is -device:
 The new way is -device:
 
 
     -device DEVNAME,netdev=NET-ID,mac=MACADDR,DEV-OPTS...
     -device DEVNAME,netdev=NET-ID,mac=MACADDR,DEV-OPTS...
@@ -336,12 +325,7 @@ The new way is -device DEVNAME,DEV-OPTS...  Details depend on DRIVER:
 * mouse           -device usb-mouse
 * mouse           -device usb-mouse
 * tablet          -device usb-tablet
 * tablet          -device usb-tablet
 * wacom-tablet    -device usb-wacom-tablet
 * wacom-tablet    -device usb-wacom-tablet
-* host:...        See "Host Device Assignment"
-* disk:...        See "Block Devices"
-* serial:...      See "Character Devices"
 * braille         See "Character Devices"
 * braille         See "Character Devices"
-* net:...         See "Network Devices"
-* bt:...          not yet available with -device
 
 
 === Watchdog Devices ===
 === Watchdog Devices ===
 
 
@@ -358,17 +342,11 @@ and host USB devices.  PCI devices can only be assigned with -device:
 
 
     -device vfio-pci,host=ADDR,id=ID
     -device vfio-pci,host=ADDR,id=ID
 
 
-The old way to assign a host USB device is
-
-    -usbdevice host:auto:BUS.ADDR:VID:PRID
-
-where any of BUS, ADDR, VID, PRID can be the wildcard *.
-
-The new way is
+To assign a host USB device use:
 
 
     -device usb-host,hostbus=BUS,hostaddr=ADDR,vendorid=VID,productid=PRID
     -device usb-host,hostbus=BUS,hostaddr=ADDR,vendorid=VID,productid=PRID
 
 
-Omitted options match anything, just like the old way's wildcard.
+Omitted options match anything.
 
 
 === Default Devices ===
 === Default Devices ===
 
 

+ 2 - 2
hw/usb/host-libusb.c

@@ -907,7 +907,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
             goto fail;
             goto fail;
         }
         }
     } else {
     } else {
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
         trace_usb_host_open_hostfd(hostfd);
         trace_usb_host_open_hostfd(hostfd);
 
 
         rc = libusb_wrap_sys_device(ctx, hostfd, &s->dh);
         rc = libusb_wrap_sys_device(ctx, hostfd, &s->dh);
@@ -1107,7 +1107,7 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
     QTAILQ_INIT(&s->isorings);
     QTAILQ_INIT(&s->isorings);
     s->hostfd = -1;
     s->hostfd = -1;
 
 
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
     if (s->hostdevice) {
     if (s->hostdevice) {
         int fd;
         int fd;
         s->needs_autoscan = false;
         s->needs_autoscan = false;

+ 4 - 4
ui/console.c

@@ -2184,12 +2184,12 @@ static void text_console_do_init(Chardev *chr, DisplayState *ds)
     text_console_resize(s);
     text_console_resize(s);
 
 
     if (chr->label) {
     if (chr->label) {
-        char msg[128];
-        int len;
+        char *msg;
 
 
         s->t_attrib.bgcol = QEMU_COLOR_BLUE;
         s->t_attrib.bgcol = QEMU_COLOR_BLUE;
-        len = snprintf(msg, sizeof(msg), "%s console\r\n", chr->label);
-        vc_chr_write(chr, (uint8_t *)msg, len);
+        msg = g_strdup_printf("%s console\r\n", chr->label);
+        vc_chr_write(chr, (uint8_t *)msg, strlen(msg));
+        g_free(msg);
         s->t_attrib = s->t_attrib_default;
         s->t_attrib = s->t_attrib_default;
     }
     }