Hello.

Searching through mailing lists, does resolve a most of the issues, and it did for me, but unfortunately, at least one remains unresolved, and several days of searching did not lead me to a successful result, so I'm writing this email.

I have tried to install a customized ACR38T (sim-sized) card reader on linux. By customized I mean that it's being sold under a different name by a third party company that buys them from ACS, but is different from the original ACR38T only by its vendorId.

Initially I've installed the driver (libacr38u* v-1.7.9) from repositories (Ubuntu 9.04). Also I've installed the pcscd, pcsc-tools and libpcsc-perl from repositories. At that point I didn't install libmuscle, but libpcsclite1 was installed, as network-manager depends on wpasupplicat, which depends on libpcsclite1. Then I have changed vendorId in the Info.plist file to correspond to the one indicated on the card reader. It didn't work, but after a lot of googling, and recompiling the driver from source, two issues have been resolved:

1. the /proc/bus/usb was empty, so I've mounted into it /dev/bus/usb (the README.430 file that comes with ifd-gempc-1.0.5 indicates that the driver will look for usb devices in /proc/dev/usb, while there is nothing about this fact in the README or INSTALL file from the ACR38_LINUX_100709_P that can be downloaded from acs.com.hk)

2. the file ACR38_LINUX_100709_P/src/driver/usbserial_linux.c has the following lines:
/* Change the following to uniquely match your reader. */
enum {
kMyVendorID = 0x072F, /* change to match your reader */ kMyProductID = 0x9000, /* change to match your reader */
};
that's why changing vendorId only in Info.plist didn't help. It would be nice if README file for this driver would contain a note about the fact that vendorId and productId are hard-coded.

After that, debug messages from pcscd indicated the fact that it connected successfully to the device. But, after installing libmusclecard, muscletools, etc..., I realized that I don't have a sim-sized smart card supported by muscle. Therefore, the work with the "customized" sim-sized ACR38T (with different vendorId) is done.



I found other two reader: GemPlus430 and ACR38 ("full-sized") for which I have several smart cards. After unsuccessful tries to make them work with the packages from repositories, I've uninstalled them all (except libpcsclite1, because it would remove network-manager). The following software have been compiled and installed from source:

pcsc-lite-1.5.4      (with --enable-debugatr)
pcsc-perl-1.4.7
pcsc-tools-1.4.15
acr38driver-1.7.9   (with --enable-debug)
ifd-gempc-1.0.5
libmusclecard-1.3.6   (with --enable-debug)
MCardPlugin from muscleframework-1.1.7   (with --enable-debug)
muscletools-2.1.0

pcsc_scan caused flooding with messages like:
Scanning present readers...
0: GemPC430 00 00
Scanning present readers...
0: GemPC430 00 00

... but , this issue have been resolved by removing /lib/libpcsclite.so.1.0.0 (the one that was installed by default on the system with network-manager) and linking instead with the newly installed libpcsclite.


As soon as both GemPlus430 and Acr38 behave identically (debug messages from both drivers are very alike, and apdu's send and received for a certain card also are identical), I will include logs only from GemPlus430 (I would include logs from ACR38 also, but I'll have it again only on Monday).


#LIBCCID_ifdLogLevel=0x0007
# export LIBCCID_ifdLogLevel
# pcscd --foreground --debug --apdu
debuglog.c:230:DebugLogSetLevel() debug level=debug
00000072 debuglog.c:259:DebugLogSetCategory() Debug options: APDU
00000512 pcscdaemon.c:512:main() pcsc-lite 1.5.4 daemon ready.
00058757 tokenparser.l:175:LTPBundleFindValueWithKey() Value/Key not defined for: ifdVendorID in /usr/lib/pcsc/drivers/ifd-GemPC430.bundle/Contents/Info.plist 00024013 tokenparser.l:175:LTPBundleFindValueWithKey() Value/Key not defined for: ifdVendorID in /usr/lib/pcsc/drivers/ACR38UDriver.bundle/Contents/Info.plist 00006984 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x08E6, PID: 0x0430 00000110 hotplug_libhal.c:362:HPAddDevice() Adding USB device: usb_device_8e6_430_noserial_if0 01000886 readerfactory.c:1024:RFInitializeReader() Attempting startup of GemPC430 00 00 using /usr/lib/pcsc/drivers/ifd-GemPC430.bundle/Contents/Linux/libGemPC430.so.1.0.5
00017566 readerfactory.c:877:RFBindFunctions() Loading IFD Handler 3.0
00000300 ifdhandler.c:51:IFDHCreateChannelByName() lun: 0, device: usb:08e6/0430:libhal:/org/freedesktop/Hal/devices/usb_device_8e6_430_noserial_if0 00000023 libusb_wrap.c:93:OpenUSB() Lun: 0, Device: usb:08e6/0430:libhal:/org/freedesktop/Hal/devices/usb_device_8e6_430_noserial_if0
00080244 libusb_wrap.c:183:OpenUSB() Trying to open USB device: 006/003
00000062 libusb_wrap.c:210:OpenUSB() Using USB device: 006/003
00000016 GCCmds.c:407:GCCmdSetMode()
00000026 -> 000000 03 01 00 01
00002404 <- 000000 02 00 01
00000019 GCCmds.c:328:GCCmdGetOSVersion()
00000017 -> 000000 05 22 05 3F E0 10
00001969 <- 000000 11 00 47 65 6D 55 73 62 2D 52 31 2E 30 34 2D 47 4D 20
00000015 GemPC430Utils.c:53:OpenGemPC430ByName() OS string: GemUsb-R1.04-GM
00000017 ifdhandler.c:184:IFDHGetCapabilities() lun: 0, tag: FB0
00000010 readerfactory.c:249:RFAddReader() Using the pcscd polling thread
00000626 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000011 GCCmds.c:389:GCCmdCardStatus()
00000011 -> 000000 01 17
00001313 <- 000000 07 00 04 02 00 00 00 00
00000020 ifdhandler.c:643:IFDHICCPresence() Card present, just inserted
00000112 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000024 GCCmds.c:389:GCCmdCardStatus()
00000020 -> 000000 01 17
00001818 <- 000000 07 00 04 02 00 00 00 00
00000013 ifdhandler.c:643:IFDHICCPresence() Card present, just inserted
00000016 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000010 GCCmds.c:389:GCCmdCardStatus()
00000010 -> 000000 01 17
00001950 <- 000000 07 00 04 02 00 00 00 00
00000014 ifdhandler.c:643:IFDHICCPresence() Card present, just inserted
00000015 ifdhandler.c:326:IFDHPowerICC() lun: 0
00000016 GCCmds.c:244:GCCmdPowerUp()
00000014 -> 000000 02 12 13
00341966 <- 000000 1A 00 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0 00000043 ATR: 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
00000015 atrhandler.c:102:ATRDecodeAtr() Conv: 01, Y1: 0F, K: 0F
00000015 atrhandler.c:120:ATRDecodeAtr() TA1: 11, TB1: 00, TC1: 00, TD1: 81
00000013 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000014 atrhandler.c:120:ATRDecodeAtr() TA2: FFFFFFFF, TB2: FFFFFFFF, TC2: FFFFFFFF, TD2: 31
00000012 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000026 atrhandler.c:120:ATRDecodeAtr() TA3: FE, TB3: 4D, TC3: FFFFFFFF, TD3: FFFFFFFF 00000015 atrhandler.c:248:ATRDecodeAtr() CurrentProtocol: 2, AvailableProtocols: 2 00000030 Card ATR: 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
00000021 ifdhandler.c:184:IFDHGetCapabilities() lun: 0, tag: FAE
00000068 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000016 GCCmds.c:389:GCCmdCardStatus()
00000013 -> 000000 01 17
00001814 <- 000000 07 00 0E 02 11 00 FE 4D
00000023 ifdhandler.c:603:IFDHICCPresence() Card present and powered
00004308 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x046D, PID: 0xC050 00007873 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x152D, PID: 0x2329 00064031 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x1D6B, PID: 0x0002 00003741 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x1D6B, PID: 0x0001 00003220 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x1D6B, PID: 0x0001 00003308 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x1D6B, PID: 0x0001 00010593 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x04F2, PID: 0xB008 00001977 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x04F2, PID: 0xB008 00002572 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x1D6B, PID: 0x0002 00003295 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x1D6B, PID: 0x0001 00003844 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x0483, PID: 0x2016 00002612 hotplug_libhal.c:316:get_driver() Looking a driver for VID: 0x1D6B, PID: 0x0001
00288758 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000026 GCCmds.c:389:GCCmdCardStatus()
00000017 -> 000000 01 17
00002668 <- 000000 07 00 0E 02 11 00 FE 4D
00000028 ifdhandler.c:603:IFDHICCPresence() Card present and powered
00400193 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000033 GCCmds.c:389:GCCmdCardStatus()
00000018 -> 000000 01 17
00002755 <- 000000 07 00 0E 02 11 00 FE 4D
00000032 ifdhandler.c:603:IFDHICCPresence() Card present and powered



$ pcsc_scan
PC/SC device scanner
V 1.4.15 (c) 2001-2009, Ludovic Rousseau <[email protected]>
Compiled with PC/SC lite version: 1.5.4
Scanning present readers...
0: GemPC430 00 00

Fri Jul  3 23:30:54 2009
Reader 0: GemPC430 00 00
 Card state: Card inserted,
ATR: 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0

ATR: 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
+ TS = 3B --> Direct Convention
+ T0 = FF, Y(1): 1111, K: 15 (historical bytes)
 TA(1) = 11 --> Fi=372, Di=1, 372 cycles/ETU
   10752 bits/s at 4 MHz, fMax for Fi = 5 MHz => 13440 bits/s
 TB(1) = 00 --> VPP is not electrically connected
 TC(1) = 00 --> Extra guard time: 0
 TD(1) = 81 --> Y(i+1) = 1000, Protocol T = 1
-----
 TD(2) = 31 --> Y(i+1) = 0011, Protocol T = 1
-----
 TA(3) = FE --> IFSC: 254
 TB(3) = 4D --> Block Waiting Integer: 4 - Character Waiting Integer: 13
+ Historical bytes: 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00
 Category indicator byte: 80 (compact TLV data object)
   Tag: 2, len: 5 (issuer identification number, ISO 7812-1)
     Issuer identification number: A0 00 00 00 56
   Tag: 5, len: 7 (card issuer's data)
     Card issuer data: 44 4B 33 33 30 06 00
+ TCK = D0 (correct checksum)

Possibly identified card (using /usr/local/share/pcsc/smartcard_list.txt):
3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
   Datakey 32K PKI Smart Card Model 330
   (http://www.datakey.com/products/smart_cards/products_sc_330.shtml)



The ATR was included in mscMuscleCard.bundle/Contents/Info.plist using bundleTool.


#muscleTool -d
MuscleCard shell - type "help" for help.
muscleTool > tokens
  1.    MuscleCard Applet

ListTokens Success.
muscleTool >


causes the following output in pcscd:


00060866 winscard_msg_srv.c:239:SHMProcessEventsServer() Common channel packet arrival 00000033 winscard_msg_srv.c:248:SHMProcessEventsServer() SHMProcessCommonChannelRequest detects: 8 00000016 pcscdaemon.c:147:SVCServiceRunLoop() A new context thread creation is requested: 8
00000732 winscard_svc.c:133:ContextThread() Thread is started: 8
00000155 winscard_msg_srv.c:317:SHMProcessEventsContext() command CMD_VERSION received by client 8
00000085 winscard_svc.c:189:ContextThread() Client is protocol version 3:0
00000169 winscard_msg_srv.c:317:SHMProcessEventsContext() command ESTABLISH_CONTEXT received by client 8 00000097 winscard.c:242:SCardEstablishContext() Establishing Context: 17001081




muscleTool > format 1
tokenfactory.c:405:TPLoadToken() Loading service library /usr/lib/pcsc/services/mscMuscleCard.bundle/Contents/Linux/mscMuscleCard
ERR: EstablishConnection Failed ! (0x9C52 Token is unsupported)
muscleTool >


causes the following output in pcscd:


00400125 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000036 GCCmds.c:389:GCCmdCardStatus()
00000019 -> 000000 01 17
00002855 <- 000000 07 00 0E 02 11 00 FE 4D
00000034 ifdhandler.c:603:IFDHICCPresence() Card present and powered
00151833 winscard_msg_srv.c:317:SHMProcessEventsContext() command CONNECT received by client 8 00000031 winscard.c:303:SCardConnect() Attempting Connect to GemPC430 00 00 using protocol: 3 00000029 ATR: 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
00000015 atrhandler.c:102:ATRDecodeAtr() Conv: 01, Y1: 0F, K: 0F
00000015 atrhandler.c:120:ATRDecodeAtr() TA1: 11, TB1: 00, TC1: 00, TD1: 81
00000012 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000014 atrhandler.c:120:ATRDecodeAtr() TA2: FFFFFFFF, TB2: FFFFFFFF, TC2: FFFFFFFF, TD2: 31
00000013 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000013 atrhandler.c:120:ATRDecodeAtr() TA3: FE, TB3: 4D, TC3: FFFFFFFF, TD3: FFFFFFFF 00000013 atrhandler.c:248:ATRDecodeAtr() CurrentProtocol: 2, AvailableProtocols: 2 00000023 ATR: 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
00000013 atrhandler.c:102:ATRDecodeAtr() Conv: 01, Y1: 0F, K: 0F
00000014 atrhandler.c:120:ATRDecodeAtr() TA1: 11, TB1: 00, TC1: 00, TD1: 81
00000011 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000014 atrhandler.c:120:ATRDecodeAtr() TA2: FFFFFFFF, TB2: FFFFFFFF, TC2: FFFFFFFF, TD2: 31
00000012 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000013 atrhandler.c:120:ATRDecodeAtr() TA3: FE, TB3: 4D, TC3: FFFFFFFF, TD3: FFFFFFFF 00000013 atrhandler.c:248:ATRDecodeAtr() CurrentProtocol: 2, AvailableProtocols: 2
00000012 prothandler.c:128:PHSetProtocol() Attempting PTS to T=1
00000014 ifdhandler.c:269:IFDHSetProtocolParameters() lun: 0
00000013 winscard.c:449:SCardConnect() Active Protocol: T=1
00000017 winscard.c:459:SCardConnect() hCard Identity: 15601
00000063 utils.c:115:StatSynchronize() status file: /var/run/pcscd/pcscd.events/event.8690.17032528 00000203 winscard_msg_srv.c:317:SHMProcessEventsContext() command STATUS received by client 8 00036253 winscard_msg_srv.c:317:SHMProcessEventsContext() command TRANSMIT received by client 8
00000423 winscard.c:1647:SCardTransmit() Send Protocol: T=1
00000020 APDU: 00 A4 04 00 06 A0 00 00 00 01 01
00000018 ifdhandler.c:421:IFDHTransmitToICC() lun: 0
00000030 GCUtils.c:218:gemcore_ISO_EXCHANGE_processing()
00000021 -> 000000 0C 15 00 A4 04 00 06 A0 00 00 00 01 01
02819747 <- 000000 03 E7 64 F5
00000054 GCUtils.c:310:gemcore_status_processing()
00000015 GCUtils.c:317 gemcore_status_processing "Error" returned by the card (SW is not 9000)
00000023 SW: 64 F5
00000054 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000017 GCCmds.c:389:GCCmdCardStatus()
00000016 -> 000000 01 17
00000206 winscard_msg_srv.c:317:SHMProcessEventsContext() command DISCONNECT received by client 8
00000027 winscard.c:880:SCardDisconnect() Active Contexts: -1
00000056 utils.c:115:StatSynchronize() status file: /var/run/pcscd/pcscd.events/event.8690.17032528
00001492 <- 000000 07 00 0E 02 11 00 FE 4D
00000027 ifdhandler.c:603:IFDHICCPresence() Card present and powered



muscleTool > connect 1
tokenfactory.c:405:TPLoadToken() Loading service library /usr/lib/pcsc/services/mscMuscleCard.bundle/Contents/Linux/mscMuscleCard
ERR: EstablishConnection Failed !
Is your card already formated?
muscleTool >


causes the following output in pcscd:


00400217 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000039 GCCmds.c:389:GCCmdCardStatus()
00000019 -> 000000 01 17
00002683 <- 000000 07 00 0E 02 11 00 FE 4D
00000034 ifdhandler.c:603:IFDHICCPresence() Card present and powered
00355075 winscard_msg_srv.c:317:SHMProcessEventsContext() command CONNECT received by client 8 00000032 winscard.c:303:SCardConnect() Attempting Connect to GemPC430 00 00 using protocol: 3 00000029 ATR: 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
00000015 atrhandler.c:102:ATRDecodeAtr() Conv: 01, Y1: 0F, K: 0F
00000015 atrhandler.c:120:ATRDecodeAtr() TA1: 11, TB1: 00, TC1: 00, TD1: 81
00000013 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000014 atrhandler.c:120:ATRDecodeAtr() TA2: FFFFFFFF, TB2: FFFFFFFF, TC2: FFFFFFFF, TD2: 31
00000012 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000014 atrhandler.c:120:ATRDecodeAtr() TA3: FE, TB3: 4D, TC3: FFFFFFFF, TD3: FFFFFFFF 00000013 atrhandler.c:248:ATRDecodeAtr() CurrentProtocol: 2, AvailableProtocols: 2 00000023 ATR: 3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
00000013 atrhandler.c:102:ATRDecodeAtr() Conv: 01, Y1: 0F, K: 0F
00000014 atrhandler.c:120:ATRDecodeAtr() TA1: 11, TB1: 00, TC1: 00, TD1: 81
00000012 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000013 atrhandler.c:120:ATRDecodeAtr() TA2: FFFFFFFF, TB2: FFFFFFFF, TC2: FFFFFFFF, TD2: 31
00000012 atrhandler.c:152:ATRDecodeAtr() T=1 Protocol Found
00000013 atrhandler.c:120:ATRDecodeAtr() TA3: FE, TB3: 4D, TC3: FFFFFFFF, TD3: FFFFFFFF 00000012 atrhandler.c:248:ATRDecodeAtr() CurrentProtocol: 2, AvailableProtocols: 2
00000013 prothandler.c:128:PHSetProtocol() Attempting PTS to T=1
00000014 ifdhandler.c:269:IFDHSetProtocolParameters() lun: 0
00000013 winscard.c:449:SCardConnect() Active Protocol: T=1
00000016 winscard.c:459:SCardConnect() hCard Identity: 12cf1
00000063 utils.c:115:StatSynchronize() status file: /var/run/pcscd/pcscd.events/event.8899.17033875 00000352 winscard_msg_srv.c:317:SHMProcessEventsContext() command STATUS received by client 8 00001127 winscard_msg_srv.c:317:SHMProcessEventsContext() command TRANSMIT received by client 8
00000019 winscard.c:1647:SCardTransmit() Send Protocol: T=1
00000018 APDU: 00 A4 04 00 06 A0 00 00 00 01 01
00000014 ifdhandler.c:421:IFDHTransmitToICC() lun: 0
00000023 GCUtils.c:218:gemcore_ISO_EXCHANGE_processing()
00000021 -> 000000 0C 15 00 A4 04 00 06 A0 00 00 00 01 01
02821936 <- 000000 03 E7 64 F5
00000043 GCUtils.c:310:gemcore_status_processing()
00000015 GCUtils.c:317 gemcore_status_processing "Error" returned by the card (SW is not 9000)
00000023 SW: 64 F5
00000310 ifdhandler.c:585:IFDHICCPresence() lun: 0
00000031 GCCmds.c:389:GCCmdCardStatus()
00000021 -> 000000 01 17
00000323 winscard_msg_srv.c:317:SHMProcessEventsContext() command DISCONNECT received by client 8
00000085 winscard.c:880:SCardDisconnect() Active Contexts: 1
00000053 utils.c:115:StatSynchronize() status file: /var/run/pcscd/pcscd.events/event.8899.17033875
00002368 <- 000000 07 00 0E 02 11 00 FE 4D
00000034 ifdhandler.c:603:IFDHICCPresence() Card present and powered




When starting pcscd, the 4-th and 5-th lines contain "Value/Key not defined for: ifdVendorID in .... " But it's kind of weird, because the value for ifdVendorId is defined in those files. But this message appeares only with the compiled from source v-1.5.4, but not with the pcscd v-1.4.102 from repositories.

With different card, debug messages from pcscd are very alike, except for the apdu's, especially those returned by card. For example, I've seen SW: 6E 00, SW: 67 00, and others instead of SW: 64 F5 from the example above. If needed I can include logs with other cards, or with other reader.

Any sugestion on where to search for an answer, or any hint on how to solve this issue, is very welkome.

Thanks.
Andrew.
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to