mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-07 05:31:17 -07:00
fix compiler warning in cmdhflegic.c (and whitespace fixes) (#826)
This commit is contained in:
parent
a39af1cb9c
commit
2378bb24c3
1 changed files with 286 additions and 284 deletions
|
@ -218,8 +218,10 @@ int CmdLegicRFRead(const char *Cmd)
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
WaitForResponse(CMD_ACK,&resp);
|
WaitForResponse(CMD_ACK,&resp);
|
||||||
switch (resp.arg[0]) {
|
switch (resp.arg[0]) {
|
||||||
|
legic_card_select_t card;
|
||||||
case 0:
|
case 0:
|
||||||
PrintAndLog("Card (MIM %i) read, use 'hf legic decode' or", ((legic_card_select_t*)resp.d.asBytes)->cardsize);
|
memcpy(&card, resp.d.asBytes, sizeof(card));
|
||||||
|
PrintAndLog("Card (MIM %i) read, use 'hf legic decode' or", card.cardsize);
|
||||||
PrintAndLog("'data hexsamples %d' to view results", (resp.arg[1] + 7) & ~7);
|
PrintAndLog("'data hexsamples %d' to view results", (resp.arg[1] + 7) & ~7);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -252,16 +254,16 @@ int CmdLegicLoad(const char *Cmd)
|
||||||
memcpy(filename, Cmd, len);
|
memcpy(filename, Cmd, len);
|
||||||
|
|
||||||
FILE *f = fopen(filename, "r");
|
FILE *f = fopen(filename, "r");
|
||||||
if(!f) {
|
if (!f) {
|
||||||
PrintAndLog("couldn't open '%s'", Cmd);
|
PrintAndLog("couldn't open '%s'", Cmd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
char line[80]; int offset = 0; unsigned int data[8];
|
char line[80]; int offset = 0; unsigned int data[8];
|
||||||
while(fgets(line, sizeof(line), f)) {
|
while (fgets(line, sizeof(line), f)) {
|
||||||
int res = sscanf(line, "%x %x %x %x %x %x %x %x",
|
int res = sscanf(line, "%x %x %x %x %x %x %x %x",
|
||||||
&data[0], &data[1], &data[2], &data[3],
|
&data[0], &data[1], &data[2], &data[3],
|
||||||
&data[4], &data[5], &data[6], &data[7]);
|
&data[4], &data[5], &data[6], &data[7]);
|
||||||
if(res != 8) {
|
if (res != 8) {
|
||||||
PrintAndLog("Error: could not read samples");
|
PrintAndLog("Error: could not read samples");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -304,7 +306,7 @@ int CmdLegicSave(const char *Cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f = fopen(filename, "w");
|
FILE *f = fopen(filename, "w");
|
||||||
if(!f) {
|
if (!f) {
|
||||||
PrintAndLog("couldn't open '%s'", Cmd+1);
|
PrintAndLog("couldn't open '%s'", Cmd+1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +347,7 @@ int CmdLegicRfWrite(const char *Cmd)
|
||||||
{
|
{
|
||||||
UsbCommand c={CMD_WRITER_LEGIC_RF};
|
UsbCommand c={CMD_WRITER_LEGIC_RF};
|
||||||
int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64, &c.arg[0], &c.arg[1]);
|
int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64, &c.arg[0], &c.arg[1]);
|
||||||
if(res != 2) {
|
if (res != 2) {
|
||||||
PrintAndLog("Please specify the offset and length as two hex strings");
|
PrintAndLog("Please specify the offset and length as two hex strings");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -357,17 +359,17 @@ int CmdLegicRfFill(const char *Cmd)
|
||||||
{
|
{
|
||||||
UsbCommand cmd ={CMD_WRITER_LEGIC_RF};
|
UsbCommand cmd ={CMD_WRITER_LEGIC_RF};
|
||||||
int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64 " 0x%" SCNx64, &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
|
int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64 " 0x%" SCNx64, &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
|
||||||
if(res != 3) {
|
if (res != 3) {
|
||||||
PrintAndLog("Please specify the offset, length and value as two hex strings");
|
PrintAndLog("Please specify the offset, length and value as two hex strings");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
UsbCommand c={CMD_DOWNLOADED_SIM_SAMPLES_125K, {0, 1, 0}};
|
UsbCommand c={CMD_DOWNLOADED_SIM_SAMPLES_125K, {0, 1, 0}};
|
||||||
for(i = 0; i < 48; i++) {
|
for (i = 0; i < 48; i++) {
|
||||||
c.d.asBytes[i] = cmd.arg[2];
|
c.d.asBytes[i] = cmd.arg[2];
|
||||||
}
|
}
|
||||||
for(i = 0; i < 22; i++) {
|
for (i = 0; i < 22; i++) {
|
||||||
c.arg[0] = i*48;
|
c.arg[0] = i*48;
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
WaitForResponse(CMD_ACK,NULL);
|
WaitForResponse(CMD_ACK,NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue