Skip to contentSkip to conversation

hw/usb: Include USB files only if necessary

PATCH In review Thomas Huth 2 participants 2 messages Mar 17, 2015 – Mar 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/usb: Include USB files only if necessary

Boards that do not include an USB controller should not provide USB devices. However, when running "qemu-system-s390x -device help" for example, there's still a usb-hub, usb-kbd, usb-mouse and usb-tablet in the list of "supported" devices. Let's fix that by compiling and linking the USB files only if it is really necessary.

---
v2:
Everything should now also compile fine again when configure has been run with the --enable-usb-redir and/or --enable-libusb option.

---
 default-configs/arm-softmmu.mak |    1 +
 default-configs/usb.mak         |    1 +
 hw/usb/Makefile.objs            |    8 ++++----
 3 files changed, 6 insertions(+), 4 deletions(-)
default-configs/arm-softmmu.mak +1 -0
index 87d4e34..a767e4b 100644
@@ -32,6 +32,7 @@ CONFIG_DS1338=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_MICRODRIVE=y
+CONFIG_USB=y
 CONFIG_USB_MUSB=y
 CONFIG_USB_EHCI_SYSBUS=y
 CONFIG_PLATFORM_BUS=y
default-configs/usb.mak +1 -0
index 73d8489..f4b8568 100644
@@ -1,3 +1,4 @@
+CONFIG_USB=y
 CONFIG_USB_TABLET_WACOM=y
 CONFIG_USB_STORAGE_BOT=y
 CONFIG_USB_STORAGE_UAS=y
hw/usb/Makefile.objs +4 -4
index 0ccd477..7443e38 100644
@@ -1,6 +1,6 @@
 # usb subsystem core
-common-obj-y += core.o combined-packet.o bus.o desc.o desc-msos.o
-common-obj-y += libhw.o
+common-obj-y += core.o combined-packet.o bus.o libhw.o
+common-obj-$(CONFIG_USB) += desc.o desc-msos.o
 
 # usb host adapters
 common-obj-$(CONFIG_USB_UHCI) += hcd-uhci.o
@@ -11,8 +11,8 @@ common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o
 common-obj-$(CONFIG_USB_MUSB) += hcd-musb.o
 
 # emulated usb devices
-common-obj-y += dev-hub.o
-common-obj-y += dev-hid.o
+common-obj-$(CONFIG_USB) += dev-hub.o
+common-obj-$(CONFIG_USB) += dev-hid.o
 common-obj-$(CONFIG_USB_TABLET_WACOM) += dev-wacom.o
 common-obj-$(CONFIG_USB_STORAGE_BOT)  += dev-storage.o
 common-obj-$(CONFIG_USB_STORAGE_UAS)  += dev-uas.o
Signature · 1 line
1.7.1
#1 lore raw
Quoted 2 lines · Thomas Huth

Everything should now also compile fine again when configure has been run with the --enable-usb-redir and/or --enable-libusb option.

Survived test now. Added to usb queue.

thanks,
Gerd