All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: Un-deprecate -usbdevice (except for -usbdevice audio which gets removed)
@ 2021-03-09 14:29 Thomas Huth
  2021-03-09 14:45 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2021-03-09 14:29 UTC (permalink / raw)
  To: qemu-devel, Gerd Hoffmann
  Cc: Paolo Bonzini, Daniel P . Berrangé, Samuel Thibault

When trying to remove the -usbdevice option, there were complaints that
"-usbdevice braille" is still a very useful shortcut for some people.
Thus we never remove this option. Since it's not such a big burden to
keep it around, and it's also convenient in the sense that you don't
have to worry to enable a host controller explicitly with this option,
we should remove it from he deprecation list again, and rather properly
document the possible device for this option instead.

However, there is one exception: "-usbdevice audio" should go away, since
audio devices without "audiodev=..." parameter are also on the deprecation
list and you cannot use "-usbdevice audio" with "audiodev".

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 docs/system/deprecated.rst |  9 ---------
 hw/usb/dev-audio.c         |  1 -
 qemu-options.hx            | 38 ++++++++++++++++++++++++++++++++------
 softmmu/vl.c               |  2 --
 4 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index cfabe69846..816eb4084f 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -21,15 +21,6 @@ deprecated.
 System emulator command line arguments
 --------------------------------------
 
-``-usbdevice`` (since 2.10.0)
-'''''''''''''''''''''''''''''
-
-The ``-usbdevice DEV`` argument is now a synonym for setting
-the ``-device usb-DEV`` argument instead. The deprecated syntax
-would automatically enable USB support on the machine type.
-If using the new syntax, USB support must be explicitly
-enabled via the ``-machine usb=on`` argument.
-
 ``-drive file=json:{...{'driver':'file'}}`` (since 3.0)
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c
index e1486f81e0..f5cb246792 100644
--- a/hw/usb/dev-audio.c
+++ b/hw/usb/dev-audio.c
@@ -1024,7 +1024,6 @@ static const TypeInfo usb_audio_info = {
 static void usb_audio_register_types(void)
 {
     type_register_static(&usb_audio_info);
-    usb_legacy_register(TYPE_USB_AUDIO, "audio", NULL);
 }
 
 type_init(usb_audio_register_types)
diff --git a/qemu-options.hx b/qemu-options.hx
index 90801286c6..cef8c2da57 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1705,7 +1705,7 @@ ERST
 
 DEFHEADING()
 
-DEFHEADING(USB options:)
+DEFHEADING(USB convenience options:)
 
 DEF("usb", 0, QEMU_OPTION_usb,
     "-usb            enable on-board USB host controller (if not enabled by default)\n",
@@ -1723,9 +1723,31 @@ DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
     QEMU_ARCH_ALL)
 SRST
 ``-usbdevice devname``
-    Add the USB device devname. Note that this option is deprecated,
-    please use ``-device usb-...`` instead. See the chapter about
+    Add the USB device devname, and enable an on-board USB controller
+    if possible and necessary (just like it can be done via
+    ``-machine usb=on``). Note that this option is mainly intended for
+    the user's convenience only. More fine-grained control can be
+    achieved by selecting a USB host controller (if necessary) and the
+    desired USB device via the ``-device`` option instead. For example,
+    instead of using ``-usbdevice mouse`` it is possible to use
+    ``-device qemu-xhci -device usb-mouse`` to connect the USB mouse
+    to a USB 3.0 controller instead (at least on machines that support
+    PCI and do not have an USB controller enabled by default yet).
+    For more details, see the chapter about
     :ref:`Connecting USB devices` in the System Emulation Users Guide.
+    Possible devices for devname are:
+
+    ``braille``
+        Braille device. This will use BrlAPI to display the braille
+        output on a real or fake device (i.e. it also creates a
+        corresponding ``braille`` chardev automatically beside the
+        ``usb-braille`` USB device).
+
+    ``ccid``
+        Smartcard reader device
+
+    ``keyboard``
+        Standard USB keyboard. Will override the PS/2 keyboard (if present).
 
     ``mouse``
         Virtual Mouse. This will override the PS/2 mouse emulation when
@@ -1737,9 +1759,13 @@ SRST
         position without having to grab the mouse. Also overrides the
         PS/2 mouse emulation when activated.
 
-    ``braille``
-        Braille device. This will use BrlAPI to display the braille
-        output on a real or fake device.
+    ``u2f-key``
+        U2F (Universal Second Factor) key.
+
+    ``wacom-tablet``
+        Wacom PenPartner USB tablet.
+
+
 ERST
 
 DEFHEADING()
diff --git a/softmmu/vl.c b/softmmu/vl.c
index ff488ea3e7..76ebe7bb7a 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3180,8 +3180,6 @@ void qemu_init(int argc, char **argv, char **envp)
                 qemu_opts_parse_noisily(olist, "usb=on", false);
                 break;
             case QEMU_OPTION_usbdevice:
-                error_report("'-usbdevice' is deprecated, please use "
-                             "'-device usb-...' instead");
                 olist = qemu_find_opts("machine");
                 qemu_opts_parse_noisily(olist, "usb=on", false);
                 add_device_config(DEV_USB, optarg);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: Un-deprecate -usbdevice (except for -usbdevice audio which gets removed)
  2021-03-09 14:29 [PATCH] usb: Un-deprecate -usbdevice (except for -usbdevice audio which gets removed) Thomas Huth
@ 2021-03-09 14:45 ` Paolo Bonzini
  2021-03-09 16:26   ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2021-03-09 14:45 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Gerd Hoffmann
  Cc: Samuel Thibault, Daniel P . Berrangé

On 09/03/21 15:29, Thomas Huth wrote:
> When trying to remove the -usbdevice option, there were complaints that
> "-usbdevice braille" is still a very useful shortcut for some people.
> Thus we never remove this option. Since it's not such a big burden to
> keep it around, and it's also convenient in the sense that you don't
> have to worry to enable a host controller explicitly with this option,
> we should remove it from he deprecation list again, and rather properly
> document the possible device for this option instead.
> 
> However, there is one exception: "-usbdevice audio" should go away, since
> audio devices without "audiodev=..." parameter are also on the deprecation
> list and you cannot use "-usbdevice audio" with "audiodev".
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

It's missing an addition to docs/system/removed-features.rst for 
"-usbdevice audio"; otherwise looks good.

By the way, we should add an equivalent of "-nic" for audio devices when 
removing -soundhw.  Something like "-audio 
BACKEND[,model=DEVTYPE],ARGS"; it would be equivalent to "-audiodev 
BACKEND,ARGS,id=audiodev0 -device DEVTYPE" with DEVTYPE, and would 
instead be processed by the board if DEVTYPE is not specified.

Paolo

> ---
>   docs/system/deprecated.rst |  9 ---------
>   hw/usb/dev-audio.c         |  1 -
>   qemu-options.hx            | 38 ++++++++++++++++++++++++++++++++------
>   softmmu/vl.c               |  2 --
>   4 files changed, 32 insertions(+), 18 deletions(-)
> 
> diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
> index cfabe69846..816eb4084f 100644
> --- a/docs/system/deprecated.rst
> +++ b/docs/system/deprecated.rst
> @@ -21,15 +21,6 @@ deprecated.
>   System emulator command line arguments
>   --------------------------------------
>   
> -``-usbdevice`` (since 2.10.0)
> -'''''''''''''''''''''''''''''
> -
> -The ``-usbdevice DEV`` argument is now a synonym for setting
> -the ``-device usb-DEV`` argument instead. The deprecated syntax
> -would automatically enable USB support on the machine type.
> -If using the new syntax, USB support must be explicitly
> -enabled via the ``-machine usb=on`` argument.
> -
>   ``-drive file=json:{...{'driver':'file'}}`` (since 3.0)
>   '''''''''''''''''''''''''''''''''''''''''''''''''''''''
>   
> diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c
> index e1486f81e0..f5cb246792 100644
> --- a/hw/usb/dev-audio.c
> +++ b/hw/usb/dev-audio.c
> @@ -1024,7 +1024,6 @@ static const TypeInfo usb_audio_info = {
>   static void usb_audio_register_types(void)
>   {
>       type_register_static(&usb_audio_info);
> -    usb_legacy_register(TYPE_USB_AUDIO, "audio", NULL);
>   }
>   
>   type_init(usb_audio_register_types)
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 90801286c6..cef8c2da57 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1705,7 +1705,7 @@ ERST
>   
>   DEFHEADING()
>   
> -DEFHEADING(USB options:)
> +DEFHEADING(USB convenience options:)
>   
>   DEF("usb", 0, QEMU_OPTION_usb,
>       "-usb            enable on-board USB host controller (if not enabled by default)\n",
> @@ -1723,9 +1723,31 @@ DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
>       QEMU_ARCH_ALL)
>   SRST
>   ``-usbdevice devname``
> -    Add the USB device devname. Note that this option is deprecated,
> -    please use ``-device usb-...`` instead. See the chapter about
> +    Add the USB device devname, and enable an on-board USB controller
> +    if possible and necessary (just like it can be done via
> +    ``-machine usb=on``). Note that this option is mainly intended for
> +    the user's convenience only. More fine-grained control can be
> +    achieved by selecting a USB host controller (if necessary) and the
> +    desired USB device via the ``-device`` option instead. For example,
> +    instead of using ``-usbdevice mouse`` it is possible to use
> +    ``-device qemu-xhci -device usb-mouse`` to connect the USB mouse
> +    to a USB 3.0 controller instead (at least on machines that support
> +    PCI and do not have an USB controller enabled by default yet).
> +    For more details, see the chapter about
>       :ref:`Connecting USB devices` in the System Emulation Users Guide.
> +    Possible devices for devname are:
> +
> +    ``braille``
> +        Braille device. This will use BrlAPI to display the braille
> +        output on a real or fake device (i.e. it also creates a
> +        corresponding ``braille`` chardev automatically beside the
> +        ``usb-braille`` USB device).
> +
> +    ``ccid``
> +        Smartcard reader device
> +
> +    ``keyboard``
> +        Standard USB keyboard. Will override the PS/2 keyboard (if present).
>   
>       ``mouse``
>           Virtual Mouse. This will override the PS/2 mouse emulation when
> @@ -1737,9 +1759,13 @@ SRST
>           position without having to grab the mouse. Also overrides the
>           PS/2 mouse emulation when activated.
>   
> -    ``braille``
> -        Braille device. This will use BrlAPI to display the braille
> -        output on a real or fake device.
> +    ``u2f-key``
> +        U2F (Universal Second Factor) key.
> +
> +    ``wacom-tablet``
> +        Wacom PenPartner USB tablet.
> +
> +
>   ERST
>   
>   DEFHEADING()
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index ff488ea3e7..76ebe7bb7a 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -3180,8 +3180,6 @@ void qemu_init(int argc, char **argv, char **envp)
>                   qemu_opts_parse_noisily(olist, "usb=on", false);
>                   break;
>               case QEMU_OPTION_usbdevice:
> -                error_report("'-usbdevice' is deprecated, please use "
> -                             "'-device usb-...' instead");
>                   olist = qemu_find_opts("machine");
>                   qemu_opts_parse_noisily(olist, "usb=on", false);
>                   add_device_config(DEV_USB, optarg);
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: Un-deprecate -usbdevice (except for -usbdevice audio which gets removed)
  2021-03-09 14:45 ` Paolo Bonzini
@ 2021-03-09 16:26   ` Thomas Huth
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2021-03-09 16:26 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel, Gerd Hoffmann
  Cc: Samuel Thibault, Daniel P . Berrangé

On 09/03/2021 15.45, Paolo Bonzini wrote:
> On 09/03/21 15:29, Thomas Huth wrote:
>> When trying to remove the -usbdevice option, there were complaints that
>> "-usbdevice braille" is still a very useful shortcut for some people.
>> Thus we never remove this option. Since it's not such a big burden to
>> keep it around, and it's also convenient in the sense that you don't
>> have to worry to enable a host controller explicitly with this option,
>> we should remove it from he deprecation list again, and rather properly
>> document the possible device for this option instead.
>>
>> However, there is one exception: "-usbdevice audio" should go away, since
>> audio devices without "audiodev=..." parameter are also on the deprecation
>> list and you cannot use "-usbdevice audio" with "audiodev".
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
> 
> It's missing an addition to docs/system/removed-features.rst for "-usbdevice 
> audio"; otherwise looks good.

Well, I guess hardly anybody ever used this since it was completely 
undocumented (try to google it - I just got one
result), but yeah, let's better document it that it's gone
now. I'll send a v2.

  Thomas



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-09 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 14:29 [PATCH] usb: Un-deprecate -usbdevice (except for -usbdevice audio which gets removed) Thomas Huth
2021-03-09 14:45 ` Paolo Bonzini
2021-03-09 16:26   ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.