Hello,
I am trying to use the CCID driver (
http://pcsclite.alioth.debian.org/ccid.html) in an embedded Linux to use a
Gemalto Serial Smartcard Reader Chip. I am using PCSC-Lite 1.5.5, and the
CCID driver version 1.3.11.
I have configured the reader:
FRIENDLYNAME "Gemplus GemPC Twin"
DEVICENAME /dev/ttyS1
LIBPATH libccidtwin.so
CHANNELID 1
But when I run pcscd, i get
./pcscd --foreground --debug --apdu
00000000 debuglog.c:230:DebugLogSetLevel() debug level=debug
00000793 debuglog.c:259:DebugLogSetCategory() Debug options: APDU
00012132 readerfactory.c:1024:RFInitializeReader() Attempting startup of
Gemplus GemPC Twin 00 00 using /VaniOs/ccid/serial/libccidtwin.so
00003265 readerfactory.c:877:RFBindFunctions() Loading IFD Handler 3.0
00002113 ifdhandler.c:1532:init_driver() Driver version: 1.3.11
00007825 ifdhandler.c:1545:init_driver() LogLevel: 0x0003
00000705 ifdhandler.c:1555:init_driver() LogLevel from LIBCCID_ifdLogLevel:
0x0007
00007058 ifdhandler.c:1565:init_driver() DriverOptions: 0x0000
00000640 ifdhandler.c:82:IFDHCreateChannelByName() lun: 0, device:
/dev/ttyS1
00000972 ccid_serial.c:649:OpenSerialByName() Reader index: 0, Device:
/dev/ttyS1
00001003 ccid_serial.c:697:OpenSerialByName() Plug-n-Play inhibition
successful
00000968 ccid_serial.c:736:OpenSerialByName() Set serial port baudrate to
4098 and correct configuration
00000958 -> 000000 03 06 6B 01 00 00 00 00 00 00 00 00 02 6D
00001015 ccid_serial.c:235:ReadSerial() start
00000484 ccid_serial.c:355:get_bytes() available: 0, needed: 1
00000467 ccid_serial.c:378:get_bytes() get more data: 1
30000654 ccid_serial.c:436:ReadChunk() Timeout! (30 sec)
00000670 ccid_serial.c:759:OpenSerialByName() Get firmware failed. Maybe the
reader is not connected
00000498 ccid_serial.c:805:CloseSerial() Closing serial device: /dev/ttyS1
00000470 ccid_serial.c:813:CloseSerial() Last slot closed. Release resources
00000972 ifdhandler.c:104:IFDHCreateChannelByName() failed
00000548 readerfactory.c:1050:RFInitializeReader() Open Port 1 Failed
(/dev/ttyS1)
00000479 readerfactory.c:914:RFUnloadReader() Unloading reader driver.
00001245 readerfactory.c:233:RFAddReader() Gemplus GemPC Twin init failed.
00000496 pcscdaemon.c:512:main() pcsc-lite 1.5.5 daemon ready.
00008947 hotplug_linux.c:186:HPReadBundleValues() No bundle files in pcsc
drivers directory: /VaniOs/pcsc/pcsc/drivers
00000680 hotplug_linux.c:187:HPReadBundleValues() Disabling USB support for
pcscd
It seems that the reader is not answering the get firmware version command,
so the driver think that the reader is not connected.
However, I have a program to send the get firmware version command directly
to the serial port, summarized:
#define BAUDRATE B9600
#define MODEMDEVICE "/dev/ttyS1"
int fd,c, res, cont, k;
struct termios oldtio,newtio;
char buf[255];
char buftx[] = {0x42,0x00,5,0x22,0x05,0x3F,0xE0,0x10,0x00}; //22h 05h
3Fh E0h 10h
char cb[255];
for (c = 0; c < 8; c++)
{
buftx[8] ^= buftx[c];
}
fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY );
if (fd <0) { perror(MODEMDEVICE); }
tcgetattr(fd,&oldtio); /* salva configuracion actual del puerto */
memset(&newtio, 0, sizeof(newtio));
newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD;
newtio.c_iflag = IGNPAR;
newtio.c_oflag = 0;
newtio.c_lflag = 0;
newtio.c_cc[VTIME] = 0; /* temporizador entre caracter, no usado */
newtio.c_cc[VMIN] = 0;
tcflush(fd, TCIFLUSH);
tcsetattr(fd,TCSANOW,&newtio);
buf[0] = 0x55;
buf[1] ='\n';
cont = 0;
write(fd, buftx, 9);
for (i = 0; i < 100000; i++)
{
res = read(fd,buf,1);
if (res == 1)
{
cb[cont] = buf[0];
cont++;
}
}
for (k = 0; k < cont; k++)
{
printf (":0x%02X:", cb[k]);
}
printf("\n");
for (k = 0; k < cont; k++)
{
printf ("%c", cb[k]);
}
printf("\n");
And it works perfectly on the same device /dev/ttyS1.
What can I be doing wrong?? I am a bit desperate....
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle