diff mbox

[v2,1/2] pcsc-lite: new package

Message ID 1348059150-32601-1-git-send-email-waldemar.rymarkiewicz@tieto.com
State Superseded
Headers show

Commit Message

Waldemar Rymarkiewicz Sept. 19, 2012, 12:52 p.m. UTC
Middleware to access a smart card using SCard API (PC/SC).

http://pcsclite.alioth.debian.org/

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
---
 package/Config.in              |    1 +
 package/pcsc-lite/Config.in    |   24 ++++++++++++++++++++++++
 package/pcsc-lite/pcsc-lite.mk |   34 ++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+)
 create mode 100644 package/pcsc-lite/Config.in
 create mode 100644 package/pcsc-lite/pcsc-lite.mk

Comments

Thomas Petazzoni Sept. 19, 2012, 2:47 p.m. UTC | #1
Dear Waldemar Rymarkiewicz,

On Wed, 19 Sep 2012 14:52:29 +0200, Waldemar Rymarkiewicz wrote:
> +# libudev has a priority over libusb
> +ifneq ($(BR2_PACKAGE_UDEV),y)
> +PCSC_LITE_CONF_OPT += --disable-libudev
> +
> +ifeq ($(BR2_PACKAGE_LIBUSB),y)
> +PCSC_LITE_CONF_OPT += --enable-libusb
> +PCSC_LITE_DEPENDENCIES += libusb
> +else
> +PCSC_LITE_CONF_OPT += --disable-libusb
> +endif
> +
> +endif

Can you detail this? I haven't looked at pcsc-lite itself, but this
looks strange. So if it is correct, it anyway needs a more detailed
comment.

Why when udev is available you don't do need libusb? Also, if udev is
available, you need to add it to the list of dependencies.

Thomas
Arnout Vandecappelle Sept. 19, 2012, 8:41 p.m. UTC | #2
On 09/19/12 14:52, Waldemar Rymarkiewicz wrote:
[snip]
> +config BR2_PACKAGE_PCSC_LITE_DEBUGART

  _DEBUGATR, not ART

> +	bool "enable ATR debug messages"
> +	help
> +	  enable ATR debug messages from pcscd
> +
> +config BR2_PACKAGE_PCSC_LITE_EMBEDDED
> +	bool "enable embedded mode"
> +	help
> +	  limit RAM and CPU ressources by disabling features (log)

  resources (one s)


  Regards,
  Arnout
[snip]
Waldemar Rymarkiewicz Sept. 20, 2012, 6:10 a.m. UTC | #3
Hi Thomas,

>> +# libudev has a priority over libusb
>> +ifneq ($(BR2_PACKAGE_UDEV),y)
>> +PCSC_LITE_CONF_OPT += --disable-libudev
>> +
>> +ifeq ($(BR2_PACKAGE_LIBUSB),y)
>> +PCSC_LITE_CONF_OPT += --enable-libusb
>> +PCSC_LITE_DEPENDENCIES += libusb
>> +else
>> +PCSC_LITE_CONF_OPT += --disable-libusb
>> +endif
>> +
>> +endif
>
>Can you detail this? I haven't looked at pcsc-lite itself, but this
>looks strange. So if it is correct, it anyway needs a more detailed
>comment.
>
>Why when udev is available you don't do need libusb? Also, if udev is
>available, you need to add it to the list of dependencies.

This is how pcsc-lite  ./configure  works. 

Firstly, libudev and libusb can't be used together. That means if you --enable-libusb you have to --disable-libudev (by default is enabled) explicitly.

Secondly,  ./configure gives priority to libudev to be used if found, otherwise it searches for libusb.

Finally, Neither libusb nor libudev can be found then no usb devices are used (serial only). Then --disable-libudev --disable-libusb will still compile. 

The only concern I have now it that user has to know this dependencies and select libusb or libudev explicitly. So wandering if not to require libusb or libudev in this package. What's your opinion?

Thanks,
/Waldek
Waldemar Rymarkiewicz Sept. 20, 2012, 6:12 a.m. UTC | #4
Hi Arnout,

>  _DEBUGATR, not ART

Right!. Fixed.

>> +	  limit RAM and CPU ressources by disabling features (log)
>  resources (one s)
Fixed as well.

Thanks,
/Waldek
Samuel Martin Sept. 20, 2012, 7:36 a.m. UTC | #5
Hi Waldemar,

2012/9/20  <Waldemar.Rymarkiewicz@tieto.com>:
[...]
> Firstly, libudev and libusb can't be used together. That means if you --enable-libusb you have to --disable-libudev (by default is enabled) explicitly.
>
> Secondly,  ./configure gives priority to libudev to be used if found, otherwise it searches for libusb.
>
> Finally, Neither libusb nor libudev can be found then no usb devices are used (serial only). Then --disable-libudev --disable-libusb will still compile.
>
> The only concern I have now it that user has to know this dependencies and select libusb or libudev explicitly. So wandering if not to require libusb or libudev in this package. What's your opinion?

If i don't misunderstand, here, the dependency can be explicitly
express as a choice in the menuconfig:

choice BR2_PACKAGE_PCSC_LITE_HWLIBS
  prompt "hardware access/detection" # or whatever more suitable
  default BR2_PACKAGE_PCSC_LITE_HWLIBS_LIBUDEV
config BR2_PACKAGE_PCSC_LITE_HWLIBS_NONE
  bool "none"
config BR2_PACKAGE_PCSC_LITE_HWLIBS_LIBUSB
  bool "libusb"
  select BR2_PACKAGE_LIBUSB
config BR2_PACKAGE_PCSC_LITE_HWLIBS_LIBUDEV
  bool "libudev"
  select BR2_PACKAGE_UDEV
endchoice

Then, it is easy to know in the *.mk file which support should be enabled.

Note:
While writing this, I'm also wondering if the dependency on udev may
be conditioned by the device management chosen.


Regards,
Waldemar Rymarkiewicz Sept. 20, 2012, 8:01 a.m. UTC | #6
Hi Sam,

>choice BR2_PACKAGE_PCSC_LITE_HWLIBS
>  prompt "hardware access/detection" # or whatever more suitable
>  default BR2_PACKAGE_PCSC_LITE_HWLIBS_LIBUDEV
>config BR2_PACKAGE_PCSC_LITE_HWLIBS_NONE
>  bool "none"
>config BR2_PACKAGE_PCSC_LITE_HWLIBS_LIBUSB
>  bool "libusb"
>  select BR2_PACKAGE_LIBUSB
>config BR2_PACKAGE_PCSC_LITE_HWLIBS_LIBUDEV
>  bool "libudev"
>  select BR2_PACKAGE_UDEV
>endchoice

That's the option. Thx. 

Thanks,
/Waldek
Arnout Vandecappelle Sept. 20, 2012, 9:27 a.m. UTC | #7
On 09/20/12 08:10, Waldemar.Rymarkiewicz@tieto.com wrote:
>> >Why when udev is available you don't do need libusb? Also, if udev is
>> >available, you need to add it to the list of dependencies.
> This is how pcsc-lite  ./configure  works.
>
> Firstly, libudev and libusb can't be used together. That means if you --enable-libusb you have to --disable-libudev (by default is enabled) explicitly.
>
> Secondly,  ./configure gives priority to libudev to be used if found, otherwise it searches for libusb.
>
> Finally, Neither libusb nor libudev can be found then no usb devices are used (serial only). Then --disable-libudev --disable-libusb will still compile.

  In that case, it should be:

if UDEV=y
    --enable-libudev --disable-libusb
    DEPS += udev
else
if LIBUSB=y
    --enable-libusb --disable-libudev
    DEPS += libusb
else
    --disable-libusb --disable-libudev
endif
endif

  This gives buildroot complete control over the process.  We generally want
explicit --enable and --disable options, to avoid accidents with forgotten
dependencies (they would mean that the compilation result is dependent on
the order in which things are compiled, and we want to avoid that at all
cost).


> The only concern I have now it that user has to know this dependencies and select libusb or libudev explicitly. So wandering if not to require libusb or libudev in this package. What's your opinion?

  udev _has_ to be selected explicitly - it's consequences are too far-reaching to allow
selecting it behind the scenes, IMHO.

  For libusb, you could add a config option in PCSC to force enabling of
libusb.  Make that option 'depends on !BR2_PACKAGE_UDEV' because it isn't
needed if udev exists.

  Regards,
  Arnout
Thomas Petazzoni Sept. 20, 2012, 10:22 a.m. UTC | #8
Dear Waldemar Rymarkiewicz,

On Thu, 20 Sep 2012 09:10:26 +0300, Waldemar.Rymarkiewicz@tieto.com
wrote:

> >Why when udev is available you don't do need libusb? Also, if udev is
> >available, you need to add it to the list of dependencies.
> 
> This is how pcsc-lite  ./configure  works. 
> 
> Firstly, libudev and libusb can't be used together. That means if you --enable-libusb you have to --disable-libudev (by default is enabled) explicitly.
> 
> Secondly,  ./configure gives priority to libudev to be used if found, otherwise it searches for libusb.
> 
> Finally, Neither libusb nor libudev can be found then no usb devices are used (serial only). Then --disable-libudev --disable-libusb will still compile. 
> 
> The only concern I have now it that user has to know this dependencies and select libusb or libudev explicitly. So wandering if not to require libusb or libudev in this package. What's your opinion?

Samuel and Arnout have replied on the ways to make it possible.

On my side, I'm still surprised that either udev or libusb are needed.
They do really two different things, and I don't see how having udev
can replace what libusb is doing, except if libusb is only used for USB
device enumeration, and not access to the USB devices themselves. But I
haven't looked at the code.

Best regards,

Thomas
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index a4e0b2c..dcc84b6 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -395,6 +395,7 @@  source "package/libusb/Config.in"
 source "package/libusb-compat/Config.in"
 source "package/libv4l/Config.in"
 source "package/mtdev/Config.in"
+source "package/pcsc-lite/Config.in"
 endmenu
 
 menu "Javascript"
diff --git a/package/pcsc-lite/Config.in b/package/pcsc-lite/Config.in
new file mode 100644
index 0000000..94d37c5
--- /dev/null
+++ b/package/pcsc-lite/Config.in
@@ -0,0 +1,24 @@ 
+config BR2_PACKAGE_PCSC_LITE
+	bool "pcsc-lite"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	help
+	  Middleware to accesss smart card using SCard API (PC/SC).
+
+	  http://pcsclite.alioth.debian.org/
+
+if BR2_PACKAGE_PCSC_LITE
+
+config BR2_PACKAGE_PCSC_LITE_DEBUGART
+	bool "enable ATR debug messages"
+	help
+	  enable ATR debug messages from pcscd
+
+config BR2_PACKAGE_PCSC_LITE_EMBEDDED
+	bool "enable embedded mode"
+	help
+	  limit RAM and CPU ressources by disabling features (log)
+
+endif
+
+comment "pcsc-lite needs a toolchain with thread support"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/pcsc-lite/pcsc-lite.mk b/package/pcsc-lite/pcsc-lite.mk
new file mode 100644
index 0000000..2a031e4
--- /dev/null
+++ b/package/pcsc-lite/pcsc-lite.mk
@@ -0,0 +1,34 @@ 
+##########################################################
+#
+# PCSC-Lite
+#
+# ########################################################
+PCSC_LITE_VERSION = 1.8.6
+PCSC_LITE_SOURCE = pcsc-lite-$(PCSC_LITE_VERSION).tar.bz2
+PCSC_LITE_SITE = https://alioth.debian.org/frs/download.php/3757
+PCSC_LITE_INSTALL_STAGING = YES
+PCSC_LITE_DEPENDENCIES = host-pkg-config
+
+# libudev has a priority over libusb
+ifneq ($(BR2_PACKAGE_UDEV),y)
+PCSC_LITE_CONF_OPT += --disable-libudev
+
+ifeq ($(BR2_PACKAGE_LIBUSB),y)
+PCSC_LITE_CONF_OPT += --enable-libusb
+PCSC_LITE_DEPENDENCIES += libusb
+else
+PCSC_LITE_CONF_OPT += --disable-libusb
+endif
+
+endif
+
+ifeq ($(PACKAGE_PCSC_LITE_DEBUGART),y)
+PCSC_LITE_CONF_OPT += --enable-debugatr
+endif
+
+ifeq ($(PACKAGE_PCSC_LITE_EMBEDDED),y)
+PCSC_LITE_CONF_OPT += --enable-embedded
+endif
+
+
+$(eval $(call autotools-package))