-int CmdVikingDemod(const char *Cmd)
-{
- //CmdLFRead("s");
- //getSamples("30000",false);
-
- if (!ASKDemod(Cmd, false, false, 1)) {
- if (g_debugMode) PrintAndLog("ASKDemod failed");
- return 0;
- }
- size_t size = DemodBufferLen;
-
- int ans = VikingDemod_AM(DemodBuffer, &size);
- if (ans < 0) {
- if (g_debugMode) PrintAndLog("Error Viking_Demod %d", ans);
- return 0;
- }
- //got a good demod
- uint32_t raw1 = bytebits_to_byte(DemodBuffer+ans, 32);
- uint32_t raw2 = bytebits_to_byte(DemodBuffer+ans+32, 32);
- uint32_t cardid = bytebits_to_byte(DemodBuffer+ans+24, 32);
- uint8_t checksum = bytebits_to_byte(DemodBuffer+ans+32+24, 8);
- PrintAndLog("Viking Tag Found: Card ID %08X, Checksum: %02X", cardid, checksum);
- PrintAndLog("Raw: %08X%08X", raw1,raw2);
- setDemodBuf(DemodBuffer+ans, 64, 0);
- return 1;
+int CmdVikingRead(const char *Cmd) {
+ // read lf silently
+ CmdLFRead("s");
+ // get samples silently
+ getSamples("12000", TRUE);
+ // demod and output viking ID
+ return CmdVikingDemod(Cmd);