+int HFLegicInfo(const char *Cmd, bool verbose) {
+
+ char cmdp = param_getchar(Cmd, 0);
+ if ( cmdp == 'H' || cmdp == 'h' ) return usage_legic_info();
+
+ UsbCommand c = {CMD_LEGIC_INFO, {0,0,0}};
+ clearCommandBuffer();
+ SendCommand(&c);
+ UsbCommand resp;
+ if (!WaitForResponseTimeout(CMD_ACK, &resp, 500)) {
+ if ( verbose ) PrintAndLog("command execution time out");
+ return 1;
+ }
+
+ uint8_t isOK = resp.arg[0] & 0xFF;
+ if ( !isOK ) {
+ if ( verbose ) PrintAndLog("legic card select failed");
+ return 1;
+ }
+
+ legic_card_select_t card;
+ memcpy(&card, (legic_card_select_t *)resp.d.asBytes, sizeof(legic_card_select_t));
+
+ PrintAndLog(" UID : %s", sprint_hex(card.uid, sizeof(card.uid)));
+ switch(card.cardsize) {
+ case 22:
+ case 256:
+ case 1024:
+ PrintAndLog(" TYPE : MIM%d card (%d bytes)", card.cardsize, card.cardsize); break;
+ default: {
+ PrintAndLog("Unknown card format: %d", card.cardsize);
+ return 1;
+ }
+ }
+ return 0;
+}
+int CmdLegicInfo(const char *Cmd){
+ return HFLegicInfo(Cmd, TRUE);
+}
+