From 7e26c0cbd9d0c7afc8298b07b44cdcc70e512c06 Mon Sep 17 00:00:00 2001 From: Matthew Vance Date: Fri, 19 Dec 2025 14:05:18 -0800 Subject: [PATCH 1/4] Update for Improv 2.4 commands/capabilities --- src/improv.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/improv.h b/src/improv.h index d6befbd..97db928 100644 --- a/src/improv.h +++ b/src/improv.h @@ -24,6 +24,7 @@ enum Error : uint8_t { ERROR_UNKNOWN_RPC = 0x02, ERROR_UNABLE_TO_CONNECT = 0x03, ERROR_NOT_AUTHORIZED = 0x04, + ERROR_BAD_HOSTNAME = 0x05, ERROR_UNKNOWN = 0xFF, }; @@ -42,10 +43,16 @@ enum Command : uint8_t { GET_CURRENT_STATE = 0x02, GET_DEVICE_INFO = 0x03, GET_WIFI_NETWORKS = 0x04, + HOSTNAME = 0x05, + DEVICE_NAME = 0x06, BAD_CHECKSUM = 0xFF, }; static const uint8_t CAPABILITY_IDENTIFY = 0x01; +static const uint8_t CAPABILITY_GET_DEVICE_INFO = 0x02; +static const uint8_t CAPABILITY_GET_WIFI_NETWORKS = 0x03; +static const uint8_t CAPABILITY_HOSTNAME = 0x04; +static const uint8_t CAPABILITY_DEVICE_NAME = 0x05; static const uint8_t IMPROV_SERIAL_VERSION = 1; enum ImprovSerialType : uint8_t { From 94324ed7e7d1d4aaa22140998c6c573025ad363e Mon Sep 17 00:00:00 2001 From: Matthew Vance Date: Fri, 26 Dec 2025 21:45:45 -0800 Subject: [PATCH 2/4] Fixing capability bitmasks --- src/improv.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/improv.h b/src/improv.h index 97db928..87b700f 100644 --- a/src/improv.h +++ b/src/improv.h @@ -48,11 +48,11 @@ enum Command : uint8_t { BAD_CHECKSUM = 0xFF, }; -static const uint8_t CAPABILITY_IDENTIFY = 0x01; -static const uint8_t CAPABILITY_GET_DEVICE_INFO = 0x02; -static const uint8_t CAPABILITY_GET_WIFI_NETWORKS = 0x03; -static const uint8_t CAPABILITY_HOSTNAME = 0x04; -static const uint8_t CAPABILITY_DEVICE_NAME = 0x05; +static const uint8_t CAPABILITY_IDENTIFY = 1 << 0; +static const uint8_t CAPABILITY_GET_DEVICE_INFO = 1 << 1; +static const uint8_t CAPABILITY_GET_WIFI_NETWORKS = 1 << 2; +static const uint8_t CAPABILITY_HOSTNAME = 1 << 3; +static const uint8_t CAPABILITY_DEVICE_NAME = 1 << 4; static const uint8_t IMPROV_SERIAL_VERSION = 1; enum ImprovSerialType : uint8_t { From c980be64a8c96246b3149e93cec345dba48bedae Mon Sep 17 00:00:00 2001 From: Matthew Vance Date: Sat, 27 Dec 2025 13:23:32 -0800 Subject: [PATCH 3/4] Adding parsing of hostname/device name --- src/improv.cpp | 11 +++++++++++ src/improv.h | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/improv.cpp b/src/improv.cpp index 8a540e9..7868b32 100644 --- a/src/improv.cpp +++ b/src/improv.cpp @@ -51,6 +51,17 @@ ImprovCommand parse_improv_data(const uint8_t *data, size_t length, bool check_c std::string ssid(data + ssid_start, data + ssid_end); std::string password(data + pass_start, data + pass_end); return {.command = command, .ssid = ssid, .password = password}; + } else if ((command == HOSTNAME || command == DEVICE_NAME) && data[2] > 0) { + uint8_t name_length = data[2]; + uint8_t name_start = 3; + size_t name_end = name_start + name_length; + if (name_end > length) { + improv_command.command = UNKNOWN; + return improv_command; + } + + std::string name(data + name_start, data + name_end); + return {.command = command, .name = name}; } improv_command.command = command; diff --git a/src/improv.h b/src/improv.h index 87b700f..06e1dbe 100644 --- a/src/improv.h +++ b/src/improv.h @@ -53,7 +53,7 @@ static const uint8_t CAPABILITY_GET_DEVICE_INFO = 1 << 1; static const uint8_t CAPABILITY_GET_WIFI_NETWORKS = 1 << 2; static const uint8_t CAPABILITY_HOSTNAME = 1 << 3; static const uint8_t CAPABILITY_DEVICE_NAME = 1 << 4; -static const uint8_t IMPROV_SERIAL_VERSION = 1; +static const uint8_t IMPROV_SERIAL_VERSION = 2; enum ImprovSerialType : uint8_t { TYPE_CURRENT_STATE = 0x01, @@ -66,6 +66,7 @@ struct ImprovCommand { Command command; std::string ssid; std::string password; + std::string name; // hostname or device_name }; ImprovCommand parse_improv_data(const std::vector &data, bool check_checksum = true); From 6e8764c34515dafb40bfb0168edc8ef8d425487e Mon Sep 17 00:00:00 2001 From: Matthew Vance Date: Sat, 27 Dec 2025 13:25:29 -0800 Subject: [PATCH 4/4] Reverting improv serial version to 1 --- src/improv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/improv.h b/src/improv.h index 06e1dbe..e866e26 100644 --- a/src/improv.h +++ b/src/improv.h @@ -53,7 +53,7 @@ static const uint8_t CAPABILITY_GET_DEVICE_INFO = 1 << 1; static const uint8_t CAPABILITY_GET_WIFI_NETWORKS = 1 << 2; static const uint8_t CAPABILITY_HOSTNAME = 1 << 3; static const uint8_t CAPABILITY_DEVICE_NAME = 1 << 4; -static const uint8_t IMPROV_SERIAL_VERSION = 2; +static const uint8_t IMPROV_SERIAL_VERSION = 1; enum ImprovSerialType : uint8_t { TYPE_CURRENT_STATE = 0x01,