diff --git a/client/scripts/test_t55x7.lua b/client/scripts/test_t55x7.lua index 412f4acb8..fddb19817 100644 --- a/client/scripts/test_t55x7.lua +++ b/client/scripts/test_t55x7.lua @@ -39,7 +39,8 @@ Arguments: -h this help ]] -local DEBUG = false -- the debug flag +local DEBUG = true -- the debug flag +local TIMEOUT = 1500 local total_tests = 0 local total_pass = 0 @@ -237,7 +238,9 @@ local function test(modulation) local process_block0_cmds = {} local y - local block = '00' + local password = '00000000' + local block = '00' -- configuration block 0 + local flags = '00' -- page 0, no pwd, no testmode local s = ('Start test of %s'):format(modulation) print(s) @@ -251,16 +254,14 @@ local function test(modulation) local p_config_cmd = process_block0_cmds[_] local errors = 0 core.clearCommandBuffer() - + -- Write Config block dbg(('lf t55xx write b 0 d %s'):format(p_config_cmd)) - local config = tonumber(p_config_cmd, 16) - local wc = Command:newMIX{ - cmd = cmds.CMD_T55XX_WRITE_BLOCK - , arg1 = config - , arg2 = block - } - local response, err = wc:sendMIX(false) + + local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(p_config_cmd, 32), password, block, flags) + + local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data} + local response, err = wc:sendNG(false, TIMEOUT) if not response then return oops(err) end -- Detect @@ -309,7 +310,7 @@ local function main(args) -- Adjust this table to set which configurations should be tested -- local test_modes = { 'PSK1', 'PSK2', 'PSK3', 'FSK1', 'FSK2', 'FSK1A', 'FSK2A', 'ASK', 'BI' } - local test_modes = { 'ASK', 'PSK1' } + local test_modes = { 'ASK' } for _ = 1, #test_modes do res = WipeCard() diff --git a/client/scripts/test_t55x7_ask.lua b/client/scripts/test_t55x7_ask.lua index 0570aa855..ecf02346b 100644 --- a/client/scripts/test_t55x7_ask.lua +++ b/client/scripts/test_t55x7_ask.lua @@ -48,6 +48,7 @@ Arguments: ]] local DEBUG = true -- the debug flag +local TIMEOUT = 1500 --BLOCK 0 = 00008040 ASK / MAN local config1 = '00' @@ -101,7 +102,9 @@ end local function test() local y + local password = '00000000' local block = '00' + local flags = '00' for y = 0x0, 0x1d, 0x4 do for _ = 1, #procedurecmds do local pcmd = procedurecmds[_] @@ -111,14 +114,11 @@ local function test() elseif _ == 1 then local config = pcmd:format(config1, y, config2) - dbg(('lf t55xx write b 0 d %s'):format(config)) - config = tonumber(config, 16) - local wc = Command:newMIX{ - cmd = cmds.CMD_T55XX_WRITE_BLOCK - , arg1 = config - , arg2 = block - } - local response, err = wc:sendMIX(false) + dbg(('lf t55xx write b 0 d %s'):format(config)) + local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(config, 32), password, block, flags) + + local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data} + local response, err = wc:sendNG(false, TIMEOUT) if not response then return oops(err) end else diff --git a/client/scripts/test_t55x7_bi.lua b/client/scripts/test_t55x7_bi.lua index 67f9ccec3..0b0239717 100644 --- a/client/scripts/test_t55x7_bi.lua +++ b/client/scripts/test_t55x7_bi.lua @@ -42,6 +42,7 @@ Arguments: ]] local DEBUG = true -- the debug flag +local TIMEOUT = 1500 --BLOCK 0 = 00010040 BIPHASE local config1 = '00' @@ -95,7 +96,9 @@ end local function test() local y + local password = '00000000' local block = '00' + local flags = '00' for y = 1, 0x1D, 4 do for _ = 1, #procedurecmds do local pcmd = procedurecmds[_] @@ -107,13 +110,11 @@ local function test() local config = pcmd:format(config1, y, config2) dbg(('lf t55xx write b 0 d %s'):format(config)) - config = tonumber(config, 16) - local wc = Command:newMIX{ - cmd = cmds.CMD_T55XX_WRITE_BLOCK - , arg1 = config - , arg2 = block - } - local response, err = wc:sendMIX(false) + local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(config, 32), password, block, flags) + + local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data} + local response, err = wc:sendNG(false, TIMEOUT) + if not response then return oops(err) end else dbg(pcmd) diff --git a/client/scripts/test_t55x7_fsk.lua b/client/scripts/test_t55x7_fsk.lua index b58c213d1..abf4692d7 100644 --- a/client/scripts/test_t55x7_fsk.lua +++ b/client/scripts/test_t55x7_fsk.lua @@ -44,6 +44,7 @@ Arguments: ]] local DEBUG = true -- the debug flag +local TIMEOUT = 1500 --BLOCK 0 = 00008040 FSK local config1 = '00' @@ -97,7 +98,9 @@ end local function test(modulation) local y + local password = '00000000' local block = '00' + local flags = '00' for y = 0x0, 0x1d, 0x4 do for _ = 1, #procedurecmds do local pcmd = procedurecmds[_] @@ -108,14 +111,10 @@ local function test(modulation) local config = pcmd:format(config1, y, modulation, config2) dbg(('lf t55xx write b 0 d %s'):format(config)) + local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(config, 32), password, block, flags) - config = tonumber(config,16) - local wc = Command:newMIX{ - cmd = cmds.CMD_T55XX_WRITE_BLOCK - , arg1 = config - , arg2 = block - } - local response, err = wc:sendMIX(false) + local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data} + local response, err = wc:sendNG(false, TIMEOUT) if not response then return oops(err) end else dbg(pcmd) diff --git a/client/scripts/test_t55x7_psk.lua b/client/scripts/test_t55x7_psk.lua index 43798ff47..2c0efa163 100644 --- a/client/scripts/test_t55x7_psk.lua +++ b/client/scripts/test_t55x7_psk.lua @@ -40,6 +40,7 @@ Arguments: ]] local DEBUG = true -- the debug flag +local TIMEOUT = 1500 -- --BLOCK 0 = 00 08 80 40 PSK -- ----------- @@ -97,7 +98,9 @@ end local function test(modulation) local bitrate local clockrate + local password = '00000000' local block = '00' + local flags = '00' for bitrate = 0x0, 0x1d, 0x4 do for clockrate = 0,8,4 do @@ -114,13 +117,10 @@ local function test(modulation) local config = cmd:format(bitrate, modulation, clockrate) dbg(('lf t55xx write b 0 d %s'):format(config)) - config = tonumber(config, 16) - local wc = Command:newMIX{ - cmd = cmds.CMD_T55XX_WRITE_BLOCK - , arg1 = config - , arg2 = block - } - local response, err = wc:sendMIX(false) + local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(config, 32), password, block, flags) + + local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data} + local response, err = wc:sendNG(false, TIMEOUT) if not response then return oops(err) end else dbg(cmd)