Skip to content

Commit

Permalink
reader application fixes: changed identify typo, fixed identify bugs,…
Browse files Browse the repository at this point in the history
… select function resets Selected variable if necessary
  • Loading branch information
geo-rg committed Apr 4, 2017
1 parent b1e457c commit 65e5383
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions Firmware/Chameleon-Mini/Application/Reader14443A.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,12 @@ INLINE uint16_t Reader14443A_Deselect(uint8_t* Buffer) // deselects the card bec
INLINE uint16_t Reader14443A_Select(uint8_t * Buffer, uint16_t BitCount)
{
if (Selected)
return 0;
{
if (ReaderState > STATE_HALT)
return 0;
else
Selected = false;
}
switch (ReaderState)
{
case STATE_IDLE:
Expand Down Expand Up @@ -540,14 +545,15 @@ uint16_t Reader14443AAppProcess(uint8_t* Buffer, uint16_t BitCount)
/************************************
* This function identifies a PICC. *
************************************/
case Reader14443_Indentify:
case Reader14443_Identify:
{
uint16_t rVal = Reader14443A_Select(Buffer, BitCount);
if (Selected)
{
if (ReaderState >= STATE_SAK_CL1 && ReaderState <= STATE_SAK_CL3)
{
bool ISO14443_4A_compliant = IS_ISO14443A_4_COMPLIANT(Buffer);
CardCandidatesIdx = 0;

uint8_t i;
for (i = 0; i < ARRAY_COUNT(CardIdentificationList); i++)
Expand Down Expand Up @@ -652,7 +658,7 @@ uint16_t Reader14443AAppProcess(uint8_t* Buffer, uint16_t BitCount)
CardCandidatesIdx = 0;
return Reader14443A_Deselect(Buffer);
}
switch (Buffer[3])
switch (Buffer[5])
{
case 0x00:
CardCandidatesIdx = 1;
Expand Down
2 changes: 1 addition & 1 deletion Firmware/Chameleon-Mini/Application/Reader14443A.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef enum {
Reader14443_Send_Raw,
Reader14443_Get_UID,
Reader14443_Read_MF_Ultralight,
Reader14443_Indentify
Reader14443_Identify
} Reader14443Command;


Expand Down
2 changes: 1 addition & 1 deletion Firmware/Chameleon-Mini/Terminal/Commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ CommandStatusIdType CommandExecIdentifyCard(char* OutMessage)
return COMMAND_ERR_INVALID_USAGE_ID;
ApplicationReset();

Reader14443CurrentCommand = Reader14443_Indentify;
Reader14443CurrentCommand = Reader14443_Identify;
Reader14443AAppInit();
Reader14443ACodecStart();
CommandLinePendingTaskTimeout = &Reader14443AAppTimeout;
Expand Down

0 comments on commit 65e5383

Please sign in to comment.