Publish server and protocol version on avahi
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "version.h"
|
namespace xrt::drivers::wivrn
|
||||||
|
{
|
||||||
const char git_version[] = "@GIT_DESC@";
|
const char git_version[] = "@GIT_DESC@";
|
||||||
|
}
|
||||||
|
|||||||
+11
-1
@@ -1,3 +1,13 @@
|
|||||||
#pragma once
|
#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
@@ -165,7 +165,7 @@ void waitpid_verbose(pid_t pid, const std::string & name)
|
|||||||
|
|
||||||
int inner_main(int argc, char * argv[])
|
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();
|
create_listen_socket();
|
||||||
|
|
||||||
u_trace_marker_init();
|
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[0], F_SETFD, FD_CLOEXEC);
|
||||||
fcntl(pipe_fds[1], 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;
|
bool quit = false;
|
||||||
while (!quit)
|
while (!quit)
|
||||||
{
|
{
|
||||||
try
|
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);
|
TCPListener listener(default_port);
|
||||||
bool client_connected = false;
|
bool client_connected = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user