diff mbox series

[04/14] softmmu: remove '-usbdevice' command line option

Message ID 20210224131142.1952027-5-berrange@redhat.com
State New
Headers show
Series deprecations: remove many old deprecations | expand

Commit Message

Daniel P. Berrangé Feb. 24, 2021, 1:11 p.m. UTC
This was replaced by the '-device usb-DEV' option.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 docs/system/deprecated.rst       |  9 -------
 docs/system/removed-features.rst |  9 +++++++
 softmmu/vl.c                     | 42 --------------------------------
 3 files changed, 9 insertions(+), 51 deletions(-)

Comments

Paolo Bonzini Feb. 24, 2021, 1:25 p.m. UTC | #1
On 24/02/21 14:11, Daniel P. Berrangé wrote:
> This was replaced by the '-device usb-DEV' option.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

This is probably used in many tutorial as "-usbdevice tablet" (for 
example https://wiki.gentoo.org/wiki/QEMU/Options).

Paolo

> ---
>   docs/system/deprecated.rst       |  9 -------
>   docs/system/removed-features.rst |  9 +++++++
>   softmmu/vl.c                     | 42 --------------------------------
>   3 files changed, 9 insertions(+), 51 deletions(-)
> 
> diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
> index 611adf60f7..c577cc97c4 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/docs/system/removed-features.rst b/docs/system/removed-features.rst
> index dc63581fe5..74d022babf 100644
> --- a/docs/system/removed-features.rst
> +++ b/docs/system/removed-features.rst
> @@ -50,6 +50,15 @@ by the ``tls-authz`` and ``sasl-authz`` options.
>   The ``pretty=on|off`` switch has no effect for HMP monitors and
>   its use is rejected.
>   
> +``-usbdevice`` (removed in 6.0)
> +'''''''''''''''''''''''''''''''
> +
> +The ``-usbdevice DEV`` argument was now a synonym for setting
> +the ``-device usb-DEV`` argument instead. The removed syntax
> +would automatically enable USB support on the machine type.
> +When using the new syntax, USB support must be explicitly
> +enabled via the ``-machine usb=on`` argument.
> +
>   QEMU Machine Protocol (QMP) commands
>   ------------------------------------
>   
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index b219ce1f35..c31061cc09 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -743,34 +743,6 @@ static void configure_msg(QemuOpts *opts)
>   }
>   
>   
> -/***********************************************************/
> -/* USB devices */
> -
> -static int usb_device_add(const char *devname)
> -{
> -    USBDevice *dev = NULL;
> -
> -    if (!machine_usb(current_machine)) {
> -        return -1;
> -    }
> -
> -    dev = usbdevice_create(devname);
> -    if (!dev)
> -        return -1;
> -
> -    return 0;
> -}
> -
> -static int usb_parse(const char *cmdline)
> -{
> -    int r;
> -    r = usb_device_add(cmdline);
> -    if (r < 0) {
> -        error_report("could not add USB device '%s'", cmdline);
> -    }
> -    return r;
> -}
> -
>   /***********************************************************/
>   /* machine registration */
>   
> @@ -1267,7 +1239,6 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty)
>   
>   struct device_config {
>       enum {
> -        DEV_USB,       /* -usbdevice     */
>           DEV_SERIAL,    /* -serial        */
>           DEV_PARALLEL,  /* -parallel      */
>           DEV_DEBUGCON,  /* -debugcon */
> @@ -2484,12 +2455,6 @@ static void qemu_create_cli_devices(void)
>       qemu_opts_foreach(qemu_find_opts("fw_cfg"),
>                         parse_fw_cfg, fw_cfg_find(), &error_fatal);
>   
> -    /* init USB devices */
> -    if (machine_usb(current_machine)) {
> -        if (foreach_device_config(DEV_USB, usb_parse) < 0)
> -            exit(1);
> -    }
> -
>       /* init generic devices */
>       rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE);
>       qemu_opts_foreach(qemu_find_opts("device"),
> @@ -3182,13 +3147,6 @@ void qemu_init(int argc, char **argv, char **envp)
>                   olist = qemu_find_opts("machine");
>                   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);
> -                break;
>               case QEMU_OPTION_device:
>                   if (!qemu_opts_parse_noisily(qemu_find_opts("device"),
>                                                optarg, true)) {
>
Daniel P. Berrangé Feb. 24, 2021, 1:44 p.m. UTC | #2
On Wed, Feb 24, 2021 at 02:25:46PM +0100, Paolo Bonzini wrote:
> On 24/02/21 14:11, Daniel P. Berrangé wrote:
> > This was replaced by the '-device usb-DEV' option.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> 
> This is probably used in many tutorial as "-usbdevice tablet" (for example
> https://wiki.gentoo.org/wiki/QEMU/Options).

It has been deprecated, printing a warning message, for almost 4 years
now, and had your ack originally :-)

  commit a358a3af4558a24398a541951cad7a6c458df72b
  Author: Thomas Huth <thuth@redhat.com>
  Date:   Fri May 19 08:35:16 2017 +0200

    usb: Deprecate the legacy -usbdevice option
    
    The '-usbdevice' option is considered as deprecated nowadays and
    we might want to remove these options in a future version of QEMU.
    So mark this options as deprecated in the documenation and print out
    a warning if it is used to tell the user what to use instead.
    While we're at it, improve also some other minor USB-related spots
    in qemu-options.hx that were not up to date anymore.
    
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-id: 1495175716-12735-1-git-send-email-thuth@redhat.com
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


There's some tradeoff to be had.  The 3rd party docs will be unlikely
to be updated to the new syntax as long as the old syntax still works.
So we get ourselves into a chicken & egg scenario.

Overall the -usbdevice doesn't add significant syntax sugar benefits
over -device, as compared benefits of other syntax sugar args we
have.

> > ---
> >   docs/system/deprecated.rst       |  9 -------
> >   docs/system/removed-features.rst |  9 +++++++
> >   softmmu/vl.c                     | 42 --------------------------------
> >   3 files changed, 9 insertions(+), 51 deletions(-)

It seems this is incomplete though, I missed qemu-options.hx,
docs/qdev-device-use.txt and hw/usb/bus.c updates to remove
associated cruft.


Regards,
Daniel
Thomas Huth Feb. 24, 2021, 1:58 p.m. UTC | #3
On 24/02/2021 14.11, Daniel P. Berrangé wrote:
> This was replaced by the '-device usb-DEV' option.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   docs/system/deprecated.rst       |  9 -------
>   docs/system/removed-features.rst |  9 +++++++
>   softmmu/vl.c                     | 42 --------------------------------
>   3 files changed, 9 insertions(+), 51 deletions(-)

Last time I tried to remove -usbdevice, there was some concerns that 
-usbdevice braille might still be useful for some people, see the thread 
that started here:

  https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg00651.html

(and Gerd's summary here: 
https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg01520.html )

So we might need a new "sugared" option like "-braille" instead before we 
can fully remove -usbdevice? ... or we just keep -usbdevice as a bittersweet 
remainder?

  Thomas
Daniel P. Berrangé Feb. 24, 2021, 2:10 p.m. UTC | #4
On Wed, Feb 24, 2021 at 02:58:19PM +0100, Thomas Huth wrote:
> On 24/02/2021 14.11, Daniel P. Berrangé wrote:
> > This was replaced by the '-device usb-DEV' option.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >   docs/system/deprecated.rst       |  9 -------
> >   docs/system/removed-features.rst |  9 +++++++
> >   softmmu/vl.c                     | 42 --------------------------------
> >   3 files changed, 9 insertions(+), 51 deletions(-)
> 
> Last time I tried to remove -usbdevice, there was some concerns that
> -usbdevice braille might still be useful for some people, see the thread
> that started here:
> 
>  https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg00651.html
> 
> (and Gerd's summary here:
> https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg01520.html )

Urgh, so the current deprecation docs are a bit misleading by saying
-usbdevice is directly mapped to -device.

> So we might need a new "sugared" option like "-braille" instead before we
> can fully remove -usbdevice? ... or we just keep -usbdevice as a bittersweet
> remainder?

I'm not going to implement new CLI options, and if that's needed, we
ought to re-start the clock on the deprecation at that point. So this
points towards just removing the deprecation warning that exists
today. Or alternatively drop support for -usbdevice, except for the
braille type.

Regards,
Daniel
Thomas Huth Feb. 25, 2021, 5:34 a.m. UTC | #5
On 24/02/2021 15.10, Daniel P. Berrangé wrote:
> On Wed, Feb 24, 2021 at 02:58:19PM +0100, Thomas Huth wrote:
>> On 24/02/2021 14.11, Daniel P. Berrangé wrote:
>>> This was replaced by the '-device usb-DEV' option.
>>>
>>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>>> ---
>>>    docs/system/deprecated.rst       |  9 -------
>>>    docs/system/removed-features.rst |  9 +++++++
>>>    softmmu/vl.c                     | 42 --------------------------------
>>>    3 files changed, 9 insertions(+), 51 deletions(-)
>>
>> Last time I tried to remove -usbdevice, there was some concerns that
>> -usbdevice braille might still be useful for some people, see the thread
>> that started here:
>>
>>   https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg00651.html
>>
>> (and Gerd's summary here:
>> https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg01520.html )
> 
> Urgh, so the current deprecation docs are a bit misleading by saying
> -usbdevice is directly mapped to -device.
> 
>> So we might need a new "sugared" option like "-braille" instead before we
>> can fully remove -usbdevice? ... or we just keep -usbdevice as a bittersweet
>> remainder?
> 
> I'm not going to implement new CLI options, and if that's needed, we
> ought to re-start the clock on the deprecation at that point. So this
> points towards just removing the deprecation warning that exists
> today. Or alternatively drop support for -usbdevice, except for the
> braille type.

After that discussion in 2018, I've removed all of the "annoying" -usbdevice 
parameters already (see commit 99761176eeaf8525). I then more or less waited 
for someone to step up and implement "-braille", but it never happened and I 
forgot about the removal of the remaining -usbdevice parameters. Thinking 
about this again, replacing "-usbdevice braille" with a "-braille usb" does 
indeed not buy us much, so I think the best is maybe to keep the simple 
devices and braille around, update our documentation and remove the 
deprecation warning instead.

  Thomas
diff mbox series

Patch

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index 611adf60f7..c577cc97c4 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/docs/system/removed-features.rst b/docs/system/removed-features.rst
index dc63581fe5..74d022babf 100644
--- a/docs/system/removed-features.rst
+++ b/docs/system/removed-features.rst
@@ -50,6 +50,15 @@  by the ``tls-authz`` and ``sasl-authz`` options.
 The ``pretty=on|off`` switch has no effect for HMP monitors and
 its use is rejected.
 
+``-usbdevice`` (removed in 6.0)
+'''''''''''''''''''''''''''''''
+
+The ``-usbdevice DEV`` argument was now a synonym for setting
+the ``-device usb-DEV`` argument instead. The removed syntax
+would automatically enable USB support on the machine type.
+When using the new syntax, USB support must be explicitly
+enabled via the ``-machine usb=on`` argument.
+
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
 
diff --git a/softmmu/vl.c b/softmmu/vl.c
index b219ce1f35..c31061cc09 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -743,34 +743,6 @@  static void configure_msg(QemuOpts *opts)
 }
 
 
-/***********************************************************/
-/* USB devices */
-
-static int usb_device_add(const char *devname)
-{
-    USBDevice *dev = NULL;
-
-    if (!machine_usb(current_machine)) {
-        return -1;
-    }
-
-    dev = usbdevice_create(devname);
-    if (!dev)
-        return -1;
-
-    return 0;
-}
-
-static int usb_parse(const char *cmdline)
-{
-    int r;
-    r = usb_device_add(cmdline);
-    if (r < 0) {
-        error_report("could not add USB device '%s'", cmdline);
-    }
-    return r;
-}
-
 /***********************************************************/
 /* machine registration */
 
@@ -1267,7 +1239,6 @@  static void monitor_parse(const char *optarg, const char *mode, bool pretty)
 
 struct device_config {
     enum {
-        DEV_USB,       /* -usbdevice     */
         DEV_SERIAL,    /* -serial        */
         DEV_PARALLEL,  /* -parallel      */
         DEV_DEBUGCON,  /* -debugcon */
@@ -2484,12 +2455,6 @@  static void qemu_create_cli_devices(void)
     qemu_opts_foreach(qemu_find_opts("fw_cfg"),
                       parse_fw_cfg, fw_cfg_find(), &error_fatal);
 
-    /* init USB devices */
-    if (machine_usb(current_machine)) {
-        if (foreach_device_config(DEV_USB, usb_parse) < 0)
-            exit(1);
-    }
-
     /* init generic devices */
     rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE);
     qemu_opts_foreach(qemu_find_opts("device"),
@@ -3182,13 +3147,6 @@  void qemu_init(int argc, char **argv, char **envp)
                 olist = qemu_find_opts("machine");
                 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);
-                break;
             case QEMU_OPTION_device:
                 if (!qemu_opts_parse_noisily(qemu_find_opts("device"),
                                              optarg, true)) {