From a931b0b2ecec47dd11c3132244b21008c0e20baa Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sat, 23 Nov 2024 23:30:26 +0100 Subject: [PATCH] Send the model name to the server when connecting --- client/hardware.cpp | 12 ++++++++++++ client/hardware.h | 1 + client/wivrn_client.cpp | 6 +++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/client/hardware.cpp b/client/hardware.cpp index 760b5d12..17f5bc33 100644 --- a/client/hardware.cpp +++ b/client/hardware.cpp @@ -95,6 +95,18 @@ model guess_model() return m; } +std::string model_name() +{ +#ifdef __ANDROID__ + const auto manufacturer = get_property("ro.product.manufacturer"); + const auto model = get_property("ro.product.model"); + + return manufacturer + " " + model; +#else + return "Unknown headset"; +#endif +} + static XrViewConfigurationView scale_view(XrViewConfigurationView view, uint32_t width) { double ratio = double(width) / view.recommendedImageRectWidth; diff --git a/client/hardware.h b/client/hardware.h index 6bcc92fe..48f4ab0d 100644 --- a/client/hardware.h +++ b/client/hardware.h @@ -49,6 +49,7 @@ enum class feature }; model guess_model(); +std::string model_name(); XrViewConfigurationView override_view(XrViewConfigurationView, model); diff --git a/client/wivrn_client.cpp b/client/wivrn_client.cpp index ff5e660e..9fa5c234 100644 --- a/client/wivrn_client.cpp +++ b/client/wivrn_client.cpp @@ -18,6 +18,7 @@ */ #include "wivrn_client.h" +#include "hardware.h" #include "secrets.h" #include "spdlog/common.h" #include "wivrn_packets.h" @@ -95,7 +96,10 @@ void wivrn_session::handshake(T address, bool tcp_only, crypto::key & headset_ke } }; - send_control(from_headset::crypto_handshake{.public_key = headset_keypair.public_key()}); + send_control(from_headset::crypto_handshake{ + .public_key = headset_keypair.public_key(), + .name = model_name(), + }); to_headset::crypto_handshake crypto_handshake = std::get(receive(10s));