Instead of having two times the check if the USB3 setting needs to be
added to the config string it is now checked at one place only.

If USB3 is checked for a non USB3 device it will be attached to the USB2
root hub of the xhci controller.

Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com>
---

@Thomas: I hope I understood correctly what you suggested[0] cleaning
this a bit up.

[0]: https://pve.proxmox.com/pipermail/pve-devel/2019-September/038758.html
 www/manager6/qemu/USBEdit.js | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/www/manager6/qemu/USBEdit.js b/www/manager6/qemu/USBEdit.js
index 8fc95c99..776908a2 100644
--- a/www/manager6/qemu/USBEdit.js
+++ b/www/manager6/qemu/USBEdit.js
@@ -19,7 +19,7 @@ Ext.define('PVE.qemu.USBInputPanel', {
                    } else if(field.inputValue === 'port') {
                        portfield.setDisabled(!newValue);
                    } else if(field.inputValue === 'spice') {
-                       usb3field.setDisabled(newValue);
+                       usb3field.setDisabled(!newValue);
                    }
                }
            },
@@ -66,14 +66,15 @@ Ext.define('PVE.qemu.USBInputPanel', {
            case 'hostdevice':
            case 'port':
                val = me.down('pveUSBSelector[name=' + type + 
']').getUSBValue();
-               if (!/usb3/.test(val) && me.down('field[name=usb3]').getValue() 
=== true) {
-                   val += ',usb3=1';
-               }
                break;
            default:
                throw "invalid type selected";
        }
 
+       if (values.usb3) {
+           delete values.usb3;
+           val += ',usb3=1';
+       }
        values[me.confid] = val;
        return values;
     },
@@ -131,7 +132,7 @@ Ext.define('PVE.qemu.USBInputPanel', {
                {
                    xtype: 'checkbox',
                    name: 'usb3',
-                   submitValue: false,
+                   inputValue: true,
                    reference: 'usb3',
                    fieldLabel: gettext('Use USB3')
                }
-- 
2.20.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to