Skip to content

Commit 464dd97

Browse files
committed
Fix windows wireless dongle setup
1 parent ec902cc commit 464dd97

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/driver_vive.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,17 @@ static uint8_t vive_magic_power_off[] = {
218218
static uint8_t vive_magic_raw_mode_1[] = {VIVE_REPORT_CHANGE_MODE, 0x01, 0x00, 0x00, 0x00};
219219
static uint8_t vive_request_version_info[] = {VIVE_REPORT_VERSION};
220220

221-
static uint8_t vive_magic_rf_raw_mode_0[] = {
221+
// Windows needs 64 size for the wireless dongle
222+
static uint8_t vive_magic_rf_raw_mode_0[64] = {
222223
VIVE_REPORT_COMMAND, VIVE_COMMAND_CHANGE_PROTOCOL, 0x6, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00};
223224
static uint8_t vive_magic_rf_raw_mode_1[] = {
224225
VIVE_REPORT_COMMAND, VIVE_COMMAND_CHANGE_PROTOCOL, 0x6, 0x01, 0x01, 0x00, 0x02, 0x00, 0x00};
225-
static uint8_t vive_magic_protocol_switch[] = {
226+
// Windows needs 64 size for the wireless dongle
227+
static uint8_t vive_magic_protocol_switch[64] = {
226228
VIVE_REPORT_COMMAND, VIVE_COMMAND_CHANGE_PROTOCOL, 0x3, 0x00, 0x01, 0x00};
227229
static uint8_t vive_request_pairing[] = {VIVE_REPORT_COMMAND, VIVE_COMMAND_PAIR, 0x03, 0x01, 0x10, 0x27};
228-
static uint8_t vive_magic_protocol_super_magic[] = {VIVE_REPORT_COMMAND,
230+
// Windows needs 64 size for the wireless dongle
231+
static uint8_t vive_magic_protocol_super_magic[64] = {VIVE_REPORT_COMMAND,
229232
VIVE_COMMAND_CONFIGURE_RADIO,
230233
0x10,
231234
0xbe,

src/driver_vive.hidapi.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ static survive_usb_device_t get_next_device(survive_usb_device_enumerator* d, su
171171
return *d = head;
172172
}
173173

174+
// On Windows the wireless dongle interface is -1
175+
// That's why we check for <= 0
174176
for (survive_usb_device_t c = (*d)->next; c; c = c->next) {
175-
if (c->interface_number == 0) {
177+
if (c->interface_number <= 0) {
176178
return *d = c;
177179
}
178180
}

0 commit comments

Comments
 (0)