Solved

how to read GemClub Memo?

Posted on 2004-09-15
8
1,077 Views
Last Modified: 2008-02-07
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
Comment
Question by:harsher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 8

Expert Comment

by:BdLm
ID: 12063381
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
 

Author Comment

by:harsher
ID: 12071825
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
 
LVL 8

Expert Comment

by:BdLm
ID: 12073073


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
Technology Partners: 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!

 
LVL 8

Expert Comment

by:BdLm
ID: 12073813
regarding VB code i found this link with a demo

http://www.txsystems.com/pcscindex.html
0
 

Author Comment

by:harsher
ID: 12083071
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
 
LVL 8

Accepted Solution

by:
BdLm earned 100 total points
ID: 12083643
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
 

Author Comment

by:harsher
ID: 12095359
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
 

Author Comment

by:harsher
ID: 12108126
hmmm.... i will give u the points 1st... then if there is any other question i will ask again...
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question