Skip to content

Commit

Permalink
Fix windows wireless dongle setup
Browse files Browse the repository at this point in the history
  • Loading branch information
caiom committed Sep 21, 2023
1 parent ec902cc commit 464dd97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/driver_vive.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,17 @@ static uint8_t vive_magic_power_off[] = {
static uint8_t vive_magic_raw_mode_1[] = {VIVE_REPORT_CHANGE_MODE, 0x01, 0x00, 0x00, 0x00};
static uint8_t vive_request_version_info[] = {VIVE_REPORT_VERSION};

static uint8_t vive_magic_rf_raw_mode_0[] = {
// Windows needs 64 size for the wireless dongle
static uint8_t vive_magic_rf_raw_mode_0[64] = {
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};
static uint8_t vive_magic_protocol_switch[] = {
// Windows needs 64 size for the wireless dongle
static uint8_t vive_magic_protocol_switch[64] = {
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};
static uint8_t vive_magic_protocol_super_magic[] = {VIVE_REPORT_COMMAND,
// Windows needs 64 size for the wireless dongle
static uint8_t vive_magic_protocol_super_magic[64] = {VIVE_REPORT_COMMAND,
VIVE_COMMAND_CONFIGURE_RADIO,
0x10,
0xbe,
Expand Down
4 changes: 3 additions & 1 deletion src/driver_vive.hidapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ static survive_usb_device_t get_next_device(survive_usb_device_enumerator* d, su
return *d = head;
}

// On Windows the wireless dongle interface is -1
// That's why we check for <= 0
for (survive_usb_device_t c = (*d)->next; c; c = c->next) {
if (c->interface_number == 0) {
if (c->interface_number <= 0) {
return *d = c;
}
}
Expand Down

0 comments on commit 464dd97

Please sign in to comment.