Skip to content

Instantly share code, notes, and snippets.

@cuu
Last active November 24, 2022 12:48
Show Gist options
  • Save cuu/c74afa857a34960853b07ac3415f5e85 to your computer and use it in GitHub Desktop.
Save cuu/c74afa857a34960853b07ac3415f5e85 to your computer and use it in GitHub Desktop.
24c.c
#include "comPro.h"
#include <stdio.h>
#include <string.h>
int main(int argc,char* argv[])
{
int icdev,st,number;
char szVer[128];
int iNode = 0;
char szNode[128];
unsigned char cardSt;
//usb port ...
do
{
sprintf(szNode, "/dev/usb/hiddev%d", iNode);
iNode++;
if((icdev=lc_init_ex(2,szNode,115200))== -1)
{
printf("lc_init ERR %d\n",icdev);
return 0;
}
else
{
st = lc_iccGetCardState(icdev, 0, &cardSt);
if(cardSt ==0)
{
printf("No card found,Please Insert....");
break;
}
if(st == 0)
{
printf(" Found card %d\n",icdev);
lc_iccSelCardType(icdev, SLOT_ICC_MSR, 1);
break;
}
}
}while(icdev != -1);
unsigned char wData[6]={0x0f,0x02,0x03,0x04,0x05,0x06};
st = lc_icc_WriteMem(icdev,SLOT_ICC_MSR,0,6, wData);
if(st ==0 ){
printf("write 24c card OK\n");
}else{
printf("write 24c card failed %d\n",st);
}
lc_exit(icdev);
return 0;
}
//gcc -fPIC -o 24c1 -g 24c.c ./x64/libcomPro.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment