Skip to contentSkip to conversation

usb: make devices configurable

PATCH In review Gerd Hoffmann 3 participants 8 messages Feb 1, 2013

lore
Share & tools
lore
#0 lore raw

cover usb: make devices configurable

Hi,

This patch series makes usb devices configurable.

cheers,
Gerd

Gerd Hoffmann (4):
usb: Makefile cleanup
fix scripts/make_device_config.sh
make usb devices configurable
allow disabling usb smartcard support

 default-configs/alpha-softmmu.mak    |    1 +
 default-configs/arm-softmmu.mak      |    1 +
 default-configs/i386-softmmu.mak     |    1 +
 default-configs/m68k-softmmu.mak     |    1 +
 default-configs/mips-softmmu.mak     |    1 +
 default-configs/mips64-softmmu.mak   |    1 +
 default-configs/mips64el-softmmu.mak |    1 +
 default-configs/mipsel-softmmu.mak   |    1 +
 default-configs/ppc-softmmu.mak      |    1 +
 default-configs/ppc64-softmmu.mak    |    1 +
 default-configs/ppcemb-softmmu.mak   |    1 +
 default-configs/sh4-softmmu.mak      |    1 +
 default-configs/sh4eb-softmmu.mak    |    1 +
 default-configs/sparc64-softmmu.mak  |    1 +
 default-configs/usb.mak              |    8 ++++++++
 default-configs/x86_64-softmmu.mak   |    1 +
 hw/Makefile.objs                     |    2 ++
 hw/usb/Makefile.objs                 |   31 ++++++++++++++++++++++++-------
 scripts/make_device_config.sh        |    2 +-
 19 files changed, 50 insertions(+), 8 deletions(-)
 create mode 100644 default-configs/usb.mak
Signature · 1 line
1.7.9.7
#1 lore raw

PATCH 1/4 usb: Makefile cleanup

Group files, sprinkle in some comments.

---
 hw/usb/Makefile.objs |   27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)
hw/usb/Makefile.objs +20 -7
index d1bbbc0..bfe5e5f 100644
@@ -1,14 +1,27 @@
+# usb subsystem core
+common-obj-y += core.o combined-packet.o bus.o desc.o
+common-obj-y += libhw.o
+
+# usb host adapters
 common-obj-$(CONFIG_USB_UHCI) += hcd-uhci.o
 common-obj-$(CONFIG_USB_OHCI) += hcd-ohci.o
 common-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o hcd-ehci-pci.o hcd-ehci-sysbus.o
 common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o
-common-obj-y += libhw.o
 
+# emulated usb devices
+common-obj-y += dev-hub.o
+common-obj-y += dev-hid.o
+common-obj-y += dev-wacom.o
+common-obj-y += dev-storage.o
+common-obj-y += dev-uas.o
+common-obj-y += dev-smartcard-reader.o
+common-obj-y += dev-audio.o
+common-obj-y += dev-serial.o
+common-obj-y += dev-network.o
+common-obj-y += dev-bluetooth.o
+
+# usb redirection
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
 
-common-obj-y += core.o combined-packet.o bus.o desc.o dev-hub.o
-common-obj-y += host-$(HOST_USB).o dev-bluetooth.o
-common-obj-y += dev-hid.o dev-storage.o dev-wacom.o
-common-obj-y += dev-serial.o dev-network.o dev-audio.o
-common-obj-y += dev-smartcard-reader.o
-common-obj-y += dev-uas.o
+# usb pass-through
+common-obj-y += host-$(HOST_USB).o
Signature · 1 line
1.7.9.7
#2 lore raw

PATCH 2/4 fix scripts/make_device_config.sh

In reply to Gerd Hoffmann

Make it handle multiple include statements in a file.

---
 scripts/make_device_config.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/make_device_config.sh +1 -1
index 0778fe2..81fe942 100644
@@ -18,7 +18,7 @@ process_includes () {
 
 f=$src
 while [ -n "$f" ] ; do
-  f=`tr -d '\r' < $f | awk '/^include / {printf "'$src_dir'/%s", $2}'`
+  f=`cat $f | tr -d '\r' | awk '/^include / {printf "'$src_dir'/%s ", $2}'`
   [ $? = 0 ] || exit 1
   all_includes="$all_includes $f"
 done
Signature · 1 line
1.7.9.7
#3 lore raw

Re: [Qemu-devel] [PATCH 2/4] fix scripts/make_device_config.sh

Am 01.02.2013 13:00, schrieb Gerd Hoffmann:

Quoted 12 lines

Make it handle multiple include statements in a file.

---
 scripts/make_device_config.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/make_device_config.sh +0 -0
index 0778fe2..81fe942 100644

scripts/make_device_config.sh process_includes () { · line 24

Quoted 8 lines
scripts/make_device_config.sh +1 -1
@@ -18,7 +18,7 @@ process_includes () {
 
 f=$src
 while [ -n "$f" ] ; do
-  f=`tr -d '\r' < $f | awk '/^include / {printf "'$src_dir'/%s", $2}'`
+  f=`cat $f | tr -d '\r' | awk '/^include / {printf "'$src_dir'/%s ", $2}'`
   [ $? = 0 ] || exit 1
   all_includes="$all_includes $f"
 done

The actual fix is appending a space? Or how does cat make a difference?

Cheers,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw

Re: [Qemu-devel] [PATCH 2/4] fix scripts/make_device_config.sh

Quoted 14 lines · Andreas Färber

Am 01.02.2013 13:00, schrieb Gerd Hoffmann:

Quoted 13 lines

Make it handle multiple include statements in a file.

---
 scripts/make_device_config.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/make_device_config.sh +0 -0
index 0778fe2..81fe942 100644
@@ -18,7 +18,7 @@ process_includes () {
 
Quoted 9 lines

scripts/make_device_config.sh process_includes () { · line 24

Quoted 7 lines
scripts/make_device_config.sh +1 -1
 f=$src
 while [ -n "$f" ] ; do
-  f=`tr -d '\r' < $f | awk '/^include / {printf "'$src_dir'/%s", $2}'`
+  f=`cat $f | tr -d '\r' | awk '/^include / {printf "'$src_dir'/%s ", $2}'`
   [ $? = 0 ] || exit 1
   all_includes="$all_includes $f"
 done

The actual fix is appending a space? Or how does cat make a difference?

Both changes are needed.

Without the space you get "pci.makusb.mak" instead of "pci.mak usb.mak" in $f (and $all_includes).

The cat makes sure it still works with two files in $f.

cheers,
Gerd

#5 lore raw

PATCH 3/4 make usb devices configurable

In reply to Gerd Hoffmann

Leave the core usb devices (usb hub, tablet, mouse, keyboard) enabled unconditionally. Make the other ones configurable.

Exceptions:
- bluetooth: not qdevified yet, has a vl.c dependency because of that, thus disabling isn't as easy as not linking the object file.
- smardcard: ccid-card-emulated depends on that one *and* CONFIG_SMARTCARD_NSS. I don't think we have an elegant way to handle that. RfC Makefile hack follows as separate patch.

---
 default-configs/alpha-softmmu.mak    |    1 +
 default-configs/arm-softmmu.mak      |    1 +
 default-configs/i386-softmmu.mak     |    1 +
 default-configs/m68k-softmmu.mak     |    1 +
 default-configs/mips-softmmu.mak     |    1 +
 default-configs/mips64-softmmu.mak   |    1 +
 default-configs/mips64el-softmmu.mak |    1 +
 default-configs/mipsel-softmmu.mak   |    1 +
 default-configs/ppc-softmmu.mak      |    1 +
 default-configs/ppc64-softmmu.mak    |    1 +
 default-configs/ppcemb-softmmu.mak   |    1 +
 default-configs/sh4-softmmu.mak      |    1 +
 default-configs/sh4eb-softmmu.mak    |    1 +
 default-configs/sparc64-softmmu.mak  |    1 +
 default-configs/usb.mak              |    8 ++++++++
 default-configs/x86_64-softmmu.mak   |    1 +
 hw/usb/Makefile.objs                 |   21 +++++++++++++--------
 17 files changed, 36 insertions(+), 8 deletions(-)
 create mode 100644 default-configs/usb.mak
default-configs/alpha-softmmu.mak +1 -0
index 501dd41..2dbee94 100644
@@ -1,6 +1,7 @@
 # Default configuration for alpha-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_SERIAL=y
 CONFIG_I8254=y
 CONFIG_PCKBD=y
default-configs/arm-softmmu.mak +1 -0
index 2f1a5c9..b40f7b0 100644
@@ -1,6 +1,7 @@
 # Default configuration for arm-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_GDBSTUB_XML=y
 CONFIG_VGA=y
 CONFIG_ISA_MMIO=y
default-configs/i386-softmmu.mak +1 -0
index 2c78175..1b23025 100644
@@ -1,6 +1,7 @@
 # Default configuration for i386-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_VGA=y
 CONFIG_VGA_PCI=y
 CONFIG_VGA_ISA=y
default-configs/m68k-softmmu.mak +1 -0
index 3e2ec37..778ea82 100644
@@ -1,5 +1,6 @@
 # Default configuration for m68k-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_GDBSTUB_XML=y
 CONFIG_PTIMER=y
default-configs/mips-softmmu.mak +1 -0
index a271b1c..4f04a33 100644
@@ -1,6 +1,7 @@
 # Default configuration for mips-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_ESP=y
 CONFIG_VGA=y
default-configs/mips64-softmmu.mak +1 -0
index 0510bb6..a5b6c3c 100644
@@ -1,6 +1,7 @@
 # Default configuration for mips64-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_ESP=y
 CONFIG_VGA=y
default-configs/mips64el-softmmu.mak +1 -0
index ed3bed3..a0e6de8 100644
@@ -1,6 +1,7 @@
 # Default configuration for mips64el-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_ESP=y
 CONFIG_VGA=y
default-configs/mipsel-softmmu.mak +1 -0
index fa3a2ca..753dd76 100644
@@ -1,6 +1,7 @@
 # Default configuration for mipsel-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_ESP=y
 CONFIG_VGA=y
default-configs/ppc-softmmu.mak +1 -0
index 1f4a1cf..f9f8a81 100644
@@ -1,6 +1,7 @@
 # Default configuration for ppc-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_GDBSTUB_XML=y
 CONFIG_ISA_MMIO=y
 CONFIG_ESCC=y
default-configs/ppc64-softmmu.mak +1 -0
index 5ff406c..dc44294 100644
@@ -1,6 +1,7 @@
 # Default configuration for ppc64-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_GDBSTUB_XML=y
 CONFIG_ISA_MMIO=y
 CONFIG_ESCC=y
default-configs/ppcemb-softmmu.mak +1 -0
index aaa9cdc..1c6bcf9 100644
@@ -1,6 +1,7 @@
 # Default configuration for ppcemb-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_GDBSTUB_XML=y
 CONFIG_ISA_MMIO=y
 CONFIG_ESCC=y
default-configs/sh4-softmmu.mak +1 -0
index 5c69acc..e08b2ee 100644
@@ -1,6 +1,7 @@
 # Default configuration for sh4-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_SERIAL=y
 CONFIG_PTIMER=y
 CONFIG_PFLASH_CFI02=y
default-configs/sh4eb-softmmu.mak +1 -0
index 7cdc122..3a84535 100644
@@ -1,6 +1,7 @@
 # Default configuration for sh4eb-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_SERIAL=y
 CONFIG_PTIMER=y
 CONFIG_PFLASH_CFI02=y
default-configs/sparc64-softmmu.mak +1 -0
index 03e8b42..2145b6b 100644
@@ -1,6 +1,7 @@
 # Default configuration for sparc64-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_M48T59=y
 CONFIG_PTIMER=y
default-configs/usb.mak new file +8 -0
new file mode 100644
index 0000000..1bf9075
@@ -0,0 +1,8 @@
+CONFIG_USB_TABLET_WACOM=y
+CONFIG_USB_STORAGE_BOT=y
+CONFIG_USB_STORAGE_UAS=y
+CONFIG_USB_SMARTCARD=y
+CONFIG_USB_AUDIO=y
+CONFIG_USB_SERIAL=y
+CONFIG_USB_NETWORK=y
+CONFIG_USB_BLUETOOTH=y
default-configs/x86_64-softmmu.mak +1 -0
index 233a856..3392f5a 100644
@@ -1,6 +1,7 @@
 # Default configuration for x86_64-softmmu
 
 include pci.mak
+include usb.mak
 CONFIG_VGA=y
 CONFIG_VGA_PCI=y
 CONFIG_VGA_ISA=y
hw/usb/Makefile.objs +13 -8
index bfe5e5f..3fb1396 100644
@@ -11,14 +11,19 @@ common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o
 # emulated usb devices
 common-obj-y += dev-hub.o
 common-obj-y += dev-hid.o
-common-obj-y += dev-wacom.o
-common-obj-y += dev-storage.o
-common-obj-y += dev-uas.o
-common-obj-y += dev-smartcard-reader.o
-common-obj-y += dev-audio.o
-common-obj-y += dev-serial.o
-common-obj-y += dev-network.o
-common-obj-y += dev-bluetooth.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
+common-obj-$(CONFIG_USB_AUDIO)        += dev-audio.o
+common-obj-$(CONFIG_USB_SERIAL)       += dev-serial.o
+common-obj-$(CONFIG_USB_NETWORK)      += dev-network.o
+
+# FIXME: make configurable too
+CONFIG_USB_BLUETOOTH := y
+CONFIG_USB_SMARTCARD := y
+common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
+common-obj-$(CONFIG_USB_SMARTCARD)    += dev-smartcard-reader.o
+
 
 # usb redirection
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
Signature · 1 line
1.7.9.7
#6 lore raw

Re: [Qemu-devel] [PATCH 3/4] make usb devices configurable

Il 01/02/2013 13:00, Gerd Hoffmann ha scritto:

Quoted 4 lines

- smardcard: ccid-card-emulated depends on that one *and* CONFIG_SMARTCARD_NSS. I don't think we have an elegant way to handle that. RfC Makefile hack follows as separate patch.

Yes, your 4/4 is how it is done in other places.

Paolo

#7 lore raw

PATCH 4/4 allow disabling usb smartcard support

In reply to Gerd Hoffmann
---
 hw/Makefile.objs     |    2 ++
 hw/usb/Makefile.objs |    1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
hw/Makefile.objs +2 -0
index 447e32a..a1f3a80 100644
@@ -38,8 +38,10 @@ common-obj-$(CONFIG_DMA) += dma.o
 common-obj-$(CONFIG_I82374) += i82374.o
 common-obj-$(CONFIG_HPET) += hpet.o
 common-obj-$(CONFIG_APPLESMC) += applesmc.o
+ifeq ($(CONFIG_USB_SMARTCARD),y)
 common-obj-y += ccid-card-passthru.o
 common-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o
+endif
 common-obj-$(CONFIG_I8259) += i8259_common.o i8259.o
 common-obj-y += fifo.o
 common-obj-y += pam.o
hw/usb/Makefile.objs +0 -1
index 3fb1396..be43366 100644
@@ -20,7 +20,6 @@ common-obj-$(CONFIG_USB_NETWORK)      += dev-network.o
 
 # FIXME: make configurable too
 CONFIG_USB_BLUETOOTH := y
-CONFIG_USB_SMARTCARD := y
 common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
 common-obj-$(CONFIG_USB_SMARTCARD)    += dev-smartcard-reader.o
 
Signature · 1 line
1.7.9.7