Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Add Microchip SEC1210 UART Support. #34

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
-Add Microchip SEC1210 UART Support.
  • Loading branch information
Fabio Araujo committed May 15, 2017
commit e9f4b81064f672bd7d240945b1d8c167efa55b53
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 @@ -573,6 +575,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:
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 @@ -833,6 +850,11 @@ status_t OpenSerialByName(unsigned int reader_index, char *dev_name)
unsigned char tx_buffer[] = { 0x02 };
unsigned char rx_buffer[50];
unsigned int rx_length = sizeof(rx_buffer);

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

Choose a reason for hiding this comment

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

I think I will change the code to use a if () {} else {} here.

Copy link
Owner

Choose a reason for hiding this comment

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

What is this command 0x06?
The command 0x02 used to get the firmware does not work?

Copy link
Author

Choose a reason for hiding this comment

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

when we sent 0x02 to get firmware version,
"03 06 6B 01 00 00 00 00 00 00 00 00 02 6D"
we received
frame: "83 00 00 00 00 00 00 41 00 00" - "Command not supported."

when we sent 0x06 to get firmware version,
"03 06 6B 01 00 00 00 00 00 00 00 00 06 69"
we received
frame: "83 01 00 00 00 00 00 01 00 00 22", "Everything OK."


/* 2 seconds timeout to not wait too long if no reader is connected */
if (IFD_SUCCESS != CmdEscape(reader_index, tx_buffer, sizeof(tx_buffer),
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 Uart Reader)
Copy link
Owner

Choose a reason for hiding this comment

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

I guess you mean "dual slot" here?
The way the two slots are internally managed is not really relevant for users.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you are right

# example: /dev/ttyS0:GemPCPinPad
#DEVICENAME /dev/ttySn[:reader]
#FRIENDLYNAME "GemPCTwin serial"
Expand Down