Skip to content

Commit

Permalink
Fix 14443 typos
Browse files Browse the repository at this point in the history
Replaced 1443 --> 14443 and updated public method/alias targets for backwards compatability.

Added 'read' alias to read14b library for compatability with hf_reader.
  • Loading branch information
TheFreeman193 committed May 19, 2019
1 parent 05f43ba commit 2dded95
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
14 changes: 7 additions & 7 deletions armsrc/iso14443b.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ uint8_t iso14443b_select_card(iso14b_card_select_t *card ) {

// VALIDATE CRC
if (!check_crc(CRC_14443_B, Demod.output, Demod.len)) {
if (MF_DBGLEVEL > 3) Dbprintf("iso1443b_setup crc fail");
if (MF_DBGLEVEL > 3) Dbprintf("iso14443b_setup crc fail");
return 3;
}

Expand All @@ -1280,7 +1280,7 @@ uint8_t iso14443b_select_card(iso14b_card_select_t *card ) {

// VALIDATE CRC
if (!check_crc(CRC_14443_B, Demod.output, Demod.len) ) {
if (MF_DBGLEVEL > 3) Dbprintf("iso1443b_setup crc2 fail");
if (MF_DBGLEVEL > 3) Dbprintf("iso14443b_setup crc2 fail");
return 3;
}

Expand Down Expand Up @@ -1314,7 +1314,7 @@ uint8_t iso14443b_select_card(iso14b_card_select_t *card ) {
// Set up ISO 14443 Type B communication (similar to iso14443a_setup)
// field is setup for "Sending as Reader"
void iso14443b_setup() {
if (MF_DBGLEVEL > 3) Dbprintf("iso1443b_setup Enter");
if (MF_DBGLEVEL > 3) Dbprintf("iso14443b_setup Enter");
LEDsoff();
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
//BigBuf_free();
Expand All @@ -1338,7 +1338,7 @@ void iso14443b_setup() {
StartCountSspClk();

LED_D_ON();
if (MF_DBGLEVEL > 3) Dbprintf("iso1443b_setup Exit");
if (MF_DBGLEVEL > 3) Dbprintf("iso14443b_setup Exit");
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1471,7 +1471,7 @@ void ReadSTMemoryIso14443b(uint8_t numofblocks) {
}

static void iso1444b_setup_sniff(void){
if (MF_DBGLEVEL > 3) Dbprintf("iso1443b_setup_sniff Enter");
if (MF_DBGLEVEL > 3) Dbprintf("iso14443b_setup_sniff Enter");
LEDsoff();
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
BigBuf_free();
Expand Down Expand Up @@ -1505,7 +1505,7 @@ static void iso1444b_setup_sniff(void){
// Start the SSP timer
StartCountSspClk();

if (MF_DBGLEVEL > 3) Dbprintf("iso1443b_setup_sniff Exit");
if (MF_DBGLEVEL > 3) Dbprintf("iso14443b_setup_sniff Exit");
}

//=============================================================================
Expand Down Expand Up @@ -1704,4 +1704,4 @@ void SendRawCommand14443B_Ex(UsbCommand *c) {
//FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX | FPGA_HF_READER_TX_SHALLOW_MOD);
}

}
}
8 changes: 1 addition & 7 deletions client/lualibs/hf_reader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ local function sendToDevice(command, ignoreresponse)
return response,nil
end

-------------------------------------------------------
-- This will be moved to a separate 14443B library
-------------------------------------------------------

local reader14443B = {
read = reader14443B.read14443b()
}
-------------------------------------------------------
-- This will be moved to a separate 1593 library
-------------------------------------------------------
Expand Down Expand Up @@ -185,4 +179,4 @@ end

return {
waitForTag = waitForTag,
}
}
4 changes: 2 additions & 2 deletions client/lualibs/read14a.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ local function parse14443a(data)
local count, uid, uidlen, atqa, sak, ats_len, ats = bin.unpack('H10CH2CC',data)
uid = uid:sub(1, 2*uidlen)
--print("uid, atqa, sak: ",uid, atqa, sak)
--print("TYPE: ", tostring_1443a(sak))
--print("TYPE: ", tostring_14443a(sak))
return { uid = uid, atqa = atqa, sak = sak, name = tostring_14443a(sak), data = data}
end

Expand Down Expand Up @@ -141,7 +141,7 @@ local function waitFor14443a()
end
local library = {
read = read14443a,
read = read14443a,
read14443a = read14443a,
waitFor14443a = waitFor14443a,
parse14443a = parse14443a,
sendToDevice = sendToDevice,
Expand Down
15 changes: 9 additions & 6 deletions client/lualibs/read14b.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This is a library to read 14443b tags. It can be used something like this
local reader = require('read14b')
result, err = reader.select1443b()
result, err = reader.select14443b()
if not result then
print(err)
return
Expand All @@ -25,7 +25,7 @@ local ISO14B_COMMAND = {
ISO14B_SELECT_SR = 0x80,
}

local function parse1443b(data)
local function parse14443b(data)
--[[
Based on this struct :
Expand Down Expand Up @@ -101,7 +101,7 @@ local function read14443b(disconnect)
local count,cmd,arg0,arg1,arg2 = bin.unpack('LLLL',result)
if arg0 == 0 then
data = string.sub(result, count)
info, err = parse1443b(data)
info, err = parse14443b(data)
else
err = "iso14443b card select failed"
end
Expand Down Expand Up @@ -147,12 +147,15 @@ local function waitFor14443b()
end

local library = {
parse1443b = parse1443b,
read1443b = read14443b,
parse14443b = parse14443b,
parse1443b = parse14443b,
read = read14443b,
read14443b = read14443b,
read1443b = read14443b,
waitFor14443b = waitFor14443b,
sendToDevice = sendToDevice,
showData = showData,
ISO14B_COMMAND = ISO14B_COMMAND,
}

return library
return library
2 changes: 1 addition & 1 deletion client/scripts/amiibo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ local function main(args)
return
end

parsed_tag = reader.parse1443a(tag)
parsed_tag = reader.parse14443a(tag)
print('Tag type:', parsed_tag.name)
print('Tag UID:', parsed_tag.uid)
print('Tag len:', tag:len())
Expand Down

0 comments on commit 2dded95

Please sign in to comment.