[Pcsclite-cvs-commit] SCardTransmit returns 80100016 error code

kamal kumar skamalakumar at yahoo.com
Thu Feb 15 10:39:21 CET 2007


Hi all,
I am developing one module that interacts with PIV
smartcard. All the APDUs are working well and
returning response. But when i send Get Response APDU
to retrieve data more than 255 bytes I am getting
error. SCardTransmit function return 80100016 error
code. I have also attached the PCSCD log also with
this. This error is occuring only in Gentoo 2006.1
Linux distribution I installed. It is working
correctly in other Linux distributions I used.

And working with SCR 331 reader. I have given the code
that send the Get Response APDU here.
=================================================================
LONG SCardHookExchangeAPDU( SCARDHANDLE hCard, DWORD
dwActiveProtocol, PCSCLPTransmitBuffer transmitBuffer
) {
  LONG rv;
  unsigned long originalLength;

 
	if (dwActiveProtocol == SCARD_PROTOCOL_T0)
    {
        transmitBuffer->ioType =
(LPSCARD_IO_REQUEST)SCARD_PCI_T0;
    }
    else if (dwActiveProtocol == SCARD_PROTOCOL_T1)
    {
        transmitBuffer->ioType =
(LPSCARD_IO_REQUEST)SCARD_PCI_T1;
    }
    else
    {
        throw
SCardException(SCARD_E_UNSUPPORTED_FEATURE);
    }

  originalLength = transmitBuffer->apduResponseSize;
          

  rv = SCardTransmit(hCard, 
	      transmitBuffer->ioType,
		  transmitBuffer->buffer, 
		  transmitBuffer->bufferSize,
		  0,
		  transmitBuffer->apduResponse, 
		  &transmitBuffer->apduResponseSize );

	  if (rv != SCARD_S_SUCCESS) {  
		  printf("SCardTransmit exited with error code =
%d",rv);
		  throw SCardException(rv);
	  }

    
  return rv;
}


StatusWord GetResponse (SCARDHANDLE cardHandle,
PIV_Byte le, DWORD dwActiveProtocol, PIV_Byte *buffer,
PIV_ULong32 *pBufferLength) {

	LONG rv;
	PCSCTransmitBuffer transmitBuffer;
	StatusWord sw=0;
	transmitBuffer.apduResponseSize = 260;

	/* Select Applet APDU */
	transmitBuffer.buffer[APDU_CLA] = 0x00;
	transmitBuffer.buffer[APDU_INS] = 0xC0;
	transmitBuffer.buffer[APDU_P1]  = 0x00;
	transmitBuffer.buffer[APDU_P2]  = 0x00;
	transmitBuffer.buffer[APDU_P3]  = le;

	transmitBuffer.bufferSize = 5;

	SCardHookExchangeAPDU(cardHandle,dwActiveProtocol,
&transmitBuffer);

	sw = ReadStatusWord(&transmitBuffer);

	if (sw != 0x9000 && (sw & 0xFF00) != 0x6100) throw
APDUException(sw);

    memcpy (buffer, &(transmitBuffer.apduResponse[0]),
transmitBuffer.apduResponseSize-2);
	return sw;
}
=============================================================

pcscd log

=============================================================
pcscdaemon.c:259:main() pcscd set to foreground with
debug send to stderr
pcscdaemon.c:464:main() pcsc-lite 1.3.1 daemon ready.
hotplug_libusb.c:407:HPAddHotPluggable() Adding USB
device: 001:003
readerfactory.c:1095:RFInitializeReader() Attempting
startup of SCM SCR 331 (2000012F) 00 00.
readerfactory.c:967:RFBindFunctions() Loading IFD
Handler 3.0
ifdhandler.c:1155:init_driver() LogLevel: 0x0003
ifdhandler.c:1165:init_driver() DriverOptions: 0x0000
ifdhandler.c:76:IFDHCreateChannelByName() lun: 0,
device: usb:04e6/e001:libusb:001:003
ccid_usb.c:231:OpenUSBByName() Manufacturer: Ludovic
Rousseau (ludovic.rousseau at free.fr)
ccid_usb.c:241:OpenUSBByName() ProductString: Generic
CCID driver v1.0.1
ccid_usb.c:247:OpenUSBByName() Copyright: This driver
is protected by terms of the GNU General Public
License version 2, or (at your option) any later
version.
ccid_usb.c:395:OpenUSBByName() Found Vendor/Product:
04E6/E001 (SCM SCR 331)
ccid_usb.c:397:OpenUSBByName() Using USB bus/device:
001/003
ccid_usb.c:747:get_data_rates() IFD does not support
GET_DATA_RATES request: Broken pipe
ifdhandler.c:252:IFDHGetCapabilities() lun: 0, tag:
0xFAE
ifdhandler.c:294:IFDHGetCapabilities() Reader supports
1 slots
ifdhandler.c:787:IFDHPowerICC() lun: 0
Card ATR: 3B DB 96 00 81 B1 FE 45 1F 03 80 F9 A0 00 00
03 08 00 00 10 00 18 
prothandler.c:130:PHSetProtocol() Attempting PTS to
T=1
ifdhandler.c:377:IFDHSetProtocolParameters() lun: 0,
protocol T=1
ifdhandler.c:1260:extra_egt() Extra EGT patch applied
ifdhandler.c:894:IFDHTransmitToICC() lun: 0
ifdhandler.c:894:IFDHTransmitToICC() lun: 0
ccid_usb.c:508:ReadUSB() usb_bulk_read(001/003):
Resource temporarily unavailable
openct/proto-t1.c:218:t1_transceive() fatal:
transmit/receive failed
ifdwrapper.c:735:IFDTransmit() Card not transacted:
612
winscard.c:1491:SCardTransmit() Card not transacted:
0x80100016
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003):
Resource temporarily unavailable
ifdwrapper.c:484:IFDStatusICC() Card not transacted:
612
eventhandler.c:301:EHStatusHandlerThread() Error
communicating to: SCM SCR 331 (2000012F) 00 00
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003):
Resource temporarily unavailable
ifdwrapper.c:484:IFDStatusICC() Card not transacted:
612
ifdhandler.c:787:IFDHPowerICC() lun: 0
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003):
Resource temporarily unavailable
ifdhandler.c:823:IFDHPowerICC() PowerUp failed
winscard.c:771:SCardDisconnect() Error resetting card.
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003):
Resource temporarily unavailable
ifdwrapper.c:484:IFDStatusICC() Card not transacted:
612
eventhandler.c:301:EHStatusHandlerThread() Error
communicating to: SCM SCR 331 (2000012F) 00 00
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003):
Resource temporarily unavailable
ifdwrapper.c:484:IFDStatusICC() Card not transacted:
612
eventhandler.c:301:EHStatusHandlerThread() Error
communicating to: SCM SCR 331 (2000012F) 00 00
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003):
Resource temporarily unavailable
ifdwrapper.c:484:IFDStatusICC() Card not transacted:
612
eventhandler.c:301:EHStatusHandlerThread() Error
communicating to: SCM SCR 331 (2000012F) 00 00
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003): No
such device
ifdwrapper.c:484:IFDStatusICC() Card not transacted:
612
eventhandler.c:301:EHStatusHandlerThread() Error
communicating to: SCM SCR 331 (2000012F) 00 00
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003): No
such device
ifdwrapper.c:484:IFDStatusICC() Card not transacted:
612
eventhandler.c:301:EHStatusHandlerThread() Error
communicating to: SCM SCR 331 (2000012F) 00 00
hotplug_libusb.c:469:HPRemoveHotPluggable() Removing
USB device[0]: 001:003
eventhandler.c:121:EHDestroyEventHandler() Stomping
thread.
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003): No
such device
ifdwrapper.c:484:IFDStatusICC() Card not transacted:
612
eventhandler.c:301:EHStatusHandlerThread() Error
communicating to: SCM SCR 331 (2000012F) 00 00
eventhandler.c:150:EHDestroyEventHandler() Thread
stomped.
readerfactory.c:1142:RFUnInitializeReader() Attempting
shutdown of SCM SCR 331 (2000012F) 00 00.
ifdhandler.c:203:IFDHCloseChannel() lun: 0
ccid_usb.c:474:WriteUSB() usb_bulk_write(001/003): No
such device
readerfactory.c:1012:RFUnloadReader() Unloading reader
driver.
pcscdaemon.c:529:signal_trap() Preparing for suicide
hotplug_libusb.c:361:HPEstablishUSBNotifications()
Hotplug stopped
readerfactory.c:1350:RFCleanupReaders() entering
cleaning function
pcscdaemon.c:489:at_exit() cleaning /var/run
==============================================================

I have to remove and reinsert the card for the
smartcard to start functioning.

I have tried with different version of pcsc-lite and
ccid driver. If anybody can point out what is wrong,
it will be very helpful.

Thanks and Regards,
Kamal.


 
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited



More information about the Pcsclite-cvs-commit mailing list