summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorepoch <epoch@thebackupbox.net>2020-04-12 23:45:07 -0500
committerepoch <epoch@thebackupbox.net>2020-04-12 23:45:07 -0500
commitd9d998644defec48172fde353f0a339933800cce (patch)
tree8cb9c5d60e5b5c722068a3594400abc3c8cfacf4 /src
parentce3c98ddccee60d3dc52a953128b21ce375c6c3a (diff)
downloadhackvr-d9d998644defec48172fde353f0a339933800cce.tar.gz
hackvr-d9d998644defec48172fde353f0a339933800cce.zip
fixed up the /dev/input/event (die) inputs to work better with libidc
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c2
-rw-r--r--src/keyboard_die.c16
-rw-r--r--src/mouse_die.c10
3 files changed, 24 insertions, 4 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index c0e8ed9..78a0064 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10,7 +10,7 @@ extern struct gra_global gra_global;
char keyboard_map[1024]={0};
//return 0 is all is fine, -1 if we need to exit
-void keyboard_event_handler() {
+void keyboard_event_handler(struct shit *me,char *junk) {//these arguments aren't actually used.
int k;
char line[2560];
c3_group_rot_t *gr;
diff --git a/src/keyboard_die.c b/src/keyboard_die.c
index d620f70..e043db4 100644
--- a/src/keyboard_die.c
+++ b/src/keyboard_die.c
@@ -10,6 +10,17 @@
int kbfd = -1;
+int keyboard_init() {
+ if((kbfd=open(KBDEV,O_RDWR)) == -1) {
+ fprintf(stderr,"# failed to open keyboard: %s\n",KBDEV);
+ }
+ return kbfd;
+}
+
+/*void keyboard_event_handler(struct *me,char *junk) {
+ //wtf goes here?
+}*/
+
hvk_t die_keypress_handler(unsigned short code) {
switch(code) {
case KEY_W: return HVK_FORWARD;
@@ -28,10 +39,11 @@ hvk_t get_keyboard_event() {
memset(&ie,0,sizeof(ie));
if(kbfd == -1) {
kbfd=open(KBDEV,O_RDWR);
- fcntl(kbfd,F_SETFL,O_NONBLOCK);
+ //probably not needed anymore
+ //fcntl(kbfd,F_SETFL,O_NONBLOCK);
}
if(kbfd == -1) {
- fprintf(stderr,"# keyboard shit fucked up.\n");
+ fprintf(stderr,"# keyboard shit fucked up. probably permissions error.\n");
return 1;
}
if((l=read(kbfd,&ie,sizeof(ie))) > 0) {
diff --git a/src/mouse_die.c b/src/mouse_die.c
index 6729a94..b17c143 100644
--- a/src/mouse_die.c
+++ b/src/mouse_die.c
@@ -18,13 +18,21 @@ struct wtf {
char dy;
};
+int mouse_init() {
+ if((mfd=open(MOUSEDEV,O_RDWR)) == -1) {
+ fprintf(stderr,"# failed to open mouse: %d\n",mfd);
+ }
+ return mfd;
+}
+
int mouse_event_handler() {
struct wtf ie;
int l;
memset(&ie,0,sizeof(ie));
if(mfd == -1) {
mfd=open(MOUSEDEV,O_RDWR);
- fcntl(mfd,F_SETFL,O_NONBLOCK);
+ //probably don't need nonblock anymore.
+ //fcntl(mfd,F_SETFL,O_NONBLOCK);
}
if(mfd == -1) {
fprintf(stderr,"# mouse shit fucked up.\n");