Add UVC device name configuration and update device name retrieval logic

This commit is contained in:
PhosphorosVR
2025-09-05 19:36:09 +02:00
parent 4ed397ca2d
commit 8138ffa36d
5 changed files with 28 additions and 3 deletions
+16 -1
View File
@@ -1,5 +1,6 @@
#include "UVCStream.hpp" #include "UVCStream.hpp"
#include <cstdio> // for snprintf #include <cstdio> // for snprintf
#include <string>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
// no deps on main globals here; handover is performed in main before calling setup when needed // no deps on main globals here; handover is performed in main before calling setup when needed
@@ -12,7 +13,21 @@ extern "C"
const char *get_uvc_device_name() const char *get_uvc_device_name()
{ {
return deviceConfig->getMDNSConfig().hostname.c_str(); // Prefer explicit UVC name from Kconfig, fallback to mDNS hostname when empty
static std::string cached_name;
if (cached_name.empty())
{
const char *cfg_name = CONFIG_GENERAL_UVC_NAME;
if (cfg_name && cfg_name[0] != '\0')
{
cached_name = cfg_name;
}
else
{
cached_name = deviceConfig->getMDNSConfig().hostname;
}
}
return cached_name.c_str();
} }
const char *get_serial_number(void) const char *get_serial_number(void)
+7
View File
@@ -50,6 +50,13 @@ menu "OpenIris: General Configuration"
help help
A firmware version string exposed via the get_info command. A firmware version string exposed via the get_info command.
config GENERAL_UVC_NAME
string "UVC device name"
default "openiristracker"
help
Default name reported for the UVC interface/device over USB.
This is independent from the mDNS hostname used on WiFi.
endmenu endmenu
menu "OpenIris: Camera Configuration" menu "OpenIris: Camera Configuration"
+1
View File
@@ -576,6 +576,7 @@ CONFIG_GENERAL_STARTUP_DELAY=30
CONFIG_GENERAL_ENABLE_WIRELESS=y CONFIG_GENERAL_ENABLE_WIRELESS=y
CONFIG_GENERAL_WHO_AM_I="facefocusvr_face" CONFIG_GENERAL_WHO_AM_I="facefocusvr_face"
CONFIG_GENERAL_Version="0.0.1" CONFIG_GENERAL_Version="0.0.1"
CONFIG_GENERAL_UVC_NAME="FFVR Face"
# end of OpenIris: General Configuration # end of OpenIris: General Configuration
# #
+2 -1
View File
@@ -76,4 +76,5 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=80
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80=y CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80=y
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240 is not set # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240 is not set
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80 CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80
CONFIG_GENERAL_UVC_NAME="FFVR Eye"
+2 -1
View File
@@ -76,4 +76,5 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=80
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80=y CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80=y
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240 is not set # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240 is not set
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80 CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80
CONFIG_GENERAL_UVC_NAME="FFVR Face"