Skip to contentSkip to conversation

pcsc-lite: new package

PATCH Superseded Waldemar Rymarkiewicz 4 participants 12 messages Sep 19, 2012 – Sep 20, 2012

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 pcsc-lite: new package

Middleware to access a smart card using SCard API (PC/SC).

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

---
 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
package/Config.in +1 -0
index a4e0b2c..dcc84b6 100644
@@ -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"
package/pcsc-lite/Config.in new file +24 -0
new file mode 100644
index 0000000..94d37c5
@@ -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
package/pcsc-lite/pcsc-lite.mk new file +34 -0
new file mode 100644
index 0000000..2a031e4
@@ -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))
Signature · 1 line
1.7.10
#1 lore raw

PATCH v2 2/2 ccid: new package

PC/SC driver for USB CCID smart card readers.

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

---
 package/Config.in      |    1 +
 package/ccid/Config.in |   11 +++++++++++
 package/ccid/ccid.mk   |   19 +++++++++++++++++++
 3 files changed, 31 insertions(+)
 create mode 100644 package/ccid/Config.in
 create mode 100644 package/ccid/ccid.mk
package/Config.in +1 -0
index dcc84b6..a0fb593 100644
@@ -382,6 +382,7 @@ source "package/zxing/Config.in"
 endmenu
 
 menu "Hardware handling"
+source "package/ccid/Config.in"
 source "package/libaio/Config.in"
 source "package/libraw1394/Config.in"
 source "package/tslib/Config.in"
package/ccid/Config.in new file +11 -0
new file mode 100644
index 0000000..d67bc0e
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_CCID
+	bool "ccid"
+	select BR2_PACKAGE_PCSC_LITE
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	help
+	  PC/SC driver for USB CCID smart card readers
+
+	  http://pcsclite.alioth.debian.org/ccid.html
+
+comment "ccid needs a toolchain with thread support"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/ccid/ccid.mk new file +19 -0
new file mode 100644
index 0000000..cb59451
@@ -0,0 +1,19 @@
+##########################################################
+#
+# CCID
+#
+# ########################################################
+CCID_VERSION = 1.4.7
+CCID_SOURCE = ccid-$(CCID_VERSION).tar.bz2
+CCID_SITE = https://alioth.debian.org/frs/download.php/3730
+CCID_INSTALL_STAGING = YES
+CCID_DEPENDENCIES = pcsc-lite host-pkg-config
+
+ifeq ($(BR2_PACKAGE_LIBUSB),y)
+CCID_CONF_OPT += --enable-libusb
+CCID_DEPENDENCIES += libusb
+else
+CCID_CONF_OPT += --disable-libusb
+endif
+
+$(eval $(call autotools-package))
Signature · 1 line
1.7.10
#2 lore raw

PATCH v2 2/2 ccid: new package

Quoted 1 line · Waldemar Rymarkiewicz

PC/SC driver for USB CCID smart card readers.

[snip]

package/ccid/ccid.mk line 19

Quoted 8 lines
package/ccid/ccid.mk new file +8 -0
+ifeq ($(BR2_PACKAGE_LIBUSB),y)
+CCID_CONF_OPT += --enable-libusb
+CCID_DEPENDENCIES += libusb
+else
+CCID_CONF_OPT += --disable-libusb
+endif
+
+$(eval $(call autotools-package))

I just build-tested on a config without libusb, and it doesn't seem
to install anything. The examples are compiled (not installed), but I doubt they're useful for anything without the ccid plugin.

So maybe it's better to select libusb after all.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH v2 2/2 ccid: new package

Arnout,

Quoted 14 lines

[snip]

package/ccid/ccid.mk line 19

Quoted 8 lines
package/ccid/ccid.mk new file +8 -0
+ifeq ($(BR2_PACKAGE_LIBUSB),y)
+CCID_CONF_OPT += --enable-libusb
+CCID_DEPENDENCIES += libusb
+else
+CCID_CONF_OPT += --disable-libusb
+endif
+
+$(eval $(call autotools-package))

I just build-tested on a config without libusb, and it doesn't seem
to install anything. The examples are compiled (not installed), but I doubt they're useful for anything without the ccid plugin.

Quoted 1 line

So maybe it's better to select libusb after all.

You are right. I missed that.

It seems that ccid itself is broken and this option does not work as supposed so I will require libusb then.

Thanks,
/Waldek

#4 lore raw

PATCH v2 1/2 pcsc-lite: new package

In reply to Waldemar Rymarkiewicz

Dear Waldemar Rymarkiewicz,

package/pcsc-lite/pcsc-lite.mk line 23

Quoted 12 lines · Waldemar Rymarkiewicz
package/pcsc-lite/pcsc-lite.mk new file +12 -0
+# 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

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH v2 1/2 pcsc-lite: new package

Hi Thomas,

Quoted 17 lines

package/pcsc-lite/pcsc-lite.mk line 23

Quoted 12 lines
package/pcsc-lite/pcsc-lite.mk new file +12 -0
+# 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.

Quoted 2 lines

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

#6 lore raw

PATCH v2 1/2 pcsc-lite: new package

Hi Waldemar,

2012/9/20 <[email protected]>:
[...]

Quoted 7 lines

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,

Signature · 1 line
Sam
#7 lore raw

PATCH v2 1/2 pcsc-lite: new package

Hi Sam,

Quoted 4 lines

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

Quoted 8 lines

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

#8 lore raw

PATCH v2 1/2 pcsc-lite: new package

In reply to Waldemar.Rymarkiewicz at tieto.com
Quoted 9 lines · Waldemar.Rymarkiewicz at tieto.com
Quoted 2 lines
Quoted 2 lines

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).

Quoted 1 line

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

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#9 lore raw

PATCH v2 1/2 pcsc-lite: new package

In reply to Waldemar.Rymarkiewicz at tieto.com

Dear Waldemar Rymarkiewicz,

Quoted 5 lines · Waldemar.Rymarkiewicz at tieto.com
Quoted 2 lines

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.

Quoted 7 lines

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

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#10 lore raw

PATCH v2 1/2 pcsc-lite: new package

In reply to Waldemar Rymarkiewicz

On 09/19/12 14:52, Waldemar Rymarkiewicz wrote:
[snip]

Quoted 1 line

+config BR2_PACKAGE_PCSC_LITE_DEBUGART

_DEBUGATR, not ART

package/pcsc-lite/Config.in line 19

Quoted 8 lines
package/pcsc-lite/Config.in new file +8 -0
+	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]

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#11 lore raw

PATCH v2 1/2 pcsc-lite: new package

Hi Arnout,

Quoted 1 line

_DEBUGATR, not ART

Right!. Fixed.

Quoted 2 lines

package/pcsc-lite/Config.in line 19

Quoted 1 line
package/pcsc-lite/Config.in new file +1 -0
+	  limit RAM and CPU ressources by disabling features (log)

resources (one s)

Fixed as well.

Thanks,
/Waldek