mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
version info also for client, still cmake to do
This commit is contained in:
parent
86ba6c8330
commit
ef586c2a41
12 changed files with 69 additions and 53 deletions
|
@ -8,6 +8,40 @@
|
|||
// Utility functions used in many places, not specific to any piece of code.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "commonutil.h"
|
||||
#include <string.h>
|
||||
|
||||
/* Similar to FpgaGatherVersion this formats stored version information
|
||||
* into a string representation. It takes a pointer to the struct version_information,
|
||||
* verifies the magic properties, then stores a formatted string, prefixed by
|
||||
* prefix in dst.
|
||||
*/
|
||||
void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_info) {
|
||||
struct version_information *v = (struct version_information *)version_info;
|
||||
dst[0] = 0;
|
||||
strncat(dst, prefix, len - 1);
|
||||
if (v->magic != VERSION_INFORMATION_MAGIC) {
|
||||
strncat(dst, "Missing/Invalid version information", len - strlen(dst) - 1);
|
||||
return;
|
||||
}
|
||||
if (v->versionversion != 1) {
|
||||
strncat(dst, "Version information not understood", len - strlen(dst) - 1);
|
||||
return;
|
||||
}
|
||||
if (!v->present) {
|
||||
strncat(dst, "Version information not available", len - strlen(dst) - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
strncat(dst, v->gitversion, len - strlen(dst) - 1);
|
||||
if (v->clean == 0) {
|
||||
strncat(dst, "-unclean", len - strlen(dst) - 1);
|
||||
} else if (v->clean == 2) {
|
||||
strncat(dst, "-suspect", len - strlen(dst) - 1);
|
||||
}
|
||||
|
||||
strncat(dst, " ", len - strlen(dst) - 1);
|
||||
strncat(dst, v->buildtime, len - strlen(dst) - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
ref http://www.csm.ornl.gov/~dunigan/crc.html
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
# define NTIME(n) for (int _index = 0; _index < n; _index++)
|
||||
#endif
|
||||
|
||||
extern struct version_information version_information;
|
||||
void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_info);
|
||||
|
||||
uint32_t reflect(uint32_t v, int b); // used in crc.c ...
|
||||
uint8_t reflect8(uint8_t b); // dedicated 8bit reversal
|
||||
uint16_t reflect16(uint16_t b); // dedicated 16bit reversal
|
||||
|
|
9
common/default_version.c
Normal file
9
common/default_version.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "common.h"
|
||||
/* This is the default version.c file that Makefile.common falls back to if neither sh nor perl are available */
|
||||
const struct version_information __attribute__((section(".version_information"))) version_information = {
|
||||
VERSION_INFORMATION_MAGIC,
|
||||
1, /* version 1 */
|
||||
0, /* version information not present */
|
||||
2, /* cleanliness couldn't be determined */
|
||||
/* Remaining fields: zero */
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue