Skip to content

Commit

Permalink
Add Microchip SEC1210 UART support.
Browse files Browse the repository at this point in the history
The Microchip SEC1210 can be connected on a serial port instead of USB.
  • Loading branch information
Fabio Araujo authored and LudovicRousseau committed May 17, 2017
1 parent 582f882 commit ec652d2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ccid.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ typedef struct
#define SCR331DI 0x04E65111
#define SCR331DINTTCOM 0x04E65120
#define SDI010 0x04E65121
#define SEC1210 0x04241202
#define CHERRYXX33 0x046A0005
#define CHERRYST2000 0x046A003E
#define OZ776 0x0B977762
Expand Down
23 changes: 23 additions & 0 deletions src/ccid_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ static status_t set_ccid_descriptor(unsigned int reader_index,
readerID = GEMCORESIMPRO2;
else if (0 == strcasecmp(reader_name,"GemPCPinPad"))
readerID = GEMPCPINPAD;
else if (0 == strcasecmp(reader_name,"SEC1210"))
readerID = SEC1210;

/* check if the same channel is not already used to manage multi-slots readers*/
for (i = 0; i < CCID_DRIVER_MAX_READERS; i++)
Expand Down Expand Up @@ -574,6 +576,11 @@ static status_t set_ccid_descriptor(unsigned int reader_index,
serialDevice[reader_index].ccid.dwMaxDataRate = 125000;
break;

case SEC1210:
serialDevice[reader_index].ccid.arrayOfSupportedDataRates = NULL;
serialDevice[reader_index].ccid.dwMaxDataRate = 826000;
break;

/* GemPC Twin or GemPC Card */
default:
serialDevice[reader_index].ccid.arrayOfSupportedDataRates = SerialTwinDataRates;
Expand Down Expand Up @@ -649,6 +656,16 @@ static status_t set_ccid_descriptor(unsigned int reader_index,
serialDevice[reader_index].ccid.arrayOfSupportedDataRates = SerialExtendedDataRates;
serialDevice[reader_index].ccid.dwMaxDataRate = 500000;
break;

case SEC1210:
serialDevice[reader_index].ccid.dwFeatures = 0x000100B2;
serialDevice[reader_index].ccid.dwDefaultClock = 4800;
serialDevice[reader_index].ccid.dwMaxDataRate = 826000;
serialDevice[reader_index].ccid.arrayOfSupportedDataRates = NULL;
serialDevice[reader_index].ccid.bMaxSlotIndex = 1; /* 2 slots */
serialDevice[reader_index].echo = FALSE;
break;

}

end:
Expand Down Expand Up @@ -834,6 +851,11 @@ status_t OpenSerialByName(unsigned int reader_index, char *dev_name)
unsigned char rx_buffer[50];
unsigned int rx_length = sizeof(rx_buffer);

if (0 == strcasecmp(reader_name,"SEC1210"))
{
tx_buffer[0] = 0x06;
}

/* 2 seconds timeout to not wait too long if no reader is connected */
if (IFD_SUCCESS != CmdEscape(reader_index, tx_buffer, sizeof(tx_buffer),
rx_buffer, &rx_length, 2*1000))
Expand All @@ -850,6 +872,7 @@ status_t OpenSerialByName(unsigned int reader_index, char *dev_name)
/* perform a command to configure GemPC Twin reader card movement
* notification to synchronous mode: the card movement is notified _after_
* the host command and _before_ the reader anwser */
if (0 != strcasecmp(reader_name,"SEC1210"))
{
unsigned char tx_buffer[] = { 0x01, 0x01, 0x01};
unsigned char rx_buffer[50];
Expand Down
1 change: 1 addition & 0 deletions src/reader.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# GemCoreSIMPro2
# GemPCPinPad
# GemPCTwin (default value)
# SEC1210 (Dual slot Reader)
# example: /dev/ttyS0:GemPCPinPad
#DEVICENAME /dev/ttySn[:reader]
#FRIENDLYNAME "GemPCTwin serial"
Expand Down

8 comments on commit ec652d2

@ronie19
Copy link

@ronie19 ronie19 commented on ec652d2 Jun 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, my sec1210 custom board is on the way. Using it with raspberry Pi serial port GPIOs. I won't be using USB devices anymore. I have enabled serial port and installed pyscard and pcsc drivers from your blog instructions. Any extra configuration to be made for the system to detect card readers in pcsc_scan using serial port readers ?

@LudovicRousseau
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ronie19
Copy link

@ronie19 ronie19 commented on ec652d2 Jun 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/LudovicRousseau/CCID/blob/master/INSTALL#L58

Thanks for heads up. I will try for the SEC1210 part mentioned on that file. Will get back if I face any issues. Hope the setup works.

@ronie19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/LudovicRousseau/CCID/blob/master/INSTALL#L58

Hi, I did complete installation of CCID upto the instructions suggested by you https://github.com/LudovicRousseau/CCID/blob/master/INSTALL#L80
BUT I had to create reader.conf file as suggested in https://github.com/LudovicRousseau/CCID/blob/master/INSTALL#L61 as it was not there.
Thanks for guidance.
Please tell me that for Microchip SEC1210 do I need to add DEVICENAME as suggested in https://github.com/LudovicRousseau/CCID/blob/master/INSTALL#L95 ????
Also How to test the SEC1210 installation ? Shall I run pcsc_scan command on command line to detect the same ?
Awaiting your valuable reply.

@LudovicRousseau
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.
I just pushed a change to document that 4d5cbf7

@ronie19
Copy link

@ronie19 ronie19 commented on ec652d2 Jun 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.
I just pushed a change to document that 4d5cbf7

I did
$ ./configure --enable-twinserial --disable-libusb (as I dont want to use USB, only embedded processor serial pins)
$ make
$ make install

then I did create and edit /etc/reader.conf to
FRIENDLYNAME "SEC1210 READER"
DEVICENAME /dev/ttyS0:SEC1210
LIBPATH /usr/lib/pcsc/drivers/serial/libccidtwin.so

I hope it works. ??
Though my hardware PCB is on the way. I will update after I use it in few days.

@ronie19
Copy link

@ronie19 ronie19 commented on ec652d2 Aug 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.
I just pushed a change to document that 4d5cbf7

I have a small update that I observed and like to convey.
In line

CCID/INSTALL

Line 61 in 4d5cbf7

You have to create or edit the file /etc/reader.conf. The file should
it is said that I have to make a new file or edit /etc/reader.conf but that didn't work for me. Rather I had to edit /etc/reader.conf.d/libccidtwin that contains same parameters. I edited this file as per the instructions above for SEC1210 and its working like charm.

@LudovicRousseau
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact.
Fixed in 94bddf6

Please sign in to comment.