Commitbd05eeab by developer2

Version 1.3 Mifare Plus X, SE and EV1 value block operations support

Firmware version 5.0.36, Library version 5.0.34
家长 6266a2c5
... ... @@ -18,6 +18,7 @@ help info :
echo"For 64 bit Windows - type: 'make win64'"
echo"For 32 bit Linux - type: 'make lin32'"
echo"For 64 bit Linux - type: 'make lin64'"
echo"For 64 bit Mac OS - type: 'make osx'"
echo"----------------------------------------------"
lin32 linux32:
... ... @@ -62,4 +63,18 @@ win64 :
# generate run_me
echo"@echo off">win64_release\\run_me.cmd
echo"set path=..\lib\windows\x86_64;%path%">>win64_release\\run_me.cmd
echo"$(PRJNAME)">>win64_release\\run_me.cmd
echo"$(PRJNAME).exe">>win64_release\\run_me.cmd
osx:
-mkdir-pmacos-x86_64-release
gcc-omacos-x86_64-release/$(PRJNAME)-Ilib/include src/*.c-Llib/macos/x86_64-luFCoder-x86_64-Xlinker-rpathlib / macos / x86_64/
install_name_tool-change"libuFCoder-x86_64.dylib""@loader_path/../lib/macos/x86_64/libuFCoder-x86_64.dylib"macos-x86_64-release/$(PRJNAME)
echo"Making on 64-bit Intel macOS is done - without errors."
echo"Output is in macos-x86_64-release/"
echo
# running help message
echo"You must use library from the 'lib/macos/x86_64'"
echo""
echo"To run the example - type:"
echo" 'cd macos-x86_64-release && ./$(PRJNAME)'"
lib@6558d340
Subproject commitf6206f5b0f67f82287011a0ebb375b7643c94943
Subproject commit6558d34086e866ca1c9020cbf1ca88858a88a028
... ... @@ -22,7 +22,7 @@ void _initTermios(int echo)
tcgetattr(0,&old);// grab old terminal i/o settings
new=old;// make new settings same as old settings
new.c_lflag&=~ICANON;// disable buffered i/o
new.c_lflag&=echo?ECHO:~ECHO;// set echo mode
//new.c_lflag &= echo ? ECHO : ~ECHO; // set echo mode
tcsetattr(0,TCSANOW,&new);// use these new terminal i/o settings now
}
... ...
... ... @@ -5,7 +5,7 @@
#ifndef INI_H_
#define INI_H_
#define APP_VERSION "1.2"
#define APP_VERSION "1.3"
#define EXIT_ON_WRONG_FW_DEPENDENCY
#define MIN_DEPEND_FW_VER_MAJOR 5
... ...
This source diff could not be displayed because it is too large. You canview the blobinstead.
... ... @@ -11,7 +11,8 @@
#include "uFR.h"
//------------------------------------------------------------------------------
boolCheckDependencies(void){
boolCheckDependencies(void)
{
#if defined(EXIT_ON_WRONG_FW_DEPENDENCY) || defined(EXIT_ON_WRONG_LIB_DEPENDENCY)
uint8_tversion_major,version_minor,build;
boolwrong_version=false;
... ... @@ -24,61 +25,86 @@ bool CheckDependencies(void) {
dwDllVersion=GetDllVersion();
// "explode" the uFCoder library version:
version_major=(uint8_t)dwDllVersion;
version_minor=(uint8_t)(dwDllVersion>>8);
version_major=(uint8_t)dwDllVersion;
version_minor=(uint8_t)(dwDllVersion>>8);
// Get the uFCoder library build number.
build=(uint8_t)(dwDllVersion>>16);
build=(uint8_t)(dwDllVersion>>16);
if(version_major<MIN_DEPEND_LIB_VER_MAJOR){
if(version_major<MIN_DEPEND_LIB_VER_MAJOR)
{
wrong_version=true;
}elseif(version_major==MIN_DEPEND_LIB_VER_MAJOR&&version_minor<MIN_DEPEND_LIB_VER_MINOR){
}
elseif(version_major==MIN_DEPEND_LIB_VER_MAJOR
&&version_minor<MIN_DEPEND_LIB_VER_MINOR)
{
wrong_version=true;
}elseif(version_major==MIN_DEPEND_LIB_VER_MAJOR&&version_minor==MIN_DEPEND_LIB_VER_MINOR&&build<MIN_DEPEND_LIB_VER_BUILD){
}
elseif(version_major==MIN_DEPEND_LIB_VER_MAJOR
&&version_minor==MIN_DEPEND_LIB_VER_MINOR
&&build<MIN_DEPEND_LIB_VER_BUILD)
{
wrong_version=true;
}
if(wrong_version){
if(wrong_version)
{
printf("Wrong uFCoder library version (%d.%d.%d).\n"
"Please update uFCoder library to at last %d.%d.%d version.\n",
version_major,version_minor,build,
MIN_DEPEND_LIB_VER_MAJOR,MIN_DEPEND_LIB_VER_MINOR,MIN_DEPEND_LIB_VER_BUILD);
"Please update uFCoder library to at last %d.%d.%d version.\n",
version_major,version_minor,build,
MIN_DEPEND_LIB_VER_MAJOR,MIN_DEPEND_LIB_VER_MINOR,
MIN_DEPEND_LIB_VER_BUILD);
returnfalse;
}
#endif
#ifdef EXIT_ON_WRONG_FW_DEPENDENCY
wrong_version=false;
status=GetReaderFirmwareVersion(&version_major,&version_minor);
if(status!=UFR_OK){
printf("Error while checking firmware version, status is: 0x%08X\n",status);
if(status!=UFR_OK)
{
printf("Error while checking firmware version, status is: 0x%08X\n",
status);
}
status=GetBuildNumber(&build);
if(status!=UFR_OK){
if(status!=UFR_OK)
{
printf("Error while firmware version, status is: 0x%08X\n",status);
}
if(version_major<MIN_DEPEND_FW_VER_MAJOR){
if(version_major<MIN_DEPEND_FW_VER_MAJOR)
{
wrong_version=true;
}elseif(version_major==MIN_DEPEND_FW_VER_MAJOR&&version_minor<MIN_DEPEND_FW_VER_MINOR){
}
elseif(version_major==MIN_DEPEND_FW_VER_MAJOR
&&version_minor<MIN_DEPEND_FW_VER_MINOR)
{
wrong_version=true;
}elseif(version_major==MIN_DEPEND_FW_VER_MAJOR&&version_minor==MIN_DEPEND_FW_VER_MINOR&&build<MIN_DEPEND_FW_VER_BUILD){
}
elseif(version_major==MIN_DEPEND_FW_VER_MAJOR
&&version_minor==MIN_DEPEND_FW_VER_MINOR
&&build<MIN_DEPEND_FW_VER_BUILD)
{
wrong_version=true;
}
if(wrong_version){
if(wrong_version)
{
printf("Wrong uFR NFC reader firmware version (%d.%d.%d).\n"
"Please update uFR firmware to at last %d.%d.%d version.\n",
version_major,version_minor,build,
MIN_DEPEND_FW_VER_MAJOR,MIN_DEPEND_FW_VER_MINOR,MIN_DEPEND_FW_VER_BUILD);
"Please update uFR firmware to at last %d.%d.%d version.\n",
version_major,version_minor,build,
MIN_DEPEND_FW_VER_MAJOR,MIN_DEPEND_FW_VER_MINOR,
MIN_DEPEND_FW_VER_BUILD);
returnfalse;
}
#endif
returntrue;
}
//------------------------------------------------------------------------------
sz_ptrGetDlTypeName(uint8_tdl_type_code){
sz_ptrGetDlTypeName(uint8_tdl_type_code)
{
switch(dl_type_code){
switch(dl_type_code)
{
caseDL_MIFARE_ULTRALIGHT:
return"DL_MIFARE_ULTRALIGHT";
caseDL_MIFARE_ULTRALIGHT_EV1_11:
... ... @@ -103,6 +129,18 @@ sz_ptr GetDlTypeName(uint8_t dl_type_code) {
return"DL_MIKRON_MIK640D";
caseNFC_T2T_GENERIC:
return"NFC_T2T_GENERIC";
caseDL_NT3H_1101:
return"DL_NT3H_1101";
caseDL_NT3H_1201:
return"DL_NT3H_1201";
caseDL_NT3H_2111:
return"DL_NT3H_2111";
caseDL_NT3H_2211:
return"DL_NT3H_2211";
caseDL_NTAG_413_DNA:
return"DL_NTAG_413_DNA";
caseDL_NTAG_424_DNA:
return"DL_NTAG_424_DNA";
caseDL_MIFARE_MINI:
return"DL_MIFARE_MINI";
caseDL_MIFARE_CLASSIC_1K:
... ... @@ -159,6 +197,14 @@ sz_ptr GetDlTypeName(uint8_t dl_type_code) {
return"DL_MIFARE_PLUS_X_4K_SL3";
caseDL_MIFARE_PLUS_EV1_4K_SL3:
return"DL_MIFARE_PLUS_EV1_4K_SL3";
caseDL_MIFARE_PLUS_SE_SL0:
return"DL_MIFARE_PLUS_SE_SL0";
caseDL_MIFARE_PLUS_SE_SL1:
return"DL_MIFARE_PLUS_SE_SL1";
caseDL_MIFARE_PLUS_SE_SL3:
return"DL_MIFARE_PLUS_SE_SL3";
caseDL_MIFARE_DESFIRE_LIGHT:
return"DL_MIFARE_DESFIRE_LIGHT";
caseDL_GENERIC_ISO14443_4:
return"DL_GENERIC_ISO_14443_4";
caseDL_GENERIC_ISO14443_4_TYPE_B:
... ...
... ... @@ -7,7 +7,7 @@
#include "ini.h"
//------------------------------------------------------------------------------
typedefconstchar*sz_ptr;
typedefconstchar*sz_ptr;
//------------------------------------------------------------------------------
boolCheckDependencies(void);
sz_ptrGetDlTypeName(uint8_tdl_type_code);
... ...
... ... @@ -9,16 +9,18 @@
#include "utils.h"
//------------------------------------------------------------------------------
size_thex2bin(uint8_t*dst,constchar*src){
size_thex2bin(uint8_t*dst,constchar*src)
{
size_tdst_len=0;
chars_tmp[3];
s_tmp[2]='\0';
while(*src){
while(((char)*src<'0'||(char)*src>'9')
&&((char)*src<'a'||(char)*src>'f')
&&((char)*src<'A'||(char)*src>'F'))
while(*src)
{
while(((char)*src<'0'||(char)*src>'9')
&&((char)*src<'a'||(char)*src>'f')
&&((char)*src<'A'||(char)*src>'F'))
src++;// skip delimiters, white spaces, etc.
s_tmp[0]=(char)*src++;
... ... @@ -28,9 +30,9 @@ size_t hex2bin(uint8_t *dst, const char *src) {
break;
// And again, must be pair of the hex digits:
if(((char)*src<'0'||(char)*src>'9')
&&((char)*src<'a'||(char)*src>'f')
&&((char)*src<'A'||(char)*src>'F'))
if(((char)*src<'0'||(char)*src>'9')
&&((char)*src<'a'||(char)*src>'f')
&&((char)*src<'A'||(char)*src>'F'))
break;
s_tmp[1]=(char)*src++;
... ... @@ -42,7 +44,8 @@ size_t hex2bin(uint8_t *dst, const char *src) {
returndst_len;
}
//------------------------------------------------------------------------------
voidprint_ln_len(charsymbol,uint8_tcnt){
voidprint_ln_len(charsymbol,uint8_tcnt)
{
for(inti=0;i<cnt;i++)
printf("%c",symbol);
... ... @@ -50,26 +53,28 @@ void print_ln_len(char symbol, uint8_t cnt) {
printf("\n");
}
//------------------------------------------------------------------------------
inlinevoidprint_ln(charsymbol){
inlinevoidprint_ln(charsymbol)
{
print_ln_len(symbol,DEFAULT_LINE_LEN);
}
//------------------------------------------------------------------------------
voidprint_hex(constuint8_t*data,uint32_tlen,constchar*delimiter){
voidprint_hex(constuint8_t*data,uint32_tlen,constchar*delimiter)
{
for(inti=0;i<len;i++){
for(inti=0;i<len;i++)
{
printf(“x % 02”,data[i]);
if((delimiter!=NULL)&&(i<(len-1)))
printf("%c",*delimiter);
}
}
//------------------------------------------------------------------------------
voidprint_hex_ln(constuint8_t*data,uint32_tlen,constchar*delimiter){
voidprint_hex_ln(constuint8_t*data,uint32_tlen,constchar*delimiter)
{
print_hex(data,len,delimiter);
printf("\n");
}
//==============================================================================
@echo off
set path=..\lib\windows\x86;%path%
ufr_mifare_plus_example.exe
    Markdownis supported
    0%or
    You are about to add0peopleto the discussion. Proceed with caution.
    Finish editing this message first!
    Pleaseregisterorto comment
    Baidu
    map