Skip to contentSkip to conversation

hw/usb: add configuration flags for emulated and passthru usb smartcard

PATCH Superseded Jon Maloy 3 participants 3 messages Nov 23, 2022 – Nov 24, 2022 Arm/Amlogic Meson SoC support

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jon Maloy

author
#0 lore raw

PATCH 1/1 hw/usb: add configuration flags for emulated and passthru usb smartcard

We add two new configuration flags, USB_SMARTCARD_PASSTHRU and USB_SMARTCARD_EMULATED in order to improve configurability of these two functionalities.

---
 hw/usb/Kconfig     | 12 ++++++++++++
 hw/usb/meson.build |  4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)
hw/usb/Kconfig +12 -0
index ce4f433976..50a82badd6 100644
@@ -108,6 +108,18 @@ config USB_SMARTCARD
     bool
     default y
     depends on USB
+    select USB_SMARTCARD_PASSTHRU
+    select USB_SMARTCARD_EMULATED
+
+config USB_SMARTCARD_PASSTHRU
+    bool
+    default y
+    depends on USB
+
+config USB_SMARTCARD_EMULATED
+    bool
+    default y
+    depends on USB
 
 config USB_STORAGE_MTP
     bool
hw/usb/meson.build +2 -2
index 793df42e21..353006fb6c 100644
@@ -51,8 +51,8 @@ softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reade
 
 if cacard.found()
   usbsmartcard_ss = ss.source_set()
-  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD',
-                      if_true: [cacard, files('ccid-card-emulated.c', 'ccid-card-passthru.c')])
+  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_EMULATED', if_true: [cacard, files('ccid-card-emulated.c')])
+  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_PASSTHRU', if_true: [cacard, files('ccid-card-passthru.c')])
   hw_usb_modules += {'smartcard': usbsmartcard_ss}
 endif
 
Signature · 1 line
2.35.3
#1 lore raw

Hi

Quoted 16 lines · Jon Maloy

We add two new configuration flags, USB_SMARTCARD_PASSTHRU and USB_SMARTCARD_EMULATED in order to improve configurability of these two functionalities.

---
 hw/usb/Kconfig     | 12 ++++++++++++
 hw/usb/meson.build |  4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)
hw/usb/Kconfig +0 -0
index ce4f433976..50a82badd6 100644

hw/usb/Kconfig config USB_SMARTCARD · line 117

Quoted 10 lines
hw/usb/Kconfig +7 -0
@@ -108,6 +108,18 @@ config USB_SMARTCARD
     bool
     default y
     depends on USB
+    select USB_SMARTCARD_PASSTHRU
+    select USB_SMARTCARD_EMULATED
+
+config USB_SMARTCARD_PASSTHRU
+    bool
+    default y
+    depends on USB

Wouldn't this be better instead? (I don't think USB_SMARTCARD should select PASSTHRU & EMULATED, but rather be selected for common shared code)

config USB_SMARTCARD
bool
depends on USB

config USB_SMARTCARD_PASSTHRU
bool
default y
select USB_SMARTCARD

config USB_SMARTCARD_EMULATED
bool
default y
select USB_SMARTCARD

Quoted 27 lines
hw/usb/Kconfig +5 -0
+
+config USB_SMARTCARD_EMULATED
+    bool
+    default y
+    depends on USB
 
 config USB_STORAGE_MTP
     bool
hw/usb/meson.build +2 -3
index 793df42e21..353006fb6c 100644
@@ -51,8 +51,8 @@ softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reade
 
 if cacard.found()
   usbsmartcard_ss = ss.source_set()
-  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD',
-                      if_true: [cacard, files('ccid-card-emulated.c', 'ccid-card-passthru.c')])
+  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_EMULATED', if_true: [cacard, files('ccid-card-emulated.c')])
+  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_PASSTHRU', if_true: [cacard, files('ccid-card-passthru.c')])
   hw_usb_modules += {'smartcard': usbsmartcard_ss}
 endif
 
--

2.35.3

Signature · 1 line
Marc-André Lureau
#2 lore raw

Il mer 23 nov 2022, 08:59 Marc-André Lureau <[email protected]> ha scritto:

Quoted 10 lines

config USB_SMARTCARD_PASSTHRU
bool
default y
select USB_SMARTCARD

config USB_SMARTCARD_EMULATED
bool
default y
select USB_SMARTCARD

Yes, this is the way. (TM)

Also, you should add a "config LIBCACARD" (resp. "CONFIG_LIBCACARD=y") symbol to Kconfig.host and the root meson.build, so that you can make these symbols "depends on CACARD" and remove the "if cacard.found()" below.

Paolo

Quoted 38 lines

hw/usb/meson.build softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true:

Quoted 14 lines
hw/usb/Kconfig +5 -0
+
+config USB_SMARTCARD_EMULATED
+    bool
+    default y
+    depends on USB
 
 config USB_STORAGE_MTP
     bool
hw/usb/meson.build +0 -0
index 793df42e21..353006fb6c 100644
@@ -51,8 +51,8 @@ softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true:

files('dev-smartcard-reade

hw/usb/meson.build softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reade

Quoted 5 lines
hw/usb/meson.build +0 -2
 if cacard.found()
   usbsmartcard_ss = ss.source_set()
-  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD',
-                      if_true: [cacard, files('ccid-card-emulated.c',

'ccid-card-passthru.c')])

hw/usb/meson.build softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: · line 53

Quoted 1 line
hw/usb/meson.build +1 -0
+  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_EMULATED', if_true:

[cacard, files('ccid-card-emulated.c')])

hw/usb/meson.build softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: · line 54

Quoted 1 line
hw/usb/meson.build +1 -0
+  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_PASSTHRU', if_true:

[cacard, files('ccid-card-passthru.c')])

Quoted 7 lines
hw/usb/meson.build +0 -1
   hw_usb_modules += {'smartcard': usbsmartcard_ss}
 endif
 
--

2.35.3

--
Marc-André Lureau