Hello everyone, I am trying to use SLIX2 tag with PN7120 controller in android and trying to utilize API's of settings password for few blocks for read/write access management and few blocks for EAS/AFI password. To make these working, getRandomNumber command has to work before i write & set password by XORing.
Here is what I am getting after initial reading of TAG type, checking & parsing system info and finally close the connection. Connect again for further programming the Tag, but after few seconds of connect, TAG was lost :
ID: =: rawCmd: cmd=0x90 F4 D6 00 08 01 04 E0 D/isX =: false D/isX2 =: true D/ICode: Iso15693Tag: connect D/ICode: Iso15693Tag: getSystemInfo I/ICode: getCardInfo flags: 32 D/ICode: rawCmd PARAMETERS: nfcVCmd :43 flags: 32 params: [00] 90 F4 D6 00 08 01 04 E0 |.|.|.|.|.|.|.|.| D/ICode: Inventory in rawCmd : true D/ICode: addressed in rawCmd : false D/ICode: cmd in rawCmd : [00] 00 00 00 00 00 00 00 00 |.|.|.|.|.|.|.|.| [08] 00 00 |. |. | D/ICode: rawCmd: params.length=0x8 D/ICode: rawCmd: cmd=0x20 2B 90 F4 D6 00 08 01 04 E0 D/ICode: rawCmd: rsp=0x00 0F 90 F4 D6 00 08 01 04 E0 00 00 4F 03 01 D/ICode: SystemInfo: [00] 0F 90 F4 D6 00 08 01 04 |.|.|.|.|.|.|.|.| [08] E0 00 00 4F 03 01 |. |. |. |O |. |. | D/ICode: Iso15693Tag: parseSystemInfo D/ICode: .parseSystemInfo mSysInfo: 0x0F 90 F4 D6 00 08 01 04 E0 00 00 4F 03 01 D/ICode: mSysInfo[0]: 0x0F D/ICode: Iso15693Tag: checkReadSupport D/ICode: Iso15693Tag: mUid=0x90 F4 D6 00 08 01 04 E0 D/ICode: Iso15693Tag: mDsfid=0x00 D/ICode: Iso15693Tag: numblocks=80 D/ICode: Iso15693Tag: blocksize=4 D/ICode: Iso15693Tag: mDsfidSupported=true D/ICode: Iso15693Tag: mAfiSupported =true D/ICode: Iso15693Tag: mIcRef =1 ===============ICodeTag connection close ============= ===============ICodeTag connect======================= D/ICode: rawCmd PARAMETERS: nfcVCmd :-78 flags: 32 params: D/ICode: Inventory in rawCmd : true D/ICode: addressed in rawCmd : false D/ICode: cmd in rawCmd : [00] 00 00 |. |. | D/ICode: rawCmd: params.length=0x0 D/ICode: rawCmd: cmd=0x20 B2 W/System.err: android.nfc.TagLostException: Tag was lost. W/System.err: at android.nfc.TransceiveResult.getResponseOrThrow(TransceiveResult.java:48) W/System.err: at android.nfc.tech.BasicTagTechnology.transceive(BasicTagTechnology.java:151) W/System.err: at android.nfc.tech.NfcV.transceive(NfcV.java:115) W/System.err: at com.potrero.acmslix2.ICode.transceive(ICode.kt:382) W/System.err: at com.potrero.acmslix2.ICode.rawCmd(ICode.kt:446) W/System.err: at com.potrero.acmslix2.ICodeCommon.getRandomNumber(ICodeCommon.kt:167) W/System.err: at com.potrero.acmslix2.MainActivity.programTag(MainActivity.kt:256) W/System.err: at com.potrero.acmslix2.MainActivity.filterIntent(MainActivity.kt:173) W/System.err: at com.potrero.acmslix2.MainActivity.onNewIntent(MainActivity.kt:415) W/System.err: at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1224) W/System.err: at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1236) W/System.err: at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2803) W/System.err: at android.app.ActivityThread.performNewIntents(ActivityThread.java:2818) W/System.err: at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2834) W/System.err: at android.app.ActivityThread.-wrap15(ActivityThread.java) W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102) W/System.err: at android.os.Looper.loop(Looper.java:154) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6121) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Code :
mTag = tag mNfcV = NfcV.get(tag) if (mNfcV == null) { return } // read UID mUid = tag.id // read DFSID if programmed mDsfid = mNfcV.dsfId try { Log.d(TAG, "Iso15693Tag: connect") connect() Log.d(TAG, "Iso15693Tag: getSystemInfo") val systeminfo = getCardInfoHelper(NFCV_FLAG_ADDRESS) Log.d(TAG, "SystemInfo: "+Utils.hexDump(systeminfo)) Log.d(TAG, "Iso15693Tag: parseSystemInfo") parseSystemInfo(systeminfo) // If getSystemInfo is not supported, get the blocksize and number // of block through read commands Log.d(TAG, "Iso15693Tag: checkReadSupport") checkReadSupport() } catch (e: IOException) { Log.d(TAG, "Iso15693Tag: Error, no response") } try { close() } catch (e: IOException) { e.printStackTrace() } Log.d(TAG, Utils.dumpHex(mUid, "Iso15693Tag: mUid=0x", " ")) Log.d(TAG, Utils.dumpHex(mDsfid, "Iso15693Tag: mDsfid=0x")) Log.d(TAG, "Iso15693Tag: numblocks=$mNumBlocks") Log.d(TAG, "Iso15693Tag: blocksize=$mBlockSize") Log.d(TAG, "Iso15693Tag: mDsfidSupported=$mDsfidSupported") Log.d(TAG, "Iso15693Tag: mAfiSupported =$mAfiSupported") Log.d(TAG, "Iso15693Tag: mIcRef =$mIcRef") mType = "SLIX2" -------------------- programTag() {try { iCodeTag.connect()val readWriteBlock = iCodeTag.getRandomNumber() val xorPwd = Utils.xor(Utils.append(readWriteBlock, readWriteBlock)!!, byteArrayOf(0, 0, 0, 0)) iCodeTag.setPasswordRead(xorPwd) iCodeTag.setPasswordWrite(xorPwd) }catch (e: IOException) { e.printStackTrace() Log.e("Activity", "Exception: ", e) } }
According to the datasheet 9.5.3.1 GET RANDOM NUMBER, the request format is: