diff options
author | Florian Jung <flo@windfisch.org> | 2014-09-07 01:53:10 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2014-09-07 01:53:10 +0200 |
commit | f498d6e01a79ef9509d4b3e39e9ef354d0f7428a (patch) | |
tree | ff0cf6556471f187c11a4f0a96312540eb9fedd4 /joystick.cpp | |
parent | 8bb8a119cf0bfea388e499f2d1bbcdbdd18d9db0 (diff) |
use JOYSTICK_{UINPUT,PATCHEDINPUTPLUGIN} #defines instead of FREEBSD/LINUX
Diffstat (limited to 'joystick.cpp')
-rw-r--r-- | joystick.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/joystick.cpp b/joystick.cpp index 4f2029b..6729023 100644 --- a/joystick.cpp +++ b/joystick.cpp @@ -29,7 +29,7 @@ #include <iostream> #include <fcntl.h> -#ifdef LINUX +#ifdef JOYSTICK_UINPUT #include <linux/input.h> #include <linux/uinput.h> #endif @@ -43,7 +43,7 @@ using namespace std; #define THROTTLE_CNT_MAX 10 -#ifdef FREEBSD +#ifdef JOYSTICK_PATCHEDINPUTPLUGIN static char* pack(const BUTTONS* buttons, char* buf) { buf[0]= (buttons->A_BUTTON ? 1 : 0) + @@ -76,7 +76,7 @@ static char* pack(const BUTTONS* buttons, char* buf) -#ifdef FREEBSD +#ifdef JOYSTICK_PATCHEDINPUTPLUGIN Joystick::Joystick() { if ((fifo_fd=open("/var/tmp/mupen64plus_ctl", O_WRONLY )) == -1) {throw string(strerror(errno));} @@ -127,8 +127,8 @@ Joystick::~Joystick() { close(fifo_fd); } -#endif // FREEBSD -#ifdef LINUX +#endif // JOYSTICK_PATCHEDINPUTPLUGIN +#ifdef JOYSTICK_UINPUT Joystick::Joystick() { fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK); @@ -185,6 +185,8 @@ void Joystick::steer(float dir, float dead_zone) ev.code=ABS_X; ev.value=5000+dir*5000; write(fd, &ev, sizeof(ev)); + + cout << "steering" << dir << endl; } @@ -218,7 +220,7 @@ void Joystick::reset() cout << "A zeroed" << endl; } -#endif // LINUX +#endif // JOYSTICK_UINPUT void Joystick::throttle(float t) |