filename | src/drivers/joy_linux.c |
changeset | 669:ab344e42bca9 |
prev | 637:6a284eff5311 |
next | 736:a02d1475ccfd |
author | nkeynes |
date | Mon May 12 10:00:13 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Cleanup most of the -Wall warnings (getting a bit sloppy...) Convert FP code to use fixed banks rather than indirect pointer (3-4% faster this way now) |
file | annotate | diff | log | raw |
1.1 --- a/src/drivers/joy_linux.c Thu Feb 14 14:08:32 2008 +00001.2 +++ b/src/drivers/joy_linux.c Mon May 12 10:00:13 2008 +00001.3 @@ -23,6 +23,8 @@1.4 #include <stdio.h>1.5 #include <signal.h>1.6 #include <string.h>1.7 +#include <stdlib.h>1.8 +#include <unistd.h>1.9 #include <fcntl.h>1.10 #include <dirent.h>1.11 #include <ctype.h>1.12 @@ -33,6 +35,8 @@1.14 #include "lxdream.h"1.15 #include "display.h"1.16 +#include "maple/maple.h"1.17 +#include "drivers/joy_linux.h"1.19 #define INPUT_PATH "/dev/input"1.21 @@ -48,7 +52,8 @@1.23 static gboolean linux_joystick_callback( GIOChannel *source, GIOCondition condition,1.24 gpointer data );1.25 -static linux_joystick_t linux_joystick_add( const gchar *filename, int fd );1.26 +static int linux_joystick_scan();1.27 +static linux_joystick_t linux_joystick_new( const gchar *filename, int fd );1.28 static uint16_t linux_joystick_resolve_keysym( input_driver_t dev, const gchar *str );1.29 static gchar *linux_joystick_keysym_for_keycode( input_driver_t dev, uint16_t keycode );1.30 static void linux_joystick_destroy( input_driver_t joy );1.31 @@ -157,8 +162,8 @@1.32 }1.33 }1.34 }1.35 - return TRUE;1.36 }1.37 + return TRUE;1.38 }1.40 /**1.41 @@ -166,7 +171,7 @@1.42 * descriptor. The joystick is automatically added to the watch list.1.43 * @return The new joystick, or NULL if an error occurred.1.44 */1.45 -linux_joystick_t linux_joystick_new( const gchar *filename, int fd )1.46 +static linux_joystick_t linux_joystick_new( const gchar *filename, int fd )1.47 {1.48 linux_joystick_t joy = g_malloc0(sizeof(struct linux_joystick));1.49 joy->filename = filename;1.50 @@ -196,13 +201,7 @@1.51 return joy;1.52 }1.54 -int linux_joystick_init()1.55 -{1.56 - linux_joystick_install_watch(INPUT_PATH);1.57 - linux_joystick_scan();1.58 -}1.59 -1.60 -int linux_joystick_scan()1.61 +static int linux_joystick_scan()1.62 {1.63 int joysticks = 0;1.64 struct dirent *ent;1.65 @@ -233,6 +232,15 @@1.66 return joysticks;1.67 }1.69 +gboolean linux_joystick_init()1.70 +{1.71 + if( !linux_joystick_install_watch(INPUT_PATH) ) {1.72 + return FALSE;1.73 + }1.74 + linux_joystick_scan();1.75 + return TRUE;1.76 +}1.77 +1.78 void linux_joystick_shutdown(void)1.79 {1.80 linux_joystick_uninstall_watch();1.81 @@ -275,6 +283,7 @@1.82 }1.83 watch_dir_fd = fd;1.84 g_timeout_add( 500, gtk_loop_check_input, NULL );1.85 + return TRUE;1.86 }1.88 static void linux_joystick_uninstall_watch(void)
.