Publish server and protocol version on avahi

This commit is contained in:
Guillaume Meunier committed 2023-12-16 14:16:48 +01:00
1 parent 3076e61f49
commit 59ebc4b87e
3 files changed
+22 -6

No files matched your search

+4 -3
View File
@@ -17,6 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "version.h"
const char git_version[] = "@GIT_DESC@";
namespace xrt::drivers::wivrn
{
const char git_version[] = "@GIT_DESC@";
}
+11 -1
View File
@@ -1,3 +1,13 @@
#pragma once
extern const char git_version[];
#include "wivrn_serialization.h"
#include "wivrn_packets.h"
namespace xrt::drivers::wivrn
{
using protocol = std::pair<from_headset::packets, to_headset::packets>;
extern const char git_version[];
static inline const constinit auto protocol_version = serialization_type_hash<protocol>();
}
+7 -2
View File
@@ -165,7 +165,7 @@ void waitpid_verbose(pid_t pid, const std::string & name)
int inner_main(int argc, char * argv[])
{
std::cerr << "WiVRn " << git_version << " starting" << std::endl;
std::cerr << "WiVRn " << xrt::drivers::wivrn::git_version << " starting" << std::endl;
create_listen_socket();
u_trace_marker_init();
@@ -188,12 +188,17 @@ int inner_main(int argc, char * argv[])
fcntl(pipe_fds[0], F_SETFD, FD_CLOEXEC);
fcntl(pipe_fds[1], F_SETFD, FD_CLOEXEC);
std::vector<std::string> TXT;
TXT.push_back(std::format("protocol={:16x}", xrt::drivers::wivrn::protocol_version));
TXT.push_back(std::format("version={}", (const char*)xrt::drivers::wivrn::git_version));
bool quit = false;
while (!quit)
{
try
{
avahi_publisher publisher(hostname().c_str(), "_wivrn._tcp", default_port);
avahi_publisher publisher(hostname().c_str(), "_wivrn._tcp", default_port, TXT);
TCPListener listener(default_port);
bool client_connected = false;