From 62693c12fdebd5ae60582e012d08e3c62bd04058 Mon Sep 17 00:00:00 2001 From: wizkid057 Date: Tue, 4 Jun 2024 11:30:38 -0400 Subject: [PATCH] Add software version string to the stratum mining.subscribe (#197) lgtm --- components/stratum/CMakeLists.txt | 1 + components/stratum/stratum_api.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/stratum/CMakeLists.txt b/components/stratum/CMakeLists.txt index 0a4878e5..0f01fa41 100644 --- a/components/stratum/CMakeLists.txt +++ b/components/stratum/CMakeLists.txt @@ -9,4 +9,5 @@ INCLUDE_DIRS REQUIRES json mbedtls + app_update ) \ No newline at end of file diff --git a/components/stratum/stratum_api.c b/components/stratum/stratum_api.c index d87f68cc..ffdadca1 100644 --- a/components/stratum/stratum_api.c +++ b/components/stratum/stratum_api.c @@ -7,6 +7,7 @@ #include "stratum_api.h" #include "cJSON.h" #include "esp_log.h" +#include "esp_ota_ops.h" #include "lwip/sockets.h" #include "utils.h" #include @@ -299,7 +300,9 @@ int STRATUM_V1_subscribe(int socket, char * model) { // Subscribe char subscribe_msg[BUFFER_SIZE]; - sprintf(subscribe_msg, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\"bitaxe/%s\"]}\n", send_uid++, model); + const esp_app_desc_t *app_desc = esp_ota_get_app_description(); + const char *version = app_desc->version; + sprintf(subscribe_msg, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\"bitaxe/%s (%s)\"]}\n", send_uid++, model, version); debug_stratum_tx(subscribe_msg); write(socket, subscribe_msg, strlen(subscribe_msg));