CHG: NO_RATS adjustments to luascripts.
This commit is contained in:
@@ -15,6 +15,8 @@ Arguments:
|
||||
-p stay connected - dont inactivate the field
|
||||
-x <payload> Data to send (NO SPACES!)
|
||||
-d Debug flag
|
||||
-t Topaz mode
|
||||
-3 ISO14443-4 (use RATS)
|
||||
|
||||
Examples :
|
||||
|
||||
@@ -78,15 +80,19 @@ function main(args)
|
||||
local stayconnected = false
|
||||
local payload = nil
|
||||
local doconnect = true
|
||||
|
||||
local topaz_mode = false
|
||||
local no_rats = false
|
||||
|
||||
-- Read the parameters
|
||||
for o, a in getopt.getopt(args, 'corcpx:') do
|
||||
for o, a in getopt.getopt(args, 'corcpx:t3') do
|
||||
if o == "o" then doconnect = false end
|
||||
if o == "r" then ignore_response = true end
|
||||
if o == "c" then appendcrc = true end
|
||||
if o == "p" then stayconnected = true end
|
||||
if o == "x" then payload = a end
|
||||
if o == "d" then DEBUG = true end
|
||||
if o == "t" then topaz_mode = true end
|
||||
if o == "3" then no_rats = true end
|
||||
end
|
||||
|
||||
-- First of all, connect
|
||||
@@ -94,7 +100,7 @@ function main(args)
|
||||
dbg("doconnect")
|
||||
-- We reuse the connect functionality from a
|
||||
-- common library
|
||||
info, err = lib14a.read1443a(true)
|
||||
info, err = lib14a.read1443a(true, no_rats)
|
||||
|
||||
if err then return oops(err) end
|
||||
print(("Connected to card, uid = %s"):format(info.uid))
|
||||
@@ -102,7 +108,7 @@ function main(args)
|
||||
|
||||
-- The actual raw payload, if any
|
||||
if payload then
|
||||
res,err = sendRaw(payload,{ignore_response = ignore_response})
|
||||
res,err = sendRaw(payload,{ignore_response = ignore_response, topaz_mode = topaz_mode})
|
||||
if err then return oops(err) end
|
||||
|
||||
if not ignoreresponse then
|
||||
@@ -131,13 +137,15 @@ function showdata(usbpacket)
|
||||
--print("----------------")
|
||||
end
|
||||
|
||||
|
||||
|
||||
function sendRaw(rawdata, options)
|
||||
print(">> ", rawdata)
|
||||
|
||||
local flags = lib14a.ISO14A_COMMAND.ISO14A_NO_DISCONNECT + lib14a.ISO14A_COMMAND.ISO14A_RAW
|
||||
|
||||
if options.topaz_mode then
|
||||
flags = flags + lib14a.ISO14A_COMMAND.ISO14A_TOPAZMODE
|
||||
end
|
||||
|
||||
local command = Command:new{cmd = cmds.CMD_READER_ISO_14443a,
|
||||
arg1 = flags, -- Send raw
|
||||
-- arg2 contains the length, which is half the length
|
||||
@@ -149,14 +157,12 @@ end
|
||||
|
||||
-- Sends an instruction to do nothing, only disconnect
|
||||
function disconnect()
|
||||
|
||||
local command = Command:new{cmd = cmds.CMD_READER_ISO_14443a, arg1 = 0, }
|
||||
-- We can ignore the response here, no ACK is returned for this command
|
||||
-- Check /armsrc/iso14443a.c, ReaderIso14443a() for details
|
||||
return lib14a.sendToDevice(command,true)
|
||||
end
|
||||
|
||||
|
||||
-------------------------
|
||||
-- Testing
|
||||
-------------------------
|
||||
|
||||
Reference in New Issue
Block a user