diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2011-02-22 11:55:59 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2011-02-22 11:55:59 +0000 |
commit | b608abdf297b96b690dcddec3b1cb8639c71453e (patch) | |
tree | ef3bd71fae146d42a9d72d9577d8dff9708253f2 /sys-apps/pcsc-lite | |
parent | Use correct slot dependencies for gtk+ and gtkmm. (diff) | |
download | gentoo-2-b608abdf297b96b690dcddec3b1cb8639c71453e.tar.gz gentoo-2-b608abdf297b96b690dcddec3b1cb8639c71453e.tar.bz2 gentoo-2-b608abdf297b96b690dcddec3b1cb8639c71453e.zip |
Add patch from upstream and me to avoid a feature regression with libusb.
(Portage version: 2.2.0_alpha24/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/pcsc-lite')
-rw-r--r-- | sys-apps/pcsc-lite/ChangeLog | 9 | ||||
-rw-r--r-- | sys-apps/pcsc-lite/files/pcsc-lite-1.6.6-libusb-multiinterface.patch | 174 | ||||
-rw-r--r-- | sys-apps/pcsc-lite/pcsc-lite-1.6.6-r1.ebuild | 84 |
3 files changed, 266 insertions, 1 deletions
diff --git a/sys-apps/pcsc-lite/ChangeLog b/sys-apps/pcsc-lite/ChangeLog index 96ac454a198b..f846187d9b6f 100644 --- a/sys-apps/pcsc-lite/ChangeLog +++ b/sys-apps/pcsc-lite/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-apps/pcsc-lite # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/pcsc-lite/ChangeLog,v 1.103 2011/01/10 18:51:08 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/pcsc-lite/ChangeLog,v 1.104 2011/02/22 11:55:59 flameeyes Exp $ + +*pcsc-lite-1.6.6-r1 (22 Feb 2011) + + 22 Feb 2011; Diego E. Pettenò <flameeyes@gentoo.org> + +pcsc-lite-1.6.6-r1.ebuild, + +files/pcsc-lite-1.6.6-libusb-multiinterface.patch: + Add patch from upstream and me to avoid a feature regression with libusb. 10 Jan 2011; Diego E. Pettenò <flameeyes@gentoo.org> -pcsc-lite-1.6.1.ebuild, -files/pcscd-confd, -files/pcscd-init, diff --git a/sys-apps/pcsc-lite/files/pcsc-lite-1.6.6-libusb-multiinterface.patch b/sys-apps/pcsc-lite/files/pcsc-lite-1.6.6-libusb-multiinterface.patch new file mode 100644 index 000000000000..70fce453ca98 --- /dev/null +++ b/sys-apps/pcsc-lite/files/pcsc-lite-1.6.6-libusb-multiinterface.patch @@ -0,0 +1,174 @@ +From 5b274f9da45174a444f9e1fe8917862680ea0c2c Mon Sep 17 00:00:00 2001 +From: rousseau <rousseau@0ce88b0d-b2fd-0310-8134-9614164e65ea> +Date: Mon, 21 Feb 2011 15:05:38 +0000 +Subject: [PATCH] If a device has more than one CCID interface the "libhal:" naming scheme + (with the interface number included) is used instead of "libusb:". +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The new mechanism allows to use multi-interfaces devices like the +Gemalto ProxDU also with hotplug_libusb. libhal is deprecated and may +not be available everywhere. + +Thanks to Diego Elio Pettenò for the patch (for Gentoo) + + +git-svn-id: svn://svn.debian.org/pcsclite/trunk/PCSC@5621 0ce88b0d-b2fd-0310-8134-9614164e65ea +--- + src/hotplug_libusb.c | 88 ++++++++++++++++++++++++++++++++++---------------- + 1 files changed, 60 insertions(+), 28 deletions(-) + +diff --git a/src/hotplug_libusb.c b/src/hotplug_libusb.c +index f7625ba..772d9e0 100644 +--- a/src/hotplug_libusb.c ++++ b/src/hotplug_libusb.c +@@ -47,8 +47,8 @@ + #undef DEBUG_HOTPLUG + #define ADD_SERIAL_NUMBER + +-/* format is "%d:%d", bus_number, device_address */ +-#define BUS_DEVICE_STRSIZE 10+1+10+1 ++/* format is "%d:%d:%d", bus_number, device_address, interface */ ++#define BUS_DEVICE_STRSIZE 10+1+10+1+10+1 + + #define READER_ABSENT 0 + #define READER_PRESENT 1 +@@ -98,7 +98,8 @@ static struct _readerTracker + + static LONG HPAddHotPluggable(struct libusb_device *dev, + struct libusb_device_descriptor desc, +- const char bus_device[], struct _driverTracker *driver); ++ const char bus_device[], int interface, ++ struct _driverTracker *driver); + static LONG HPRemoveHotPluggable(int reader_index); + + static LONG HPReadBundleValues(void) +@@ -276,6 +277,7 @@ static void HPRescanUsbBus(void) + while ((dev = devs[cnt++]) != NULL) + { + struct libusb_device_descriptor desc; ++ struct libusb_config_descriptor *config_desc; + uint8_t bus_number = libusb_get_bus_number(dev); + uint8_t device_address = libusb_get_device_address(dev); + +@@ -287,6 +289,14 @@ static void HPRescanUsbBus(void) + continue; + } + ++ r = libusb_get_active_config_descriptor(dev, &config_desc); ++ if (r < 0) ++ { ++ Log3(PCSC_LOG_ERROR, "failed to get device config for %d/%d", ++ bus_number, device_address); ++ continue; ++ } ++ + /* check if the device is supported by one driver */ + for (i=0; i<driverSize; i++) + { +@@ -294,38 +304,53 @@ static void HPRescanUsbBus(void) + desc.idVendor == driverTracker[i].manuID && + desc.idProduct == driverTracker[i].productID) + { +- int newreader; ++ int interface; + +- /* A known device has been found */ +- snprintf(bus_device, BUS_DEVICE_STRSIZE, "%d:%d", +- bus_number, device_address); +- bus_device[BUS_DEVICE_STRSIZE - 1] = '\0'; + #ifdef DEBUG_HOTPLUG +- Log2(PCSC_LOG_DEBUG, "Found matching USB device: %s", +- bus_device); ++ Log3(PCSC_LOG_DEBUG, "Found matching USB device: %d:%d", ++ bus_number, device_address); + #endif +- newreader = TRUE; + +- /* Check if the reader is a new one */ +- for (j=0; j<PCSCLITE_MAX_READERS_CONTEXTS; j++) ++ for (interface = 0; interface < config_desc->bNumInterfaces; ++ interface++) + { +- if (strncmp(readerTracker[j].bus_device, +- bus_device, BUS_DEVICE_STRSIZE) == 0) ++ int newreader; ++ ++ /* A known device has been found */ ++ snprintf(bus_device, BUS_DEVICE_STRSIZE, "%d:%d:%d", ++ bus_number, device_address, interface); ++ bus_device[BUS_DEVICE_STRSIZE - 1] = '\0'; ++ newreader = TRUE; ++ ++ /* Check if the reader is a new one */ ++ for (j=0; j<PCSCLITE_MAX_READERS_CONTEXTS; j++) + { +- /* The reader is already known */ +- readerTracker[j].status = READER_PRESENT; +- newreader = FALSE; ++ if (strncmp(readerTracker[j].bus_device, ++ bus_device, BUS_DEVICE_STRSIZE) == 0) ++ { ++ /* The reader is already known */ ++ readerTracker[j].status = READER_PRESENT; ++ newreader = FALSE; + #ifdef DEBUG_HOTPLUG +- Log2(PCSC_LOG_DEBUG, "Refresh USB device: %s", +- bus_device); ++ Log2(PCSC_LOG_DEBUG, "Refresh USB device: %s", ++ bus_device); + #endif +- break; ++ break; ++ } + } +- } + +- /* New reader found */ +- if (newreader) +- HPAddHotPluggable(dev, desc, bus_device, &driverTracker[i]); ++ /* New reader found */ ++ if (newreader) ++ { ++ printf("POUET %d\n", config_desc->bNumInterfaces); ++ if (config_desc->bNumInterfaces > 1) ++ HPAddHotPluggable(dev, desc, bus_device, ++ interface, &driverTracker[i]); ++ else ++ HPAddHotPluggable(dev, desc, bus_device, ++ -1, &driverTracker[i]); ++ } ++ } + } + } + } +@@ -470,15 +495,22 @@ LONG HPStopHotPluggables(void) + + static LONG HPAddHotPluggable(struct libusb_device *dev, + struct libusb_device_descriptor desc, +- const char bus_device[], struct _driverTracker *driver) ++ const char bus_device[], int interface, ++ struct _driverTracker *driver) + { + int i; + char deviceName[MAX_DEVICENAME]; + + Log2(PCSC_LOG_INFO, "Adding USB device: %s", bus_device); + +- snprintf(deviceName, sizeof(deviceName), "usb:%04x/%04x:libusb-1.0:%s", +- desc.idVendor, desc.idProduct, bus_device); ++ if (interface >= 0) ++ snprintf(deviceName, sizeof(deviceName), "usb:%04x/%04x:libhal:/org/freedesktop/Hal/devices/usb_device_%04x_%04x_serialnotneeded_if%d", ++ desc.idVendor, desc.idProduct, desc.idVendor, desc.idProduct, ++ interface); ++ else ++ snprintf(deviceName, sizeof(deviceName), "usb:%04x/%04x:libusb-1.0:%s", ++ desc.idVendor, desc.idProduct, bus_device); ++ + deviceName[sizeof(deviceName) -1] = '\0'; + + pthread_mutex_lock(&usbNotifierMutex); +-- +1.7.4.1 + diff --git a/sys-apps/pcsc-lite/pcsc-lite-1.6.6-r1.ebuild b/sys-apps/pcsc-lite/pcsc-lite-1.6.6-r1.ebuild new file mode 100644 index 000000000000..9bf8d6c4305f --- /dev/null +++ b/sys-apps/pcsc-lite/pcsc-lite-1.6.6-r1.ebuild @@ -0,0 +1,84 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/pcsc-lite/pcsc-lite-1.6.6-r1.ebuild,v 1.1 2011/02/22 11:55:59 flameeyes Exp $ + +EAPI="3" + +inherit multilib eutils + +DESCRIPTION="PC/SC Architecture smartcard middleware library" +HOMEPAGE="http://pcsclite.alioth.debian.org/" + +STUPID_NUM="3479" +MY_P="${PN}-${PV/_/-}" +SRC_URI="http://alioth.debian.org/download.php/${STUPID_NUM}/${MY_P}.tar.bz2" +S="${WORKDIR}/${MY_P}" + +LICENSE="as-is" +SLOT="0" +KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="usb kernel_linux" + +RDEPEND="usb? ( virtual/libusb:1 )" +DEPEND="${RDEPEND} + dev-util/pkgconfig" +RDEPEND="${RDEPEND} + !<app-crypt/ccid-1.4.1-r1 + kernel_linux? ( sys-fs/udev )" + +pkg_setup() { + enewgroup pcscd +} + +src_prepare() { + # upstream deprecates libusb in favour of libhal, but we don't want + # libhal. Problem is that with 1.6.6 release, there is no way for + # multi-interface devices to work without libhal. This patch was + # written by me (Flameeyes) and edited by upstream to support such + # device. I also have one to test. + epatch "${FILESDIR}"/${P}-libusb-multiinterface.patch +} + +src_configure() { + econf \ + --disable-maintainer-mode \ + --disable-dependency-tracking \ + --docdir="/usr/share/doc/${PF}" \ + --enable-usbdropdir="/usr/$(get_libdir)/readers/usb" \ + $(use_enable usb libusb) \ + --disable-libhal +} + +src_install() { + emake DESTDIR="${D}" install || die "emake install failed" + dodoc AUTHORS DRIVERS HELP README SECURITY ChangeLog || die + + newinitd "${FILESDIR}/pcscd-init.3" pcscd || die + + if use kernel_linux; then + insinto /lib/udev/rules.d + doins "${FILESDIR}"/99-pcscd-hotplug.rules || die + fi +} + +pkg_postinst() { + elog "Starting from version 1.6.5, pcsc-lite will start as user nobody in" + elog "the pcscd group, to avoid running as root." + elog "" + elog "This also means you need the newest drivers available so that the" + elog "devices get the proper owner." + elog "" + elog "Furthermore, a conf.d file is no longer installed by default, as" + elog "the default configuration does not require one. If you need to" + elog "pass further options to pcscd, create a file and set the" + elog "EXTRA_OPTS variable." + elog "" + if use kernel_linux; then + elog "HAL support has been dropped by the ebuild; if you want hotplug" + elog "support, that's provided already by UDEV rules; you only need to" + elog "tell the init system to hotplug it, by setting this variable in" + elog "/etc/rc.conf:" + elog "" + elog " rc_hotplug=\"pcscd\"" + fi +} |