diff options
| author | epoch <epoch@thebackupbox.net> | 2020-10-09 23:44:17 -0500 | 
|---|---|---|
| committer | epoch <epoch@thebackupbox.net> | 2020-10-09 23:44:17 -0500 | 
| commit | d9f7be90abb4191db97a385cb004fc4a23f92f46 (patch) | |
| tree | dba4de8aa2be78f39188bf81fd5ab00465c808f9 | |
| parent | c27f40e7f2d20b0a576ece53e9bdeacc7b40da9e (diff) | |
| download | hackvr-d9f7be90abb4191db97a385cb004fc4a23f92f46.tar.gz hackvr-d9f7be90abb4191db97a385cb004fc4a23f92f46.zip | |
mouse_wii was not refreshing on change. keyboard and mouse event devices can now be set using getenv instead of editing source code
| -rw-r--r-- | src/keyboard_die.c | 5 | ||||
| -rw-r--r-- | 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 <linux/input.h>  #include <fcntl.h>  #include <unistd.h> +#include <stdlib.h> //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 <linux/input.h>  #include <fcntl.h>  #include <unistd.h> +#include <stdlib.h> //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<<i);//lowest 3 bits are possible mouse button states | 
