- if ($d->{vendorid} && $d->{productid}) {
- push @$devices, '-device', "usb-host$usbbus,vendorid=0x$d->{vendorid},productid=0x$d->{productid}";
- } elsif (defined($d->{hostbus}) && defined($d->{hostport})) {
- push @$devices, '-device', "usb-host$usbbus,hostbus=$d->{hostbus},hostport=$d->{hostport}";
- } elsif ($d->{spice}) {
- # usb redir support for spice, currently no usb3
- push @$devices, '-chardev', "spicevmc,id=usbredirchardev$i,name=usbredir";
- push @$devices, '-device', "usb-redir,chardev=usbredirchardev$i,id=usbredirdev$i,bus=ehci.0";
+ if (defined($d->{host})) {
+ $d = parse_usb_device($d->{host});
+ if (defined($d->{vendorid}) && defined($d->{productid})) {
+ push @$devices, '-device', "usb-host$usbbus,vendorid=0x$d->{vendorid},productid=0x$d->{productid}";
+ } elsif (defined($d->{hostbus}) && defined($d->{hostport})) {
+ push @$devices, '-device', "usb-host$usbbus,hostbus=$d->{hostbus},hostport=$d->{hostport}";
+ } elsif (defined($d->{spice}) && $d->{spice}) {
+ # usb redir support for spice, currently no usb3
+ push @$devices, '-chardev', "spicevmc,id=usbredirchardev$i,name=usbredir";
+ push @$devices, '-device', "usb-redir,chardev=usbredirchardev$i,id=usbredirdev$i,bus=ehci.0";
+ }