[client/host] share the host version with the client for diagnostics

This commit is contained in:
Geoffrey McRae 2020-05-29 14:14:31 +10:00
parent 667ab981ba
commit 553e2830bb
4 changed files with 17 additions and 9 deletions

View File

@ -1 +1 @@
B2-rc2-1-gbc7871f630+1
B2-rc2-2-g667ab981ba+1

View File

@ -1474,19 +1474,25 @@ static int lg_run()
if (!state.running)
return -1;
if (udataSize != sizeof(KVMFR) ||
memcmp(udata->magic, KVMFR_MAGIC, sizeof(udata->magic)) != 0 ||
udata->version != KVMFR_VERSION)
const bool magicMatches = memcmp(udata->magic, KVMFR_MAGIC, sizeof(udata->magic)) == 0;
if (udataSize != sizeof(KVMFR) || !magicMatches || udata->version != KVMFR_VERSION)
{
DEBUG_BREAK();
DEBUG_ERROR("The host application is not compatible with this client");
DEBUG_ERROR("Expected KVMFR version %d", KVMFR_VERSION);
DEBUG_ERROR("This is not a Looking Glass error, do not report this");
DEBUG_ERROR("Please install the matching host application for this client");
if (magicMatches)
DEBUG_ERROR("Expected KVMFR version %d, got %d", KVMFR_VERSION, udata->version);
else
DEBUG_ERROR("Invalid KVMFR magic");
DEBUG_BREAK();
return -1;
}
DEBUG_INFO("Host ready, starting session");
DEBUG_INFO("Host ready, reported version: %s", udata->hostver);
DEBUG_INFO("Starting session");
if (!lgCreateThread("cursorThread", cursorThread, NULL, &t_cursor))
{

View File

@ -51,12 +51,13 @@ typedef enum CursorType
CursorType;
#define KVMFR_MAGIC "KVMFR---"
#define KVMFR_VERSION 1
#define KVMFR_VERSION 2
typedef struct KVMFR
{
char magic[8];
uint32_t version;
char hostver[32];
}
KVMFR;

View File

@ -435,9 +435,10 @@ int app_main(int argc, char * argv[])
DEBUG_INFO("Max Pointer Size : %u KiB", (unsigned int)MAX_POINTER_SIZE / 1024);
DEBUG_INFO("KVMFR Version : %u", KVMFR_VERSION);
KVMFR udata = {
const KVMFR udata = {
.magic = KVMFR_MAGIC,
.version = KVMFR_VERSION
.version = KVMFR_VERSION,
.hostver = BUILD_VERSION
};
LGMP_STATUS status;