Skip to content

Commit

Permalink
Merge pull request #291 from caiom/fix_windows_dongle
Browse files Browse the repository at this point in the history
Fix windows wireless dongle setup
  • Loading branch information
jdavidberger authored Sep 29, 2023
2 parents eb604d0 + 464dd97 commit 9e3c6bc
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 9e3c6bc

Please sign in to comment.