aboutsummaryrefslogtreecommitdiff
path: root/src/survive_vive.c
diff options
context:
space:
mode:
authorMike Turvey <mturvey6@gmail.com>2018-01-02 23:47:22 -0700
committerMike Turvey <mturvey6@gmail.com>2018-01-02 23:47:22 -0700
commitffb879d7a69c3c38937ff0159de0a5d1db99b713 (patch)
tree95d38b982bd7b8512a68e814d260779f93d080d0 /src/survive_vive.c
parent7ef98a611c4e32dc89eba26581f7245797d0623a (diff)
downloadlibsurvive-ffb879d7a69c3c38937ff0159de0a5d1db99b713.tar.gz
libsurvive-ffb879d7a69c3c38937ff0159de0a5d1db99b713.tar.bz2
Haptic POC
--Upon startup, Watchman1 (wireless only) will do a short haptic feedback/ vibration. --Also have some POC code that turns off the controller (currently disabled) --Thank you Nairol!
Diffstat (limited to 'src/survive_vive.c')
-rwxr-xr-xsrc/survive_vive.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/survive_vive.c b/src/survive_vive.c
index 048aad4..e271e3e 100755
--- a/src/survive_vive.c
+++ b/src/survive_vive.c
@@ -619,18 +619,31 @@ int survive_vive_send_magic(SurviveContext * ctx, void * drv, int magic_code, vo
//#endif
+//#if 0
+ for (int i = 0; i < 0xff; i++)
+ {
+ //uint8_t vive_controller_haptic_pulse[64] = { 0xff, 0x8f, 0x7, 0 /*right*/, 0xFF /*period on*/, 0xFF/*period on*/, 0xFF/*period off*/, 0xFF/*period off*/, 0xFF /* repeat Count */, 0xFF /* repeat count */ };
+ //uint8_t vive_controller_haptic_pulse[64] = { 0xff, 0x8f, 0x07, 0x00, 0xf4, 0x01, 0xb5, 0xa2, 0x01, 0x00 }; // data taken from Nairol's captures
+ uint8_t vive_controller_haptic_pulse[64] = { 0xff, 0x8f, 0x07, 0x00, 0xf4, 0x01, 0xb5, 0xa2, 0x01, 0x00 };
+ //r = update_feature_report( sv->udev[USB_DEV_WATCHMAN1], 0, vive_controller_haptic_pulse, sizeof( vive_controller_haptic_pulse ) );
+ r = update_feature_report(sv->udev[USB_DEV_WATCHMAN1], 0, vive_controller_haptic_pulse, sizeof(vive_controller_haptic_pulse));
+ SV_INFO("UCR: %d", r);
+ if (r != sizeof(vive_controller_haptic_pulse)) printf("HAPTIC FAILED **************************\n"); // return 5;
+ OGUSleep(1000);
+ }
+//#endif
+
#if 0
- for( int i = 0; i < 256; i++ )
+ // working code to turn off a wireless controller:
{
- static uint8_t vive_controller_haptic_pulse[64] = { 0xff, 0x8f, 0xff, 0, 0, 0, 0, 0, 0, 0 };
+ uint8_t vive_controller_off[64] = { 0xff, 0x9f, 0x04, 'o', 'f', 'f', '!' };
//r = update_feature_report( sv->udev[USB_DEV_WATCHMAN1], 0, vive_controller_haptic_pulse, sizeof( vive_controller_haptic_pulse ) );
- r = update_feature_report( sv->udev[USB_DEV_W_WATCHMAN1_LIGHTCAP], 0, vive_controller_haptic_pulse, sizeof( vive_controller_haptic_pulse ) );
- SV_INFO( "UCR: %d", r );
- if( r != sizeof( vive_controller_haptic_pulse ) ) return 5;
- OGUSleep( 1000 );
+ r = update_feature_report(sv->udev[USB_DEV_WATCHMAN1], 0, vive_controller_off, sizeof(vive_controller_off));
+ SV_INFO("UCR: %d", r);
+ if (r != sizeof(vive_controller_off)) printf("OFF FAILED **************************\n"); // return 5;
+ OGUSleep(1000);
}
#endif
-
//if (sv->udev[USB_DEV_TRACKER0])
//{
// static uint8_t vive_magic_power_on[64] = { 0x04, 0x78, 0x29, 0x38 };