Skip to contentSkip to conversation

usb: Use usb_bus_find(-1) instead of usb_enabled() in usb_device_add/usb_device_del

PATCH In review Lin Ma 2 participants 2 messages Jun 4, 2015 – Jun 16, 2015

lore
Share & tools
lore

Lin Ma

author
#0 lore raw

PATCH 1/1 usb: Use usb_bus_find(-1) instead of usb_enabled() in usb_device_add/usb_device_del

Without usb=on machine option, usb_device_add/usb_device_del don't work, Even if there are virtual usb controllers presented.

This patch fixes it.

---
 vl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
vl.c +2 -2
index 1d4c089..26fab83 100644
@@ -1234,7 +1234,7 @@ static int usb_device_add(const char *devname)
     const char *p;
 #endif
 
-    if (!usb_enabled()) {
+    if (!usb_bus_find(-1)) {
         return -1;
     }
 
@@ -1266,7 +1266,7 @@ static int usb_device_del(const char *devname)
         return -1;
     }
 
-    if (!usb_enabled()) {
+    if (!usb_bus_find(-1)) {
         return -1;
     }
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 2 lines · Lin Ma

Without usb=on machine option, usb_device_add/usb_device_del don't work, Even if there are virtual usb controllers presented.

If you use -device to add your usb host controllers, you should likewise use -device (or device_add monitor cmd) to add your usb devices.

-usbdevice is legacy syntax and only there for backward compatibility.

cheers,
Gerd