diff mbox series

[3/3] package/libnfc: add configs to select which driver to support

Message ID 20191209215923.28945-3-aussedat.louis@gmail.com
State Accepted
Headers show
Series [1/3] configs/friendlyarm_nanopi_neo_plus2: use an extlinux instead of boot.cmd | expand

Commit Message

Louis Aussedat Dec. 9, 2019, 9:59 p.m. UTC
By default, arygon and pn53x_usb are activated,
to keep old configuration.

Signed-off-by: Louis Aussedat <aussedat.louis@gmail.com>
---
 package/libnfc/Config.in | 55 ++++++++++++++++++++++++++++++++++++++--
 package/libnfc/libnfc.mk | 40 +++++++++++++++++++++++++++--
 2 files changed, 91 insertions(+), 4 deletions(-)

Comments

Thomas Petazzoni Dec. 14, 2019, 10:55 p.m. UTC | #1
Hello Louis,

On Mon,  9 Dec 2019 22:59:23 +0100
Louis Aussedat <aussedat.louis@gmail.com> wrote:

> By default, arygon and pn53x_usb are activated,
> to keep old configuration.

I've improved a bit the commit log:

    package/libnfc: add sub-options to enable individual drivers
    
    Until now, the arygon and pn53x_usb were unconditionally enabled, and
    there were no options to choose other drivers. Therefore, we had
    sub-options for each individual driver, keeping arygon and pn53x_usb
    enabled by default to preserve backward compatibility.
    
    Also, due to this, the BR2_TOOLCHAIN_HAS_THREADS dependency on the
    libnfc package is no longer needed, and is only needed for some of the
    sub-options.

Also, see below some comments.

> diff --git a/package/libnfc/Config.in b/package/libnfc/Config.in
> index c8fe251459..9a1c8103ec 100644
> --- a/package/libnfc/Config.in
> +++ b/package/libnfc/Config.in
> @@ -1,8 +1,6 @@
>  config BR2_PACKAGE_LIBNFC
>  	bool "libnfc"
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # libusb

This dependency was no longer needed, as it was due to libusb, so it
has to be moved down to the sub-options that select libusb.

> -	select BR2_PACKAGE_LIBUSB
> -	select BR2_PACKAGE_LIBUSB_COMPAT
>  	help
>  	  Public platform independent Near Field Communication (NFC)
>  	  library.
> @@ -11,6 +9,59 @@ config BR2_PACKAGE_LIBNFC
>  
>  if BR2_PACKAGE_LIBNFC
>  
> +config BR2_PACKAGE_LIBNFC_ACR122_PCSC
> +	bool "acr122_pcsc driver"
> +	default ""

default "" doesn't make much sense for a boolean option, and the
default value for a boolean is to be disabled, so there is nothing to
do. I just removed all default "" lines.

> +	select BR2_PACKAGE_PCSC_LITE

You can't select options like this: you need to replicate their
dependencies.

I fixed up the above issues, and applied to master. Thanks!

Thomas
diff mbox series

Patch

diff --git a/package/libnfc/Config.in b/package/libnfc/Config.in
index c8fe251459..9a1c8103ec 100644
--- a/package/libnfc/Config.in
+++ b/package/libnfc/Config.in
@@ -1,8 +1,6 @@ 
 config BR2_PACKAGE_LIBNFC
 	bool "libnfc"
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
-	select BR2_PACKAGE_LIBUSB
-	select BR2_PACKAGE_LIBUSB_COMPAT
 	help
 	  Public platform independent Near Field Communication (NFC)
 	  library.
@@ -11,6 +9,59 @@  config BR2_PACKAGE_LIBNFC
 
 if BR2_PACKAGE_LIBNFC
 
+config BR2_PACKAGE_LIBNFC_ACR122_PCSC
+	bool "acr122_pcsc driver"
+	default ""
+	select BR2_PACKAGE_PCSC_LITE
+	help
+	  support for acr112_pcsc driver
+
+config BR2_PACKAGE_LIBNFC_ACR122_USB
+	bool "acr122_usb driver"
+	default ""
+	select BR2_PACKAGE_LIBUSB
+	select BR2_PACKAGE_LIBUSB_COMPAT
+	help
+	  support for acr122_usb driver
+
+config BR2_PACKAGE_LIBNFC_ACR122S
+	bool "acr122s driver"
+	default ""
+	help
+	  support for acr122s driver
+
+config BR2_PACKAGE_LIBNFC_ARYGON
+	bool "arygon driver"
+	default y
+	help
+	  support for arygon driver
+
+config BR2_PACKAGE_LIBNFC_PN532_I2C
+	bool "pn532_i2c driver"
+	default ""
+	help
+	  support for pn532_i2c driver
+
+config BR2_PACKAGE_LIBNFC_PN532_SPI
+	bool "pn532_spi driver"
+	default ""
+	help
+	  support for pn532_spi driver
+
+config BR2_PACKAGE_LIBNFC_PN532_UART
+	bool "pn532_uart driver"
+	default ""
+	help
+	  support for pn532_uart driver
+
+config BR2_PACKAGE_LIBNFC_PN53X_USB
+	bool "pn53x_usb driver"
+	default y
+	select BR2_PACKAGE_LIBUSB
+	select BR2_PACKAGE_LIBUSB_COMPAT
+	help
+	  support for pn53x_usb driver
+
 config BR2_PACKAGE_LIBNFC_EXAMPLES
 	bool "build libnfc examples"
 	select BR2_PACKAGE_READLINE
diff --git a/package/libnfc/libnfc.mk b/package/libnfc/libnfc.mk
index b13fd69d82..ca8700484b 100644
--- a/package/libnfc/libnfc.mk
+++ b/package/libnfc/libnfc.mk
@@ -12,10 +12,46 @@  LIBNFC_LICENSE_FILES = COPYING
 LIBNFC_AUTORECONF = YES
 LIBNFC_INSTALL_STAGING = YES
 
-LIBNFC_DEPENDENCIES = host-pkgconf libusb libusb-compat
+LIBNFC_DEPENDENCIES = host-pkgconf
 
 # N.B. The acr122 driver requires pcsc-lite.
-LIBNFC_CONF_OPTS = --with-drivers=arygon,pn53x_usb
+ifeq ($(BR2_PACKAGE_LIBNFC_ACR122_PCSC),y)
+LIBNFC_DRIVER_LIST += acr122_pcsc
+LIBNFC_DEPENDENCIES += pcsc-lite
+endif
+
+ifeq ($(BR2_PACKAGE_LIBNFC_ACR122_USB),y)
+LIBNFC_DRIVER_LIST += acr122_usb
+LIBNFC_DEPENDENCIES += libusb libusb-compat
+endif
+
+ifeq ($(BR2_PACKAGE_LIBNFC_ACR122S),y)
+LIBNFC_DRIVER_LIST += acr122s
+endif
+
+ifeq ($(BR2_PACKAGE_LIBNFC_ARYGON),y)
+LIBNFC_DRIVER_LIST += arygon
+endif
+
+ifeq ($(BR2_PACKAGE_LIBNFC_PN532_I2C),y)
+LIBNFC_DRIVER_LIST += pn532_i2c
+endif
+
+ifeq ($(BR2_PACKAGE_LIBNFC_PN532_SPI),y)
+LIBNFC_DRIVER_LIST += pn532_spi
+endif
+
+ifeq ($(BR2_PACKAGE_LIBNFC_PN532_UART),y)
+LIBNFC_DRIVER_LIST += pn532_uart
+endif
+
+ifeq ($(BR2_PACKAGE_LIBNFC_PN53X_USB),y)
+LIBNFC_DRIVER_LIST += pn53x_usb
+LIBNFC_DEPENDENCIES += libusb libusb-compat
+endif
+
+LIBNFC_CONF_OPTS = \
+	--with-drivers=$(subst $(space),$(comma),$(strip $(LIBNFC_DRIVER_LIST)))
 
 ifeq ($(BR2_PACKAGE_LIBNFC_EXAMPLES),y)
 LIBNFC_CONF_OPTS += --enable-example