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

Wireless dongle not working on Linux #296

Open
nicshackle opened this issue Nov 3, 2023 · 1 comment
Open

Wireless dongle not working on Linux #296

nicshackle opened this issue Nov 3, 2023 · 1 comment

Comments

@nicshackle
Copy link

It seems that #291 introduced a regression on Linux. The below patch fixes it; happy to submit a PR but a) not sure if my method of detecting Windows is idiomatic and b) I don't have a windows system to test on:

diff --git a/src/driver_vive.c b/src/driver_vive.c
index d741b9b..9c35487 100755
--- a/src/driver_vive.c
+++ b/src/driver_vive.c
@@ -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,
diff --git a/src/driver_vive.h b/src/driver_vive.h
index 4aa7833..9c9e7ab 100644
--- a/src/driver_vive.h
+++ b/src/driver_vive.h
@@ -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"

Hardware setup
USB dongle --> Tracker (3.0)

Desktop:

  • OS: Ubuntu
  • Version 22
@maoyangchien
Copy link

this patch is ok for me, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants