mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
fixed 64-bit cmd/arg for windows
This commit is contained in:
parent
80501bad5b
commit
9440213d6b
4 changed files with 21 additions and 13 deletions
|
@ -79,7 +79,8 @@ void ToSendStuffBit(int b)
|
||||||
|
|
||||||
void DbpString(char *str)
|
void DbpString(char *str)
|
||||||
{
|
{
|
||||||
cmd_send(CMD_DEBUG_PRINT_STRING,strlen(str),0,0,(byte_t*)str,strlen(str));
|
byte_t len = strlen(str);
|
||||||
|
cmd_send(CMD_DEBUG_PRINT_STRING,len,0,0,(byte_t*)str,len);
|
||||||
// /* this holds up stuff unless we're connected to usb */
|
// /* this holds up stuff unless we're connected to usb */
|
||||||
// if (!UsbConnected())
|
// if (!UsbConnected())
|
||||||
// return;
|
// return;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "cmdhw.h"
|
#include "cmdhw.h"
|
||||||
#include "cmdlf.h"
|
#include "cmdlf.h"
|
||||||
#include "cmdmain.h"
|
#include "cmdmain.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
unsigned int current_command = CMD_UNKNOWN;
|
unsigned int current_command = CMD_UNKNOWN;
|
||||||
unsigned int received_command = CMD_UNKNOWN;
|
unsigned int received_command = CMD_UNKNOWN;
|
||||||
|
@ -99,17 +100,23 @@ void CommandReceived(char *Cmd) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void UsbCommandReceived(UsbCommand *UC)
|
void UsbCommandReceived(UsbCommand *UC)
|
||||||
{
|
{
|
||||||
|
// Debug
|
||||||
|
// printf("UsbCommand length[len=%d]\n",sizeof(UsbCommand));
|
||||||
|
// printf(" cmd[len=%d]: %x\n",sizeof(UC->cmd),UC->cmd);
|
||||||
|
// printf(" arg0[len=%d]: %x\n",sizeof(UC->arg[0]),UC->arg[0]);
|
||||||
|
// printf(" arg1[len=%d]: %x\n",sizeof(UC->arg[1]),UC->arg[1]);
|
||||||
|
// printf(" arg2[len=%d]: %x\n",sizeof(UC->arg[2]),UC->arg[2]);
|
||||||
|
// printf(" data[len=%d]: %02x%02x%02x...\n",sizeof(UC->d.asBytes),UC->d.asBytes[0],UC->d.asBytes[1],UC->d.asBytes[2]);
|
||||||
|
|
||||||
// printf("%s(%x) current cmd = %x\n", __FUNCTION__, c->cmd, current_command);
|
// printf("%s(%x) current cmd = %x\n", __FUNCTION__, c->cmd, current_command);
|
||||||
/* If we recognize a response, return to avoid further processing */
|
// If we recognize a response, return to avoid further processing
|
||||||
switch(UC->cmd) {
|
switch(UC->cmd) {
|
||||||
// First check if we are handling a debug message
|
// First check if we are handling a debug message
|
||||||
case CMD_DEBUG_PRINT_STRING: {
|
case CMD_DEBUG_PRINT_STRING: {
|
||||||
char s[100];
|
char s[USB_CMD_DATA_SIZE+1];
|
||||||
if(UC->arg[0] > 70 || UC->arg[0] < 0) {
|
size_t len = MIN(UC->arg[0],USB_CMD_DATA_SIZE);
|
||||||
UC->arg[0] = 0;
|
memcpy(s,UC->d.asBytes,len);
|
||||||
}
|
s[len] = 0x00;
|
||||||
memcpy(s, UC->d.asBytes, UC->arg[0]);
|
|
||||||
s[UC->arg[0]] = '\0';
|
|
||||||
PrintAndLog("#db# %s ", s);
|
PrintAndLog("#db# %s ", s);
|
||||||
return;
|
return;
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef struct {
|
||||||
#define USB_CMD_DATA_SIZE 512
|
#define USB_CMD_DATA_SIZE 512
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t cmd;
|
uint64_t cmd;
|
||||||
uint64_t arg[3];
|
uint64_t arg[3];
|
||||||
union {
|
union {
|
||||||
uint8_t asBytes[USB_CMD_DATA_SIZE];
|
uint8_t asBytes[USB_CMD_DATA_SIZE];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue