Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
pcscd: libusb_open() failed [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Mon Apr 22, 2013 7:50 pm    Post subject: pcscd: libusb_open() failed [solved] Reply with quote

Hello,

The pcscd daemon has problems to connect my Reiner SCT smardcard reader.
Code:
/etc/init.d/pcscd start
 * Starting PC/SC Daemon ...                                                                                                   [ ok ]

Code:
cat /var/log/messages
...
Apr 25 00:22:20 gentoo2 start-stop-daemon: pam_unix(start-stop-daemon:session): session opened for user pcscd by samo(uid=0)
Apr 25 00:22:20 gentoo2 pcscd: readerfactory.c:1009:RFInitializeReader() Open Port 0x200000 Failed (usb:0c4b/0400:libudev:0:/dev/bus/usb/001/007)
Apr 25 00:22:20 gentoo2 pcscd: readerfactory.c:312:RFAddReader() REINER SCT cyberJack ecom_a (3680486100) init failed.
Apr 25 00:22:20 gentoo2 pcscd: hotplug_libudev.c:384:HPAddDevice() Failed adding USB device: REINER SCT cyberJack ecom_a

Code:
# cat /tmp/cj.log
IFD   :[00006e83]:2013/04/23 22:12:07:936902:[DRIVER]:ifd.cpp:  267: Driver initialized
IFD   :[00006e83]:2013/04/23 22:12:07:936957:[LUN0]:ifd.cpp: 1491: IFDHCreateChannelByName(0, usb:0c4b/0400:libudev:0:/dev/bus/usb/001/004)
COMERR:[00006e83]:2013/04/23 22:12:07:937855:[<USB>]:Using USB implementation 3
COMIN :[00006e83]:2013/04/23 22:12:07:937875:[<USB>]:ausb31.c:  325: Extending AUSB handle as type 3
COMIN :[00006e83]:2013/04/23 22:12:07:938243:[<USB>]:ausb31.c:  345: libusb_open() failed: rv
COMIN :[00006e83]:2013/04/23 22:12:07:938259:[<USB>]:ausb.c:  165: Could not extend as type 3 (-1)
COMERR:[00006e83]:2013/04/23 22:12:07:938278:[<USB>]:Unable to open device
IFD   :[00006e83]:2013/04/23 22:12:07:938290:[LUN0]:ifd.cpp:  591: Unable to connect reader "usb:0c4b/0400:libudev:0:/dev/bus/usb/001/004" (-1)

When I stop the daemon and start the driver directly in the foreground it works:
Code:
# /usr/sbin/pcscd -f
CYBERJACK: Started

Code:
# cat /tmp/cj.log
IFD   :[00006ec0]:2013/04/23 22:25:27:471007:[DRIVER]:ifd.cpp:  267: Driver initialized
IFD   :[00006ec0]:2013/04/23 22:25:27:471057:[LUN0]:ifd.cpp: 1491: IFDHCreateChannelByName(0, usb:0c4b/0400:libudev:0:/dev/bus/usb/001/004)
COMERR:[00006ec0]:2013/04/23 22:25:27:473338:[<USB>]:Using USB implementation 3
COMIN :[00006ec0]:2013/04/23 22:25:27:473368:[<USB>]:ausb31.c:  325: Extending AUSB handle as type 3
COMIN :[00006ec0]:2013/04/23 22:25:27:473766:[<USB>]:ausb.c:  112: ausb_set_configuration
COMERR:[00006ec0]:2013/04/23 22:25:27:473966:[<USB>]:Claim interface
COMIN :[00006ec0]:2013/04/23 22:25:27:474009:[<USB>]:ausb.c:   92: ausb_claim_interface
COMIN :[00006ec0]:2013/04/23 22:25:27:474034:[<USB>]:ausb.c:   81: registering callback:0x7fbc0c73af60
COMIN :[00006ec0]:2013/04/23 22:25:27:474047:[<USB>]:ausb.c:  186: ausb_start_interrupt
COMIN :[00006ec0]:2013/04/23 22:25:27:474058:[<USB>]:ausb31.c:   80: Halting interrupt pipe.
COMERR:[00006ec0]:2013/04/23 22:25:27:475181:[001:004]:USBUnix.cpp:  222: Product: cyberJack Secoder
COMINF:[00006ec0]:2013/04/23 22:25:27:475202:[001:004]:Reader Productstring: [cyberJack Secoder]
COMINF:[00006ec0]:2013/04/23 22:25:27:475220:[001:004]:Recognized device 0400 [cyberJack Secoder]
...
IFD   :[00006ec0]:2013/04/23 22:25:27:480413:[LUN0]:ifd.cpp:  604: Device "usb:0c4b/0400:libudev:0:/dev/bus/usb/001/004" connected
...

I'm using
- pcsc-lite-1.8.6
- cyberjack-3.99.5_p03-r1
Code:
# emerge --info
Portage 2.1.11.55 (default/linux/amd64/13.0/desktop/kde, gcc-4.6.3, glibc-2.15-r3, 3.7.10-gentoo-r1 x86_64)
=================================================================
System uname: Linux-3.7.10-gentoo-r1-x86_64-Intel-R-_Celeron-R-_CPU_G1610_@_2.60GHz-with-gentoo-2.1
KiB Mem:     3911124 total,   1917968 free
KiB Swap:     524284 total,    524284 free
Timestamp of tree: Sun, 21 Apr 2013 21:30:01 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.3-r3, 3.2.3-r2
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=core2 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo"
LANG="de_DE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="64bit X a52 aac acl acpi addressbook akonadi alsa amarok amazon amd64 apache2 audiofile avi berkdb bindist branding bzip2 cairo caps cdda cdr cjk cli consolekit cracklib crypt css cups curl cxx dbus declarative digikam disk-partition dri dts dvb dvd dvdr dvdread embedded emboss encode exif extras fam farstream fbcondecor ffmpeg firefox flac fortran gd gdbm gif gimp gimpprint gnome-keyring gnutls gpg gphoto2 gpm gstreamer gtk2 history hpcups iconv ipv6 jpeg json kate kde kdeenablefinal kerberos kipi lan lcms ldap libkms libnotify libv4l2 libwww llvm mad midi minizip mjpeg mmx mng modules mp3 mp4 mpeg mplayer msn mudflap multilib mysql mythtv ncurses nls nptl nsplugin odbc ogg oggvorbis opengl openmp pam pango pcre pcsc-lite pdf phonon pkcs11 plasma png policykit posix ppds python qt3support qt4 quicktime rdesktop readline reiserfs rtc rtsp samba savedconfig scanner script sdl semantic-desktop session sip sipim slp smartcard sna snmp spell sql sqlite sse sse2 sse3 sse4 ssl startup-notification stream stun subversion svg tcltk tcpd threads threadsafe tiff timidity truetype udev udisks unicode upower usb userlocales v4l v4l2 vcd video vlc vnc vorbis wav webkit winbind wxwidgets x264 xcb xine xml xorg xscreensaver xulrunner xv xvid yahoo zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core authz_host dav dir mime socache_shmcb unixd" APACHE2_MPMS="worker" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de th" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

Does someone know why the daemon fails?
Regards


Last edited by samo on Fri May 03, 2013 7:25 pm; edited 3 times in total
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Wed Apr 24, 2013 9:19 pm    Post subject: Reply with quote

I'm one step further.
Code:
Apr 26 00:36:23 gentoo2 start-stop-daemon: pam_unix(start-stop-daemon:session): session opened for user pcscd by (uid=0)
Apr 26 00:36:23 gentoo2 pcscd: readerfactory.c:1009:RFInitializeReader() Open Port 0x200000 Failed (usb:0c4b/0400:libudev:0:/dev/bus/usb/001/003)
Apr 26 00:36:23 gentoo2 pcscd: readerfactory.c:312:RFAddReader() REINER SCT cyberJack ecom_a (3680486100) init failed.
Apr 26 00:36:23 gentoo2 pcscd: hotplug_libudev.c:384:HPAddDevice() Failed adding USB device: REINER SCT cyberJack ecom_a

Code:
# ls -l /dev/bus/usb/001/003
crw-rw-r-- 1 root usb 189, 2 26. Apr 00:36 /dev/bus/usb/001/003

Code:
Apr 26 00:46:59 gentoo2 start-stop-daemon: pam_unix(start-stop-daemon:session): session opened for user pcscd by thomas(uid=0)

Code:
# /etc/init.d/pcscd start
 * Starting PC/SC Daemon ...                                                                                                                                                            [ ok ]
gentoo2 thomas # cat /tmp/cj.log
IFD   :[000011a6]:2013/04/26 00:46:59:022733:[DRIVER]:ifd.cpp:  267: Driver initialized
IFD   :[000011a6]:2013/04/26 00:46:59:022797:[LUN0]:ifd.cpp: 1491: IFDHCreateChannelByName(0, usb:0c4b/0400:libudev:0:/dev/bus/usb/001/003)
COMERR:[000011a6]:2013/04/26 00:46:59:025356:[<USB>]:Using USB implementation 3
COMIN :[000011a6]:2013/04/26 00:46:59:025388:[<USB>]:ausb31.c:  325: Extending AUSB handle as type 3
COMIN :[000011a6]:2013/04/26 00:46:59:025791:[<USB>]:ausb.c:  112: ausb_set_configuration
COMERR:[000011a6]:2013/04/26 00:46:59:025949:[<USB>]:Claim interface
COMIN :[000011a6]:2013/04/26 00:46:59:025965:[<USB>]:ausb.c:   92: ausb_claim_interface
COMIN :[000011a6]:2013/04/26 00:46:59:025987:[<USB>]:ausb.c:   81: registering callback:0x7fa2d4de4f60
COMIN :[000011a6]:2013/04/26 00:46:59:025999:[<USB>]:ausb.c:  186: ausb_start_interrupt
COMIN :[000011a6]:2013/04/26 00:46:59:026010:[<USB>]:ausb31.c:   80: Halting interrupt pipe.
COMERR:[000011a6]:2013/04/26 00:46:59:027466:[001:003]:USBUnix.cpp:  222: Product: cyberJack Secoder
COMINF:[000011a6]:2013/04/26 00:46:59:027542:[001:003]:Reader Productstring: [cyberJack Secoder]
COMINF:[000011a6]:2013/04/26 00:46:59:027569:[001:003]:Recognized device 0400 [cyberJack Secoder]
...
IFD   :[000011a6]:2013/04/26 00:46:59:032798:[LUN0]:ifd.cpp:  604: Device "usb:0c4b/0400:libudev:0:/dev/bus/usb/001/003" connected
...

Code:
# cat /lib/udev/rules.d/99-pcscd-hotplug.rules
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/pcsc-lite/files/99-pcscd-hotplug.rules,v 1.2 2010/12/05 18:45:32 flameeyes Exp $

# We add this here so that it runs after ccid's and ifd-gempc's rules;
# if we just added a pcscd-owned device, we hotplug the pcscd service.
ACTION=="add", ENV{PCSCD}=="1", GROUP="pcscd", RUN+="/bin/env IN_HOTPLUG=1 /etc/init.d/pcscd --quiet start"

I've copied the rule to /etc/udev/rules.d/99-pcscd-hotplug.rules and modified it as follows:
Code:
ACTION=="add", ENV{PCSCD}=="1", ATTRS{idVendor}=="0c4b", ATTRS{idProduct}=="0400", GROUP="pcscd", RUN+="/bin/env IN_HOTPLUG=1 /etc/init.d/pcscd --quiet start"

But it doesn't work. What did I wrong?


Last edited by samo on Wed Apr 24, 2013 10:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Wed Apr 24, 2013 10:50 pm    Post subject: Reply with quote

I've solved the problem by modifying 92-cyberjack.rules

Code:
# cp /lib/udev/rules.d/92-cyberjack.rules /etc/udev/rules.d/
# nano /etc/udev/rules.d/92-cyberjack.rules

Code:
# If not adding the device, go away
ACTION!="add", GOTO="cyberjack_rules_end"
SUBSYSTEM!="usb", GOTO="cyberjack_rules_end"
ENV{DEVTYPE}!="usb_device", GOTO="cyberjack_rules_end"

# Tested on cyberJack RFID standard
#ATTRS{idVendor}=="0c4b", ATTRS{idProduct}=="0500", ENV{PCSCD}="1"
ATTRS{idVendor}=="0c4b", ATTRS{idProduct}=="0400", ENV{PCSCD}="1"

# All done
LABEL="cyberjack_rules_end"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum