mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08: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);
|
||||
|
||||
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
|
||||
PrintAndLogEx(NORMAL, "Sending %s", "OLD");
|
||||
#endif
|
||||
#ifdef COMMS_DEBUG_RAW
|
||||
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->d, sizeof(c->d), 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.d, sizeof(c.d), 32);
|
||||
#endif
|
||||
|
||||
if (!session.pm3_present) {
|
||||
|
@ -83,7 +90,7 @@ void SendCommand(PacketCommandOLD *c) {
|
|||
pthread_cond_wait(&txBufferSig, &txBufferMutex);
|
||||
}
|
||||
|
||||
txBuffer = *c;
|
||||
txBuffer = c;
|
||||
txBuffer_pending = true;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
#ifdef COMMS_DEBUG
|
||||
PrintAndLogEx(NORMAL, "Sending %s", ng ? "NG" : "MIX");
|
||||
|
|
|
@ -56,7 +56,6 @@ typedef struct {
|
|||
extern communication_arg_t conn;
|
||||
|
||||
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 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);
|
||||
|
|
|
@ -54,26 +54,6 @@ static int l_fast_push_mode(lua_State *L) {
|
|||
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:
|
||||
* @brief l_SendCommandOLD
|
||||
|
@ -1042,7 +1022,6 @@ static int setLuaPath(lua_State *L, const char *path) {
|
|||
|
||||
int set_pm3_libraries(lua_State *L) {
|
||||
static const luaL_Reg libs[] = {
|
||||
{"SendCommand", l_SendCommand},
|
||||
{"SendCommandOLD", l_SendCommandOLD},
|
||||
{"SendCommandMIX", l_SendCommandMIX},
|
||||
{"SendCommandNG", l_SendCommandNG},
|
||||
|
|
Loading…
Reference in a new issue