mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
make style
This commit is contained in:
parent
0d9223a547
commit
0373696662
483 changed files with 56514 additions and 52451 deletions
|
@ -11,7 +11,8 @@
|
|||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
int usage_lf_cotag_read(void){
|
||||
int usage_lf_cotag_read(void)
|
||||
{
|
||||
PrintAndLogEx(NORMAL, "Usage: lf COTAG read [h] <signaldata>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h : This help");
|
||||
|
@ -27,7 +28,8 @@ int usage_lf_cotag_read(void){
|
|||
|
||||
// COTAG demod should be able to use GraphBuffer,
|
||||
// when data load samples
|
||||
int CmdCOTAGDemod(const char *Cmd) {
|
||||
int CmdCOTAGDemod(const char *Cmd)
|
||||
{
|
||||
|
||||
uint8_t bits[COTAG_BITS] = {0};
|
||||
size_t bitlen = COTAG_BITS;
|
||||
|
@ -35,7 +37,7 @@ int CmdCOTAGDemod(const char *Cmd) {
|
|||
|
||||
uint8_t alignPos = 0;
|
||||
int err = manrawdecode(bits, &bitlen, 1, &alignPos);
|
||||
if (err){
|
||||
if (err) {
|
||||
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - COTAG too many errors: %d", err);
|
||||
return -1;
|
||||
}
|
||||
|
@ -43,13 +45,13 @@ int CmdCOTAGDemod(const char *Cmd) {
|
|||
setDemodBuf(bits, bitlen, 0);
|
||||
|
||||
//got a good demod
|
||||
uint16_t cn = bytebits_to_byteLSBF(bits+1, 16);
|
||||
uint32_t fc = bytebits_to_byteLSBF(bits+1+16, 8);
|
||||
uint16_t cn = bytebits_to_byteLSBF(bits + 1, 16);
|
||||
uint32_t fc = bytebits_to_byteLSBF(bits + 1 + 16, 8);
|
||||
|
||||
uint32_t raw1 = bytebits_to_byteLSBF(bits, 32);
|
||||
uint32_t raw2 = bytebits_to_byteLSBF(bits+32, 32);
|
||||
uint32_t raw3 = bytebits_to_byteLSBF(bits+64, 32);
|
||||
uint32_t raw4 = bytebits_to_byteLSBF(bits+96, 32);
|
||||
uint32_t raw2 = bytebits_to_byteLSBF(bits + 32, 32);
|
||||
uint32_t raw3 = bytebits_to_byteLSBF(bits + 64, 32);
|
||||
uint32_t raw4 = bytebits_to_byteLSBF(bits + 96, 32);
|
||||
|
||||
/*
|
||||
fc 161: 1010 0001 -> LSB 1000 0101
|
||||
|
@ -58,7 +60,7 @@ int CmdCOTAGDemod(const char *Cmd) {
|
|||
0 1001 1100 1100 0001 1000 0101 0000 0000 100001010000000001111011100000011010000010000000000000000000000000000000000000000000000000000000100111001100000110000101000
|
||||
1001 1100 1100 0001 10000101
|
||||
*/
|
||||
PrintAndLogEx(SUCCESS, "COTAG Found: FC %u, CN: %u Raw: %08X%08X%08X%08X", fc, cn, raw1 ,raw2, raw3, raw4);
|
||||
PrintAndLogEx(SUCCESS, "COTAG Found: FC %u, CN: %u Raw: %08X%08X%08X%08X", fc, cn, raw1, raw2, raw3, raw4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -66,7 +68,8 @@ int CmdCOTAGDemod(const char *Cmd) {
|
|||
// 0 = HIGH/LOW signal - maxlength bigbuff
|
||||
// 1 = translation for HI/LO into bytes with manchester 0,1 - length 300
|
||||
// 2 = raw signal - maxlength bigbuff
|
||||
int CmdCOTAGRead(const char *Cmd) {
|
||||
int CmdCOTAGRead(const char *Cmd)
|
||||
{
|
||||
|
||||
if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_lf_cotag_read();
|
||||
|
||||
|
@ -76,12 +79,12 @@ int CmdCOTAGRead(const char *Cmd) {
|
|||
UsbCommand c = {CMD_COTAG, {rawsignal, 0, 0}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if ( !WaitForResponseTimeout(CMD_ACK, NULL, 7000) ) {
|
||||
if (!WaitForResponseTimeout(CMD_ACK, NULL, 7000)) {
|
||||
PrintAndLogEx(WARNING, "command execution time out");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch ( rawsignal ){
|
||||
switch (rawsignal) {
|
||||
case 0:
|
||||
case 2: {
|
||||
CmdPlot("");
|
||||
|
@ -91,7 +94,7 @@ int CmdCOTAGRead(const char *Cmd) {
|
|||
}
|
||||
case 1: {
|
||||
|
||||
if ( !GetFromDevice(BIG_BUF, DemodBuffer, COTAG_BITS, 0, NULL, 1000, false)) {
|
||||
if (!GetFromDevice(BIG_BUF, DemodBuffer, COTAG_BITS, 0, NULL, 1000, false)) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||
return -1;
|
||||
}
|
||||
|
@ -109,13 +112,15 @@ static command_t CommandTable[] = {
|
|||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
int CmdLFCOTAG(const char *Cmd) {
|
||||
int CmdLFCOTAG(const char *Cmd)
|
||||
{
|
||||
clearCommandBuffer();
|
||||
CmdsParse(CommandTable, Cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHelp(const char *Cmd) {
|
||||
int CmdHelp(const char *Cmd)
|
||||
{
|
||||
CmdsHelp(CommandTable);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue