+static int sendPing(void){
+ UsbCommand ping = {CMD_PING, {1, 2, 3}};
+ SendCommand(&ping);
+ SendCommand(&ping);
+ SendCommand(&ping);
+ clearCommandBuffer();
+ UsbCommand resp;
+ if (WaitForResponseTimeout(CMD_ACK, &resp, 1000))
+ return 0;
+ return 1;
+}
+
+static bool sendTry(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint32_t delay, uint8_t *bs, size_t bs_len){
+
+ PrintAndLog("Trying FC: %u; CN: %u", fc, cn);
+ if ( !getAWIDBits(fmtlen, fc, cn, bs)) {
+ PrintAndLog("Error with tag bitstream generation.");
+ return FALSE;
+ }
+
+ uint64_t arg1 = (10<<8) + 8; // fcHigh = 10, fcLow = 8
+ uint64_t arg2 = 50; // clk RF/50 invert=0
+ UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, bs_len}};
+ memcpy(c.d.asBytes, bs, bs_len);
+ clearCommandBuffer();
+ SendCommand(&c);
+ msleep(delay);
+ sendPing();
+ return TRUE;
+}
+
+