mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
Add SendCommandOLD
This commit is contained in:
parent
b860cc6eaf
commit
9bd59a8d40
3 changed files with 18 additions and 8 deletions
|
@ -419,8 +419,7 @@ static int CmdStatus(const char *Cmd) {
|
||||||
(void)Cmd; // Cmd is not used so far
|
(void)Cmd; // Cmd is not used so far
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
PacketCommandOLD c = {CMD_STATUS, {0, 0, 0}, {{0}}};
|
SendCommandOLD(CMD_STATUS, 0, 0, 0, NULL, 0);
|
||||||
SendCommand(&c);
|
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1900))
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1900))
|
||||||
PrintAndLogEx(NORMAL, "Status command failed. USB Speed Test timed out");
|
PrintAndLogEx(NORMAL, "Status command failed. USB Speed Test timed out");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -430,12 +429,11 @@ static int CmdPing(const char *Cmd) {
|
||||||
(void)Cmd; // Cmd is not used so far
|
(void)Cmd; // Cmd is not used so far
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
PacketCommandOLD c = {CMD_PING, {0, 0, 0}, {{0}}};
|
SendCommandOLD(CMD_PING, 0, 0, 0, NULL, 0);
|
||||||
SendCommand(&c);
|
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000))
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000))
|
||||||
PrintAndLogEx(NORMAL, "Ping successful");
|
PrintAndLogEx(NORMAL, "Ping " _GREEN_("successful"));
|
||||||
else
|
else
|
||||||
PrintAndLogEx(NORMAL, "Ping failed");
|
PrintAndLogEx(NORMAL, "Ping " _RED_("failed"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,10 +445,9 @@ static int CmdPingNG(const char *Cmd) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
uint8_t data[USB_CMD_DATA_SIZE] = {0};
|
uint8_t data[USB_CMD_DATA_SIZE] = {0};
|
||||||
uint16_t cmd = CMD_PING;
|
|
||||||
for (uint16_t i = 0; i < len; i++)
|
for (uint16_t i = 0; i < len; i++)
|
||||||
data[i] = i & 0xFF;
|
data[i] = i & 0xFF;
|
||||||
SendCommandNG(cmd, data, len);
|
SendCommandNG(CMD_PING, data, len);
|
||||||
if (WaitForResponseTimeout(CMD_PING, &resp, 1000)) {
|
if (WaitForResponseTimeout(CMD_PING, &resp, 1000)) {
|
||||||
bool error = false;
|
bool error = false;
|
||||||
if (len)
|
if (len)
|
||||||
|
|
|
@ -94,6 +94,18 @@ void SendCommand(PacketCommandOLD *c) {
|
||||||
//__atomic_test_and_set(&txcmd_pending, __ATOMIC_SEQ_CST);
|
//__atomic_test_and_set(&txcmd_pending, __ATOMIC_SEQ_CST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Let's move slowly to an API closer to SendCommandNG
|
||||||
|
void SendCommandOLD(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len) {
|
||||||
|
PacketCommandOLD c = {CMD_UNKNOWN, {0, 0, 0}, {{0}}};
|
||||||
|
c.cmd = cmd;
|
||||||
|
c.arg[0] = arg0;
|
||||||
|
c.arg[1] = arg1;
|
||||||
|
c.arg[2] = arg2;
|
||||||
|
if (len && data)
|
||||||
|
memcpy(&c.d, data, len);
|
||||||
|
SendCommand(&c);
|
||||||
|
}
|
||||||
|
|
||||||
void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len) {
|
void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len) {
|
||||||
|
|
||||||
#ifdef COMMS_DEBUG
|
#ifdef COMMS_DEBUG
|
||||||
|
|
|
@ -55,6 +55,7 @@ bool IsOffline(void);
|
||||||
|
|
||||||
void *uart_receiver(void *targ);
|
void *uart_receiver(void *targ);
|
||||||
void SendCommand(PacketCommandOLD *c);
|
void SendCommand(PacketCommandOLD *c);
|
||||||
|
void SendCommandOLD(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len);
|
||||||
void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len);
|
void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len);
|
||||||
void clearCommandBuffer(void);
|
void clearCommandBuffer(void);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue