Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1115
  • Last Modified:

how to read GemClub Memo?

how to read GemClub Memo card using GemPC433-SL usb reader with winscard.dll? i keep on getting error "SCARD_W_UNSUPPORTED_CARD" when i use the command

lngResult = SCardConnectA(lngContext, strCurrentReader, SCARD_SHARE_SHARED, _
                    SCARD_PROTOCOL_Tx, lngCard, lngActiveProtocol)
0
harsher
Asked:
harsher
  • 4
  • 4
1 Solution
 
BdLmCommented:
did you check if this card is sending an ATR.

controller cards (eg. Infineon SLE 66 series ) are sending an ATR after power on
like  3B 0B .....;
memory cards with Chips like 4442 oder 4428 or telephone cards do not send this response.

current release of pc/sc spec does not yet support memory cards, You have to wait for rev. 2 of this standard.  
0
 
harsherAuthor Commented:
ahahahah i found out i fogot to install the driver for the GemPC433-SL  reader... ehehhe

but now, my problem is how to insert/extract the data  from the card... ?
i know to write into the card is using

ApduComm.bCla = &H0
  ApduComm.bIns = &HDE
  ApduComm.bP1 = &H0
  ApduComm.bP2 = "&H" & lAddr
  ApduComm.Le = &H4

aand to read from card is using

ApduComm.bCla = &H0
  ApduComm.bIns = &HBE
  ApduComm.bP1 = &H0
  ApduComm.bP2 = "&H" & lAddr
  ApduComm.Le = &H4

but where do i put the data?

i will give more points if anyone can help me.
0
 
BdLmCommented:


using pc/sc winscard.dll, follow these 3 steps, code is c++, but as I'm, just calling the dll functions there want be to many difference between basic and c.
(i must have somewhere some old vb 5 stuff, i 'll keep on searching my HD) to exchange data between reader and pc.
At the end release scard context.


1)  
//
//      Open a context which communication to the Resource Manager, get the reader names ...
//             and select a reader
  ....
  ret = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &ContextHandle);
  ShowSCardInfo(ret, ContextHandle, "Function SCardEstablishContext");

2)
//
//
//

   //  connect to the reader
  //   T=1, T=0  via RadioBox .... ?
  switch (MyselectedProtocolType)
  {
  case 0:
        ProtocolType = SCARD_PROTOCOL_T0;
        break;
  case 1:
        ProtocolType = SCARD_PROTOCOL_T1 ;
        break;
  case 2:
        ProtocolType = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
        break;
  case 3:
        ProtocolType = SCARD_PROTOCOL_RAW;
        break;

   case 4:
        ProtocolType = SCARD_PROTOCOL_UNDEFINED;
        break;

  default:
        ProtocolType = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
  }

  //  Shared or Exclusive .... ?
  switch (MyselectedAccessType)
  {
  case 0:
        AccessType = SCARD_SHARE_EXCLUSIVE;

        break;
  case 1:
        AccessType = SCARD_SHARE_SHARED ;

        break;
  case 2:
        AccessType = SCARD_SHARE_DIRECT;
        break;
  default:
        AccessType = SCARD_SHARE_EXCLUSIVE;

  }



  ret = SCardConnect(ContextHandle, ReaderName[act_Name], AccessType,
                     ProtocolType, &CardHandle, &ActiveProtocol);

  ShowSCardInfo(ret,ContextHandle, "Funktion SCardConnect");

3
//
//
// now send the data

IO_Request.dwProtocol = ProtocolType;

  switch (ProtocolType)
  {
  case SCARD_PROTOCOL_RAW:
         IO_Request.cbPciLength  = (DWORD) sizeof(SCARD_PCI_RAW);
         break;
  default:
         IO_Request.cbPciLength  = (DWORD) sizeof(SCARD_IO_REQUEST);
         break;
  }


  ResponseLength = MAX_RESPONSE;

  ftime(&t_start);      // option, i want to  measure execution time

  if (DirectAccessmode == false)
     {
      ret = SCardTransmit(CardHandle, &IO_Request, pInBuffer, InBufferLength, 0, pResponseBuffer, &ResponseLength);
      ShowSCardInfo(ret,CardHandle,"Function SCardTransmit(...)");  // my debugging window
     }
     else
     {
     ret = SCardControl( CardHandle,
                         SCARD_CTL_CODE(2048),      //NULL   oder SCARD_CTL_CODE(2052),
                         pInBuffer, InBufferLength,
                         pResponseBuffer, ResponseLength,
                         &BytesReturned);
     ShowSCardInfo(ret,CardHandle,"Function SCardControl(...)");
     }

// calc delta Time as a option ...
  ftime(&t_stop);
  long time_ms = (t_stop.time - t_start.time)*1000 + (t_stop.millitm - t_start.millitm);
 
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
BdLmCommented:
regarding VB code i found this link with a demo

http://www.txsystems.com/pcscindex.html
0
 
harsherAuthor Commented:
thanx for the link... i will have a look at it.... btw i manage to write in the data into the card... but i cannt retrieve it back using the read command... i was hinted that i miss a step... can u tell me what r the steps i must follow to read the data in the card....

example:

i write "AAAA" into the card.... when i take out the card n put it back.... i get "" when i try to read it. i was told by a colleague that i miss out 1 step.... but she dun wan to tell me which step.... so i have to find out myself... can u tell me the steps to read the data in the card..
0
 
BdLmCommented:
As I don't have the manuals for the GEM+ card, i can't help in detail,
I just assume from other application, first you must authenticate
yourselft with the card (present a PIN oder some other secret). If you pass you may start to write.
Does the card responde with #90 #00 to your writing  command?
On the GEM Website have been some tools with perfect reader communication, so send the APDUs manually with such a tool and confirm the correct command sequence. Later on use your own software.

0
 
harsherAuthor Commented:
oh ic..... the "write to card" part is not done by me, done by my colleague, now she wants me to do the "read from card" part....

so.... now i cant read from the card... eheheh :D
0
 
harsherAuthor Commented:
hmmm.... i will give u the points 1st... then if there is any other question i will ask again...
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now