Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wireless dongle on Linux #303

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/driver_vive.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ static uint8_t vive_magic_raw_mode_1[] = {VIVE_REPORT_CHANGE_MODE, 0x01, 0x00, 0
static uint8_t vive_request_version_info[] = {VIVE_REPORT_VERSION};

// Windows needs 64 size for the wireless dongle
static uint8_t vive_magic_rf_raw_mode_0[64] = {
static uint8_t vive_magic_rf_raw_mode_0[MAGIC_COMMAND_LENGTH] = {
VIVE_REPORT_COMMAND, VIVE_COMMAND_CHANGE_PROTOCOL, 0x6, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00};
static uint8_t vive_magic_rf_raw_mode_1[] = {
VIVE_REPORT_COMMAND, VIVE_COMMAND_CHANGE_PROTOCOL, 0x6, 0x01, 0x01, 0x00, 0x02, 0x00, 0x00};
// Windows needs 64 size for the wireless dongle
static uint8_t vive_magic_protocol_switch[64] = {
static uint8_t vive_magic_protocol_switch[MAGIC_COMMAND_LENGTH] = {
VIVE_REPORT_COMMAND, VIVE_COMMAND_CHANGE_PROTOCOL, 0x3, 0x00, 0x01, 0x00};
static uint8_t vive_request_pairing[] = {VIVE_REPORT_COMMAND, VIVE_COMMAND_PAIR, 0x03, 0x01, 0x10, 0x27};
// Windows needs 64 size for the wireless dongle
static uint8_t vive_magic_protocol_super_magic[64] = {VIVE_REPORT_COMMAND,
static uint8_t vive_magic_protocol_super_magic[MAGIC_COMMAND_LENGTH] = {VIVE_REPORT_COMMAND,
VIVE_COMMAND_CONFIGURE_RADIO,
0x10,
0xbe,
Expand Down Expand Up @@ -568,7 +568,7 @@ void vive_switch_mode(struct SurviveUSBInfo *driverInfo, enum LightcapMode light
SurviveObject *w = driverInfo->so;
if (driverInfo->timeWithoutFlag == 0) {
driverInfo->timeWithoutFlag = 1;
uint8_t buffer[9] = {0};
uint8_t buffer[64] = {0};
size_t buffer_length = 0;
if (survive_device_is_rf(driverInfo->device_info)) {
buffer[0] = VIVE_REPORT_COMMAND;
Expand All @@ -581,11 +581,11 @@ void vive_switch_mode(struct SurviveUSBInfo *driverInfo, enum LightcapMode light
buffer[6] = 2;
buffer[7] = lightcapMode == LightcapMode_raw2 ? 1 : 0;
buffer[8] = 0;
buffer_length = 9;
buffer_length = 64;
} else {
buffer[0] = VIVE_REPORT_CHANGE_MODE;
buffer[1] = (lightcapMode == LightcapMode_raw1) ? 1 : (lightcapMode == LightcapMode_raw2) ? 3 : 0;
buffer_length = 5;
buffer_length = 64;
}

if (driverInfo->handle) {
Expand Down
5 changes: 5 additions & 0 deletions src/driver_vive.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
#include <libusb-1.0/libusb.h>
#endif
#endif
#if defined(WINDOWS) || defined(WIN32) || defined(_WIN32)
#define MAGIC_COMMAND_LENGTH 64
#else
#define MAGIC_COMMAND_LENGTH
#endif

#include "os_generic.h"

Expand Down