From 205774122b360ad813c041768a6c6139d46c7a76 Mon Sep 17 00:00:00 2001 From: taichunmin Date: Wed, 4 Sep 2024 22:04:43 +0800 Subject: [PATCH] fix cmdSlotSetActive --- pug/src/lf-em410x.pug | 2 +- pug/src/mfkey32.pug | 2 +- pug/src/mifare-xiaomi.pug | 2 +- pug/src/mifare1k.pug | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pug/src/lf-em410x.pug b/pug/src/lf-em410x.pug index 20c766b..e3f945a 100644 --- a/pug/src/lf-em410x.pug +++ b/pug/src/lf-em410x.pug @@ -152,8 +152,8 @@ block script await ultra.cmdSlotResetTagType(slot, TagType.EM410X) await ultra.cmdSlotSetEnable(slot, FreqType.LF, true) if (_.isString(name) && name.length > 0) await ultra.cmdSlotSetFreqName(slot, FreqType.LF, name) - await ultra.cmdEm410xSetEmuId(uid) await ultra.cmdSlotSetActive(slot) + await ultra.cmdEm410xSetEmuId(uid) await Swal.fire({ icon: 'success', title: 'Emulate success' }) } catch (err) { ultra.emitter.emit('error', err) diff --git a/pug/src/mfkey32.pug b/pug/src/mfkey32.pug index e6697f6..31b645a 100644 --- a/pug/src/mfkey32.pug +++ b/pug/src/mfkey32.pug @@ -195,6 +195,7 @@ block script await ultra.cmdSlotChangeTagType(slot, tagType ? TagType.MIFARE_4096 : TagType.MIFARE_1024) await ultra.cmdSlotResetTagType(slot, tagType ? TagType.MIFARE_4096 : TagType.MIFARE_1024) await ultra.cmdSlotSetEnable(slot, FreqType.HF, true) + await ultra.cmdSlotSetActive(slot) // set anti-coll const tag = { atqa: Buffer.from(atqa, 'hex').reverse(), @@ -211,7 +212,6 @@ block script tag.atqa.copy(block0, tag.uid.length + 2) // atqa console.log(`block0 = ${block0.toString('hex')}`) await ultra.cmdMf1EmuWriteBlock(0, block0) // set block0 - await ultra.cmdSlotSetActive(slot) await ultra.cmdSlotSaveSettings() await Swal.fire({ icon: 'success', title: 'Emulate successfully!' }) } catch (err) { diff --git a/pug/src/mifare-xiaomi.pug b/pug/src/mifare-xiaomi.pug index 093a606..011261e 100644 --- a/pug/src/mifare-xiaomi.pug +++ b/pug/src/mifare-xiaomi.pug @@ -343,9 +343,9 @@ block script await ultra.cmdSlotChangeTagType(slot, TagType.MIFARE_1024) await ultra.cmdSlotResetTagType(slot, TagType.MIFARE_1024) await ultra.cmdSlotSetEnable(slot, FreqType.HF, true) + await ultra.cmdSlotSetActive(slot) await ultra.cmdMf1SetAntiCollMode(true) await ultra.cmdMf1EmuWriteBlock(0, dump.subarray(0, 16)) // set block0 - await ultra.cmdSlotSetActive(slot) await ultra.cmdSlotSaveSettings() await Swal.fire({ icon: 'success', title: 'Emulate successfully!' }) } catch (err) { diff --git a/pug/src/mifare1k.pug b/pug/src/mifare1k.pug index 58145d6..89aaf51 100644 --- a/pug/src/mifare1k.pug +++ b/pug/src/mifare1k.pug @@ -275,6 +275,7 @@ block script await ultra.cmdSlotResetTagType(slot, TagType.MIFARE_1024) await ultra.cmdSlotSetEnable(slot, FreqType.HF, true) if (_.isString(name) && name.length > 0) await ultra.cmdSlotSetFreqName(slot, FreqType.HF, name) + await ultra.cmdSlotSetActive(slot) await ultra.cmdMf1SetAntiCollMode(antiColl) await ultra.cmdMf1SetDetectionEnable(detection) await ultra.cmdMf1SetGen1aMode(gen1a) @@ -291,7 +292,6 @@ block script const sectorData = Buffer.from(dump[i], 'hex') await ultra.cmdMf1EmuWriteBlock(i << 2, sectorData) } - await ultra.cmdSlotSetActive(slot) await Swal.fire({ icon: 'success', title: 'Emulate success' }) } catch (err) { ultra.emitter.emit('error', err)