mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
remove SendCommand
This commit is contained in:
parent
c867b3bc9a
commit
f49d7e6d39
3 changed files with 12 additions and 39 deletions
|
@ -57,15 +57,22 @@ static uint64_t timeout_start_time;
|
||||||
|
|
||||||
static bool dl_it(uint8_t *dest, uint32_t bytes, uint32_t start_index, PacketResponseNG *response, size_t ms_timeout, bool show_warning, uint32_t rec_cmd);
|
static bool dl_it(uint8_t *dest, uint32_t bytes, uint32_t start_index, PacketResponseNG *response, size_t ms_timeout, bool show_warning, uint32_t rec_cmd);
|
||||||
|
|
||||||
void SendCommand(PacketCommandOLD *c) {
|
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);
|
||||||
|
|
||||||
#ifdef COMMS_DEBUG
|
#ifdef COMMS_DEBUG
|
||||||
PrintAndLogEx(NORMAL, "Sending %s", "OLD");
|
PrintAndLogEx(NORMAL, "Sending %s", "OLD");
|
||||||
#endif
|
#endif
|
||||||
#ifdef COMMS_DEBUG_RAW
|
#ifdef COMMS_DEBUG_RAW
|
||||||
print_hex_break((uint8_t *)&c->cmd, sizeof(c->cmd), 32);
|
print_hex_break((uint8_t *)&c.cmd, sizeof(c.cmd), 32);
|
||||||
print_hex_break((uint8_t *)&c->arg, sizeof(c->arg), 32);
|
print_hex_break((uint8_t *)&c.arg, sizeof(c.arg), 32);
|
||||||
print_hex_break((uint8_t *)&c->d, sizeof(c->d), 32);
|
print_hex_break((uint8_t *)&c.d, sizeof(c.d), 32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!session.pm3_present) {
|
if (!session.pm3_present) {
|
||||||
|
@ -83,7 +90,7 @@ void SendCommand(PacketCommandOLD *c) {
|
||||||
pthread_cond_wait(&txBufferSig, &txBufferMutex);
|
pthread_cond_wait(&txBufferSig, &txBufferMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
txBuffer = *c;
|
txBuffer = c;
|
||||||
txBuffer_pending = true;
|
txBuffer_pending = true;
|
||||||
|
|
||||||
// tell communication thread that a new command can be send
|
// tell communication thread that a new command can be send
|
||||||
|
@ -94,18 +101,6 @@ 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SendCommandNG_internal(uint16_t cmd, uint8_t *data, size_t len, bool ng) {
|
static void SendCommandNG_internal(uint16_t cmd, uint8_t *data, size_t len, bool ng) {
|
||||||
#ifdef COMMS_DEBUG
|
#ifdef COMMS_DEBUG
|
||||||
PrintAndLogEx(NORMAL, "Sending %s", ng ? "NG" : "MIX");
|
PrintAndLogEx(NORMAL, "Sending %s", ng ? "NG" : "MIX");
|
||||||
|
|
|
@ -56,7 +56,6 @@ typedef struct {
|
||||||
extern communication_arg_t conn;
|
extern communication_arg_t conn;
|
||||||
|
|
||||||
void *uart_receiver(void *targ);
|
void *uart_receiver(void *targ);
|
||||||
void SendCommand(PacketCommandOLD *c);
|
|
||||||
void SendCommandOLD(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len);
|
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 SendCommandMIX(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len);
|
void SendCommandMIX(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len);
|
||||||
|
|
|
@ -54,26 +54,6 @@ static int l_fast_push_mode(lua_State *L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The following params expected:
|
|
||||||
* UsbCommand c
|
|
||||||
*@brief l_SendCommand
|
|
||||||
* @param L
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static int l_SendCommand(lua_State *L) {
|
|
||||||
size_t size;
|
|
||||||
const char *data = luaL_checklstring(L, 1, &size);
|
|
||||||
if (size != sizeof(PacketCommandOLD)) {
|
|
||||||
printf("Got data size %d, expected %d", (int) size, (int) sizeof(PacketCommandOLD));
|
|
||||||
lua_pushstring(L, "Wrong data size");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SendCommand((PacketCommandOLD *)data);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following params expected:
|
* The following params expected:
|
||||||
* @brief l_SendCommandOLD
|
* @brief l_SendCommandOLD
|
||||||
|
@ -1042,7 +1022,6 @@ static int setLuaPath(lua_State *L, const char *path) {
|
||||||
|
|
||||||
int set_pm3_libraries(lua_State *L) {
|
int set_pm3_libraries(lua_State *L) {
|
||||||
static const luaL_Reg libs[] = {
|
static const luaL_Reg libs[] = {
|
||||||
{"SendCommand", l_SendCommand},
|
|
||||||
{"SendCommandOLD", l_SendCommandOLD},
|
{"SendCommandOLD", l_SendCommandOLD},
|
||||||
{"SendCommandMIX", l_SendCommandMIX},
|
{"SendCommandMIX", l_SendCommandMIX},
|
||||||
{"SendCommandNG", l_SendCommandNG},
|
{"SendCommandNG", l_SendCommandNG},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue