summaryrefslogtreecommitdiff
path: root/src/keyboard_die.c
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/keyboard_die.c
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/keyboard_die.c')
-rw-r--r--src/keyboard_die.c16
1 files changed, 14 insertions, 2 deletions
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) {