capabilities: more IsAvailable helpers

This commit is contained in:
Philippe Teuwen 2019-05-01 21:09:23 +02:00
commit 10489db97d
2 changed files with 99 additions and 0 deletions

View file

@ -27,12 +27,97 @@ bool IfPm3Present(void) {
return session.pm3_present; return session.pm3_present;
} }
bool IfPm3Flash(void) {
if (!IfPm3Present())
return false;
// TODO
// capabilities.hw_available_flash
return pm3_capabilities.compiled_with_flash;
}
bool IfPm3Smartcard(void) {
if (!IfPm3Present())
return false;
// TODO
// capabilities.hw_available_smartcard
return pm3_capabilities.compiled_with_smartcard;
}
bool IfPm3Fpc(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_fpc;
}
bool IfPm3FpcHost(void) {
if (!IfPm3Present())
return false;
// TODO
// capabilities.hw_available_fpc_host
return pm3_capabilities.compiled_with_fpc_host;
}
bool IfPm3Lf(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_lf;
}
bool IfPm3Hitag(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_hitag;
}
bool IfPm3Hfsniff(void) { bool IfPm3Hfsniff(void) {
if (!IfPm3Present()) if (!IfPm3Present())
return false; return false;
return pm3_capabilities.compiled_with_hfsniff; return pm3_capabilities.compiled_with_hfsniff;
} }
bool IfPm3Iso14443a(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_iso14443a;
}
bool IfPm3Iso14443a(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_iso14443b;
}
bool IfPm3Iso15693(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_iso15693;
}
bool IfPm3Felica(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_felica;
}
bool IfPm3Legicrf(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_legicrf;
}
bool IfPm3Iclass(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_iclass;
}
bool IfPm3Lcd(void) {
if (!IfPm3Present())
return false;
return pm3_capabilities.compiled_with_lcd;
}
void CmdsHelp(const command_t Commands[]) { void CmdsHelp(const command_t Commands[]) {
if (Commands[0].Name == NULL) return; if (Commands[0].Name == NULL) return;
int i = 0; int i = 0;

View file

@ -19,9 +19,23 @@ typedef struct command_s {
} command_t; } command_t;
// command_t array are expected to be NULL terminated // command_t array are expected to be NULL terminated
// helpers for command_t IsAvailable
bool AlwaysAvailable(void); bool AlwaysAvailable(void);
bool IfPm3Present(void); bool IfPm3Present(void);
bool IfPm3Flash(void);
bool IfPm3Smartcard(void);
bool IfPm3Fpc(void);
bool IfPm3FpcHost(void);
bool IfPm3Lf(void);
bool IfPm3Hitag(void);
bool IfPm3Hfsniff(void); bool IfPm3Hfsniff(void);
bool IfPm3Iso14443a(void);
bool IfPm3Iso14443a(void);
bool IfPm3Iso15693(void);
bool IfPm3Felica(void);
bool IfPm3Legicrf(void);
bool IfPm3Iclass(void);
bool IfPm3Lcd(void);
// Print help for each command in the command array // Print help for each command in the command array
void CmdsHelp(const command_t Commands[]); void CmdsHelp(const command_t Commands[]);