+ ul_switch_on_field();
+
+ UsbCommand resp;
+ if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
+ ul_switch_off_field();
+ return -1;
+ }
+
+ if (resp.arg[0] > 0) {
+ memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t));
+ }
+ return resp.arg[0];
+}
+
+static int ul_read( uint8_t page, uint8_t *response ){
+
+ uint8_t cmd[] = {ISO14443A_CMD_READBLOCK, page};
+ int len = ul_send_cmd_raw(cmd, sizeof(cmd), response);
+ if ( len == -1 )
+ ul_switch_off_field();
+ return len;
+}
+
+static int ulc_requestAuthentication( uint8_t blockNo, uint8_t *nonce ){
+
+ uint8_t cmd[] = {MIFARE_ULC_AUTH_1, blockNo};
+ int len = ul_send_cmd_raw(cmd, sizeof(cmd), nonce);
+ if ( len == -1 )
+ ul_switch_off_field();
+ return len;
+}
+
+static int ulev1_requestAuthentication( uint8_t *pwd, uint8_t *pack ){
+
+ uint8_t cmd[] = {MIFARE_ULEV1_AUTH, pwd[0], pwd[1], pwd[2], pwd[3]};
+ int len = ul_send_cmd_raw(cmd, sizeof(cmd), pack);
+ if ( len == -1)
+ ul_switch_off_field();
+ return len;
+}
+
+static int ulev1_getVersion( uint8_t *response ){
+
+ uint8_t cmd[] = {MIFARE_ULEV1_VERSION};
+ int len = ul_send_cmd_raw(cmd, sizeof(cmd), response);
+ if ( len == -1 )
+ ul_switch_off_field();
+ return len;
+}
+
+// static int ulev1_fastRead( uint8_t startblock, uint8_t endblock, uint8_t *response ){
+
+ // uint8_t cmd[] = {MIFARE_ULEV1_FASTREAD, startblock, endblock};
+
+ // if ( !ul_send_cmd_raw(cmd, sizeof(cmd), response)){
+ // ul_switch_off_field();
+ // return -1;
+ // }
+ // return 0;
+// }
+
+static int ulev1_readCounter( uint8_t counter, uint8_t *response ){
+
+ uint8_t cmd[] = {MIFARE_ULEV1_READ_CNT, counter};
+ int len = ul_send_cmd_raw(cmd, sizeof(cmd), response);
+ if (len == -1)
+ ul_switch_off_field();
+ return len;
+}
+
+static int ul_print_CC(uint8_t *data) {
+ if(data[0] != 0xe1) {
+ PrintAndLog("no NDEF message");
+ return -1; // no NDEF message
+ }