make style

This commit is contained in:
Philippe Teuwen 2019-03-10 00:00:59 +01:00
commit 0373696662
483 changed files with 56514 additions and 52451 deletions

View file

@ -13,10 +13,11 @@ static int CmdHelp(const char *Cmd);
// by marshmellow
// find PAC preamble in already demoded data
int detectPac(uint8_t *dest, size_t *size) {
int detectPac(uint8_t *dest, size_t *size)
{
if (*size < 128) return -1; //make sure buffer has data
size_t startIdx = 0;
uint8_t preamble[] = {1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,1,0};
uint8_t preamble[] = {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0};
if (!preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx))
return -2; //preamble not found
if (*size != 128) return -3; //wrong demoded size
@ -25,7 +26,8 @@ int detectPac(uint8_t *dest, size_t *size) {
}
//see NRZDemod for what args are accepted
int CmdPacDemod(const char *Cmd) {
int CmdPacDemod(const char *Cmd)
{
//NRZ
if (!NRZrawDemod(Cmd, false)) {
@ -47,42 +49,45 @@ int CmdPacDemod(const char *Cmd) {
return 0;
}
setDemodBuf(DemodBuffer, 128, ans);
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans*g_DemodClock));
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
//got a good demod
uint32_t raw1 = bytebits_to_byte(DemodBuffer , 32);
uint32_t raw2 = bytebits_to_byte(DemodBuffer+32, 32);
uint32_t raw3 = bytebits_to_byte(DemodBuffer+64, 32);
uint32_t raw4 = bytebits_to_byte(DemodBuffer+96, 32);
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
uint32_t raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
uint32_t raw3 = bytebits_to_byte(DemodBuffer + 64, 32);
uint32_t raw4 = bytebits_to_byte(DemodBuffer + 96, 32);
// preamble then appears to have marker bits of "10" CS?
// 11111111001000000 10 01001100 10 00001101 10 00001101 10 00001101 10 00001101 10 00001101 10 00001101 10 00001101 10 00001101 10 10001100 10 100000001
// unknown checksum 9 bits at the end
PrintAndLogEx(NORMAL, "PAC/Stanley Tag Found -- Raw: %08X%08X%08X%08X", raw1 ,raw2, raw3, raw4);
PrintAndLogEx(NORMAL, "PAC/Stanley Tag Found -- Raw: %08X%08X%08X%08X", raw1, raw2, raw3, raw4);
PrintAndLogEx(NORMAL, "\nHow the Raw ID is translated by the reader is unknown");
return 1;
}
int CmdPacRead(const char *Cmd) {
lf_read(true, 4096*2 + 20);
int CmdPacRead(const char *Cmd)
{
lf_read(true, 4096 * 2 + 20);
return CmdPacDemod(Cmd);
}
static command_t CommandTable[] = {
{"help", CmdHelp, 1, "This help"},
{"demod", CmdPacDemod,1, "Demodulate an PAC tag from the GraphBuffer"},
{"demod", CmdPacDemod, 1, "Demodulate an PAC tag from the GraphBuffer"},
{"read", CmdPacRead, 0, "Attempt to read and extract tag data from the antenna"},
{NULL, NULL, 0, NULL}
};
int CmdLFPac(const char *Cmd) {
int CmdLFPac(const char *Cmd)
{
clearCommandBuffer();
CmdsParse(CommandTable, Cmd);
return 0;
}
int CmdHelp(const char *Cmd) {
int CmdHelp(const char *Cmd)
{
CmdsHelp(CommandTable);
return 0;
}