diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index e9ea9a80e..22b419d7b 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -4669,6 +4669,7 @@ Function,+,version_get_gitbranchnum,const char*,const Version* Function,+,version_get_githash,const char*,const Version* Function,+,version_get_target,uint8_t,const Version* Function,+,version_get_version,const char*,const Version* +Function,-,version_set_custom_name,void,"Version*, const char*" Function,-,vfiprintf,int,"FILE*, const char*, __gnuc_va_list" Function,-,vfiscanf,int,"FILE*, const char*, __gnuc_va_list" Function,-,vfprintf,int,"FILE*, const char*, __gnuc_va_list" diff --git a/lib/toolbox/version.c b/lib/toolbox/version.c index e0a6e6197..69c43b8bf 100644 --- a/lib/toolbox/version.c +++ b/lib/toolbox/version.c @@ -24,7 +24,7 @@ struct Version { }; /* version of current running firmware (bootloader/flipper) */ -static const Version version = { +static Version version = { .magic = VERSION_MAGIC, .major = VERSION_MAJOR, .minor = VERSION_MINOR, @@ -74,6 +74,12 @@ const char* version_get_custom_name(const Version* v) { return v ? v->custom_flipper_name : version.custom_flipper_name; } +void version_set_custom_name(Version* v, const char* name) { + Version* ver = v ? v : &version; + ver->custom_flipper_name = name; + return; +} + uint8_t version_get_target(const Version* v) { return v ? v->target : version.target; } diff --git a/lib/toolbox/version.h b/lib/toolbox/version.h index ed54631b3..43fe6a9d3 100644 --- a/lib/toolbox/version.h +++ b/lib/toolbox/version.h @@ -74,6 +74,14 @@ const char* version_get_version(const Version* v); */ const char* version_get_custom_name(const Version* v); +/** Get custom flipper name if set in ENV + * + * @param v pointer to Version data. NULL for currently running + * software. + * @param custom name or NULL + */ +void version_set_custom_name(Version* v, const char* name); + /** Get hardware target this firmware was built for * * @param v pointer to Version data. NULL for currently running diff --git a/lib/xtreme/namespoof.c b/lib/xtreme/namespoof.c index 9785700dd..3a5918a38 100644 --- a/lib/xtreme/namespoof.c +++ b/lib/xtreme/namespoof.c @@ -17,7 +17,8 @@ void NAMESPOOF_INIT() { if(version != NAMESPOOF_VERSION) break; if(!flipper_format_read_string(file, "Name", str)) break; - furi_hal_version_set_name(furi_string_get_cstr(str)); + version_set_custom_name(NULL, strdup(furi_string_get_cstr(str))); + furi_hal_version_set_name(version_get_custom_name(NULL)); } while(false); flipper_format_free(file);