[Muscle] Problem with SCM3310, SCard and MCard

Marco Matarazzo marco.matarazzo at manilamatic.it
Wed Oct 17 05:16:42 PDT 2007


Greetings.

I'm working on memory cards using an SCM3310 and SLE4442 cards, and
trying to read something from that card.

I'm on Linux (Fedora 7) using PC/SC and the driver provided by SCM.
Actually, I'm using a newer version of the driver provided to me by
their developers, as the publicly available 5.0.0 has some problems
(Error opening port 200000 or something like that), and the 5.0.3
provided to me SEEMS to work well. Well, at least it starts.

I tried to use both the SCard API and the MCard API. None works for me.


With SCard, i get a TRANSACTION FAILED if i try to use this:

[...]
  unsigned char bSendRead[6];

  bSendRead[0] = 0x00;          // CLA
  bSendRead[1] = 0xB0;          // INS
  bSendRead[2] = 0x00;          // P1
  bSendRead[3] = 0x10;          // P2
  bSendRead[4] = 0x00;          // LC - data length
                                // Data
  bSendRead[5] = 0x20;          // LE

  ret = SCardTransmit(hCard, SCARD_PCI_RAW, bSendRead,
sizeof(bSendRead), &pioRecvPci, bRecvBuffer, &length);

[...]

pcscd gives :

winscard.c:1511:SCardTransmit() Card not transacted: 0x8010001F

I attached the card-test.c source where I'm using the SCard API.


With MCard, i get a strange error, when I use this:

[...]

  ret = MCardInitialize(hContext, sReader, &hMCardContext, &dwDLLVersion);
  if (ret == MCARD_S_SUCCESS)
  {
    printf("OK.\n");
    printf("DLL Version %ld.\n",(long)dwDLLVersion);
  }
  else
  {
    printf("ERROR: %s.\n", pcsc_stringify_error(ret));
    return 1;
  }

  sleep(3);

  printf("Trying to connect to first smart card reader (%s) ...",
sReader);

  ret = MCardConnect(hMCardContext, FORCED_MODE, MCARDTYPE_SLE4442,
&hMCard);

[...]

Here the MCardConnect API return an error 0xA0100803, or
"MCardInitialize not called". As you can see, I actually CALLED it. In
the manual, the MCard report that MCardConnect CAN return this error "if
the reader is not in memory card mode". As far as I know, the
MCardInitialize should do exactly this...

I attached the mcard-test.c source for this example.


Anyone can help me on these problems?

-- 
Marco Matarazzo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: card-test.c
Type: text/x-csrc
Size: 4123 bytes
Desc: not available
Url : http://lists.drizzle.com/pipermail/muscle/attachments/20071017/08af550f/card-test.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcard-test.c
Type: text/x-csrc
Size: 3528 bytes
Desc: not available
Url : http://lists.drizzle.com/pipermail/muscle/attachments/20071017/08af550f/mcard-test.bin


More information about the Muscle mailing list