Solved

how to read GemClub Memo?

Posted on 2004-09-15
8
1,042 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

809 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