2010/8/31 Forest Bond <[email protected]>:
> Hi,

Hello,

> First, let me say that I have been using pcsc-lite and ccid for a while now 
> and
> have found both to be excellent programs.

Thanks :-)
See also "How to help my projects?" [1].

> Now I am trying to use a Precise Biometrics Precise MC 200 reader to access a
> PIV card using a proprietary PIV middleware.  The PIV card works fine using a
> different reader, but I am having problems with the MC 200:
>
> * The pivConnect call fails (I assume because the SCardConnect call has
>  failed).
> * The reader blinks its red and green lights a few times and then seems to go
>  offline -- I get USB errors with "Resource temporarily unavailable".
>
> I am using pcsc-lite and ccid on Ubuntu Lucid.  Here are the package versions 
> as
> reported by APT:
>
> pcsc-lite: 1.5.3-1ubuntu4.1
> ccid: 1.3.11-1
>
> Here is the output from pcscd (obtained using the instructions from
> http://pcsclite.alioth.debian.org/ccid.html#support).  I tried to connect to 
> the
> card twice.  You can see the USB errors on the second attempt.
>
> --------------------------------------------------------------------------------
> debuglog.c:224:DebugLogSetLevel() debug level=debug
> debuglog.c:253:DebugLogSetCategory() Debug options: APDU
> pcscdaemon.c:505:main() pcsc-lite 1.5.3 daemon ready.
> hotplug_libusb.c:403:HPEstablishUSBNotifications() Driver ifd-ccid.bundle 
> does not support IFD_GENERATE_HOTPLUG. Using active polling instead.
> hotplug_libusb.c:412:HPEstablishUSBNotifications() Polling forced every 1 
> second(s)
> hotplug_libusb.c:477:HPAddHotPluggable() Adding USB device: 005:070
> readerfactory.c:1024:RFInitializeReader() Attempting startup of Precise 200 
> MC (0016787745) 00 00 using 
> /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
> readerfactory.c:877:RFBindFunctions() Loading IFD Handler 3.0
> ifdhandler.c:1532:init_driver() Driver version: 1.3.11
> ifdhandler.c:1545:init_driver() LogLevel: 0x0003
> ifdhandler.c:1555:init_driver() LogLevel from LIBCCID_ifdLogLevel: 0x0007
> ifdhandler.c:1565:init_driver() DriverOptions: 0x0000
> ifdhandler.c:82:IFDHCreateChannelByName() lun: 0, device: 
> usb:08c3/0402:libusb:005:070
> ccid_usb.c:162:OpenUSBByName() Reader index: 0, Device: 
> usb:08c3/0402:libusb:005:070
> ccid_usb.c:285:OpenUSBByName() Manufacturer: Ludovic Rousseau 
> ([email protected])
> ccid_usb.c:295:OpenUSBByName() ProductString: Generic CCID driver
> ccid_usb.c:301:OpenUSBByName() Copyright: This driver is protected by terms 
> of the GNU Lesser General Public License version 2.1, or (at your option) any 
> later version.
> ccid_usb.c:383:OpenUSBByName() Checking device: 005/070
> ccid_usb.c:437:OpenUSBByName() Trying to open USB bus/device: 005/070
> ccid_usb.c:501:OpenUSBByName() Found Vendor/Product: 08C3/0402 (Precise 200 
> MC)
> ccid_usb.c:503:OpenUSBByName() Using USB bus/device: 005/070
> ccid_usb.c:949:ControlUSB() request: 0x03
> receive:
> ccid_usb.c:893:get_data_rates() IFD does not support GET_DATA_RATES request: 
> Broken pipe
> ifdhandler.c:364:IFDHGetCapabilities() tag: 0xFB0, 
> usb:08c3/0402:libusb:005:070 (lun: 0)
> readerfactory.c:249:RFAddReader() Using the pcscd polling thread
> ifdhandler.c:364:IFDHGetCapabilities() tag: 0xFAE, 
> usb:08c3/0402:libusb:005:070 (lun: 0)
> ifdhandler.c:418:IFDHGetCapabilities() Reader supports 1 slot(s)
> ifdhandler.c:1043:IFDHPowerICC() action: PowerUp, 
> usb:08c3/0402:libusb:005:070 (lun: 0)
> -> 000000 62 00 00 00 00 00 04 00 00 00
> <- 000000 80 16 00 00 00 00 04 00 00 00 3B DB 96 00 81 B1 FE 45 1F 03 80 F9 
> A0 00 00 03 08 00 00 10 00 18
> Card ATR: 3B DB 96 00 81 B1 FE 45 1F 03 80 F9 A0 00 00 03 08 00 00 10 00 18
> winscard_msg_srv.c:239:SHMProcessEventsServer() Common channel packet arrival
> winscard_msg_srv.c:248:SHMProcessEventsServer() 
> SHMProcessCommonChannelRequest detects: 6
> pcscdaemon.c:147:SVCServiceRunLoop() A new context thread creation is 
> requested: 6
> winscard_svc.c:133:ContextThread() Thread is started: 6
> winscard_msg_srv.c:317:SHMProcessEventsContext() command CMD_VERSION received 
> by client 6
> winscard_svc.c:189:ContextThread() Client is protocol version 3:0
> winscard_msg_srv.c:317:SHMProcessEventsContext() command ESTABLISH_CONTEXT 
> received by client 6
> winscard.c:242:SCardEstablishContext() Establishing Context: 16999491
> winscard_msg_srv.c:317:SHMProcessEventsContext() command RELEASE_CONTEXT 
> received by client 6
> winscard.c:253:SCardReleaseContext() Releasing Context: 16999491
> winscard_msg_srv.c:306:SHMProcessEventsContext() Client has disappeared: 6
> winscard_svc.c:146:ContextThread() Client die: 6
> winscard_msg_srv.c:239:SHMProcessEventsServer() Common channel packet arrival
> winscard_msg_srv.c:248:SHMProcessEventsServer() 
> SHMProcessCommonChannelRequest detects: 6
> pcscdaemon.c:147:SVCServiceRunLoop() A new context thread creation is 
> requested: 6
> winscard_svc.c:133:ContextThread() Thread is started: 6
> winscard_msg_srv.c:317:SHMProcessEventsContext() command CMD_VERSION received 
> by client 6
> winscard_svc.c:189:ContextThread() Client is protocol version 3:0
> winscard_msg_srv.c:317:SHMProcessEventsContext() command ESTABLISH_CONTEXT 
> received by client 6
> winscard.c:242:SCardEstablishContext() Establishing Context: 16994464
> winscard_msg_srv.c:317:SHMProcessEventsContext() command CONNECT received by 
> client 6
> winscard.c:303:SCardConnect() Attempting Connect to Precise 200 MC 
> (0016787745) 00 00 using protocol: 3
> prothandler.c:128:PHSetProtocol() Attempting PTS to T=1
> ifdhandler.c:581:IFDHSetProtocolParameters() protocol T=1, 
> usb:08c3/0402:libusb:005:070 (lun: 0)
> ifdhandler.c:1660:extra_egt() Extra EGT patch applied
> ifdhandler.c:858:IFDHSetProtocolParameters() BWI/CWI (TB3) present: 0x45
> ifdhandler.c:894:IFDHSetProtocolParameters() IFSC (TA3) present: 254
> ifdhandler.c:901:IFDHSetProtocolParameters() Timeout: 2 seconds
> commands.c:2015:SetParameters() length: 7 bytes
> -> 000000 61 07 00 00 00 00 13 01 00 00 11 10 02 45 00 FE 00
> <- 000000 83 07 00 00 00 00 13 00 00 01 11 10 02 45 00 FE 00
> ifdhandler.c:961:IFDHSetProtocolParameters() IFSC (TA3) present: 254
> ifdhandler.c:972:IFDHSetProtocolParameters() Negociate IFSD at 254
> sending: 00 C1 01 FE 3E
> -> 000000 6F 05 00 00 00 00 14 00 00 00 00 C1 01 FE 3E
> <- 000000 80 00 00 00 00 00 14 40 FB 00
> commands.c:1301:CCID_Receive Hardware error

The problem is here.

> openct/proto-t1.c:766:t1_negotiate_ifsd() fatal: transmit/receive failed
> prothandler.c:144:PHSetProtocol() PTS failed (612), using T=1
> winscard_msg_srv.c:317:SHMProcessEventsContext() command RELEASE_CONTEXT 
> received by client 6
> winscard.c:253:SCardReleaseContext() Releasing Context: 16994464
> winscard_msg_srv.c:306:SHMProcessEventsContext() Client has disappeared: 6
> winscard_svc.c:146:ContextThread() Client die: 6
> winscard_msg_srv.c:239:SHMProcessEventsServer() Common channel packet arrival
> winscard_msg_srv.c:248:SHMProcessEventsServer() 
> SHMProcessCommonChannelRequest detects: 6
> pcscdaemon.c:147:SVCServiceRunLoop() A new context thread creation is 
> requested: 6
> winscard_svc.c:133:ContextThread() Thread is started: 6
> winscard_msg_srv.c:317:SHMProcessEventsContext() command CMD_VERSION received 
> by client 6
> winscard_svc.c:189:ContextThread() Client is protocol version 3:0
> winscard_msg_srv.c:317:SHMProcessEventsContext() command ESTABLISH_CONTEXT 
> received by client 6
> winscard.c:242:SCardEstablishContext() Establishing Context: 17035710
> winscard_msg_srv.c:317:SHMProcessEventsContext() command RELEASE_CONTEXT 
> received by client 6
> winscard.c:253:SCardReleaseContext() Releasing Context: 17035710
> winscard_msg_srv.c:306:SHMProcessEventsContext() Client has disappeared: 6
> winscard_svc.c:146:ContextThread() Client die: 6
> winscard_msg_srv.c:239:SHMProcessEventsServer() Common channel packet arrival
> winscard_msg_srv.c:248:SHMProcessEventsServer() 
> SHMProcessCommonChannelRequest detects: 6
> pcscdaemon.c:147:SVCServiceRunLoop() A new context thread creation is 
> requested: 6
> winscard_svc.c:133:ContextThread() Thread is started: 6
> winscard_msg_srv.c:317:SHMProcessEventsContext() command CMD_VERSION received 
> by client 6
> winscard_svc.c:189:ContextThread() Client is protocol version 3:0
> winscard_msg_srv.c:317:SHMProcessEventsContext() command ESTABLISH_CONTEXT 
> received by client 6
> winscard.c:242:SCardEstablishContext() Establishing Context: 17018086
> winscard_msg_srv.c:317:SHMProcessEventsContext() command CONNECT received by 
> client 6
> winscard.c:303:SCardConnect() Attempting Connect to Precise 200 MC 
> (0016787745) 00 00 using protocol: 3
> prothandler.c:128:PHSetProtocol() Attempting PTS to T=1
> ifdhandler.c:581:IFDHSetProtocolParameters() protocol T=1, 
> usb:08c3/0402:libusb:005:070 (lun: 0)
> ifdhandler.c:1660:extra_egt() Extra EGT patch applied
> ifdhandler.c:858:IFDHSetProtocolParameters() BWI/CWI (TB3) present: 0x45
> ifdhandler.c:894:IFDHSetProtocolParameters() IFSC (TA3) present: 254
> ifdhandler.c:901:IFDHSetProtocolParameters() Timeout: 2 seconds
> commands.c:2015:SetParameters() length: 7 bytes
> -> 000000 61 07 00 00 00 00 40 01 00 00 11 10 02 45 00 FE 00
> <- 000000 83 07 00 00 00 00 40 00 00 01 11 10 02 45 00 FE 00
> ifdhandler.c:961:IFDHSetProtocolParameters() IFSC (TA3) present: 254
> ifdhandler.c:972:IFDHSetProtocolParameters() Negociate IFSD at 254
> sending: 00 C1 01 FE 3E
> -> 000000 6F 05 00 00 00 00 41 00 00 00 00 C1 01 FE 3E
> ccid_usb.c:634:ReadUSB() usb_bulk_read(005/070): Resource temporarily 
> unavailable

Now the reader refuses to answer.

> The interesting thing is that I can get the reader to work properly (albeit
> slowly) by forcing pcscd to use the T=0 protocol with the following patch:
>
> --------------------------------------------------------------------------------
> --- pcsc-lite-1.5.3.orig/src/prothandler.c
> +++ pcsc-lite-1.5.3/src/prothandler.c
> @@ -124,6 +124,9 @@
>                        /* App wants unsupported protocol */
>                        return SET_PROTOCOL_WRONG_ARGUMENT;
>
> +       /* XXX */
> +       ucChosen = SCARD_PROTOCOL_T0;
> +
>        Log2(PCSC_LOG_INFO, "Attempting PTS to T=%d",
>                (SCARD_PROTOCOL_T0 == ucChosen ? 0 : 1));
>        rv = IFDSetPTS(rContext, ucChosen, 0x00, 0x00, 0x00, 0x00);
> --------------------------------------------------------------------------------

Your card is T=1 only. But the reader is APDU so it may work somewhat.
I guess the card is talking at the default speed of 9600 kbits/s
instead of 250 kbits/s.

> I have contacted Precise Biometrics and they have said that their reader has 
> no
> problems with the T=1 protocol and that it passes the PC/SC test suites v1.0 
> and
> v2.0.
>
> Any ideas where the problem might be?

Precise 200 MC firmware was bogus [2]. Maybe you have an "old" reader
with a bogus firmware. But the bug I reported was not the same as
yours.

Can you follow [3] so I can check the firmware version?

Bye

[1] http://ludovicrousseau.blogspot.com/2010/08/how-to-help-my-projects.html
[2] http://pcsclite.alioth.debian.org/supported.html#0x08C30x0402
[3] http://pcsclite.alioth.debian.org/ccid.html#CCID_compliant

-- 
 Dr. Ludovic Rousseau

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

Reply via email to