From d9f7be90abb4191db97a385cb004fc4a23f92f46 Mon Sep 17 00:00:00 2001 From: epoch Date: Fri, 9 Oct 2020 23:44:17 -0500 Subject: mouse_wii was not refreshing on change. keyboard and mouse event devices can now be set using getenv instead of editing source code --- src/keyboard_die.c | 5 ++++- src/mouse_wii.c | 12 +++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/keyboard_die.c b/src/keyboard_die.c index 46eb1fa..dd172b9 100644 --- a/src/keyboard_die.c +++ b/src/keyboard_die.c @@ -3,10 +3,13 @@ #include #include #include +#include //getenv() #include "keyboard.h" -#define KBDEV "/dev/input/by-path/pci-0000:00:02.0-usb-0:2.1:1.0-event-kbd" +//#define KBDEV "/dev/input/by-path/pci-0000:00:02.0-usb-0:2.1:1.0-event-kbd" +//#define KBDEV "/dev/input/event3" +#define KBDEV getenv("HVR_KBDEV") int kbfd = -1; diff --git a/src/mouse_wii.c b/src/mouse_wii.c index 863e4e2..63020f2 100644 --- a/src/mouse_wii.c +++ b/src/mouse_wii.c @@ -3,6 +3,7 @@ #include #include #include +#include //getenv() #include "graphics_c3.h" #include "mouse.h" @@ -11,8 +12,8 @@ extern struct hvr_global global; extern struct gra_global gra_global; //#define MOUSEDEV "/dev/input/mouse0" //just one of the many possibly connected mice. (just in case you want to use one mouse for one thing and another mouse for something else) -#define MOUSEDEV "/dev/input/event19" - +//#define MOUSEDEV "/dev/input/event19" +#define MOUSEDEV getenv("HVR_MOUSEDEV") int mfd = -1; //#define "mouse.h" //I guess @@ -50,10 +51,10 @@ char die2map(char d) {//edit this function if you want to change your primary an int mouse_event_handler() { struct wtf ie; - int butt; + //int butt; int l; - int i;//this is a DIE_MOUSE value - unsigned char m;//this is a hackvr mouse map value. + //int i;//this is a DIE_MOUSE value + //unsigned char m;//this is a hackvr mouse map value. int redrawplzkthx=0; memset(&ie,0,sizeof(ie)); if(mfd == -1) { @@ -69,6 +70,7 @@ int mouse_event_handler() { if(ie.code == 3) global.camera.r.x.d=ie.state; if(ie.code == 4) global.camera.r.y.d=ie.state; if(ie.code == 5) global.camera.r.z.d=ie.state; + if(ie.code >= 3 && ie.code <= 5) redrawplzkthx=1; /* for(i=0;i<3;i++) {//we need to loop over all buttons each event. :/ butt=ie.type & 0x07 & (1<