changeset 4525:46c4e34b4e76

Tell the user when we fallback on default config. Added some default joystick bindings
author albeu
date Mon, 04 Feb 2002 14:48:32 +0000
parents 01a0cf736e0d
children c619a7271690
files input/input.c
diffstat 1 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/input/input.c	Mon Feb 04 14:19:54 2002 +0000
+++ b/input/input.c	Mon Feb 04 14:48:32 2002 +0000
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <sys/types.h>
+#include <sys/time.h>
 #include <fcntl.h>
 
 
@@ -160,6 +161,16 @@
   { 'n', "tv_step_norm" },
   { 'b', "tv_step_chanlist" },
 #endif
+#ifdef HAVE_JOYSTICK
+  { JOY_AXIS0_PLUS, "seek 10" },
+  { JOY_AXIS0_MINUS, "seek -10" },
+  { JOY_AXIS1_MINUS, "seek 60" },
+  { JOY_AXIS1_PLUS, "seek -60" },
+  { JOY_BTN0, "pause" },
+  { JOY_BTN1, "osd" },
+  { JOY_BTN2, "volume 1"},
+  { JOY_BTN3, "volume -1"},
+#endif
   { 0, NULL }
 };
 
@@ -669,7 +680,7 @@
 #define BS_MAX 256
 #define SPACE_CHAR " \n\r\t"
 
-static void
+static int
 mp_input_parse_config(char *file) {
   int fd,code=-1;
   int bs = 0,r,eof = 0;
@@ -682,7 +693,7 @@
 
   if(fd < 0) {
     printf("Can't open input config file %s : %s\n",file,strerror(errno));
-    return;
+    return 0;
   }
 
   printf("Parsing input config file %s\n",file);
@@ -696,7 +707,7 @@
 	  continue;
 	printf("Error while reading input config file %s : %s\n",file,strerror(errno));
 	mp_input_free_binds(binds);
-	return;
+	return 0;
       } else if(r == 0) 
 	eof = 1;
       else {
@@ -709,7 +720,7 @@
       printf("Input config file %s parsed : %d binds\n",file,n_binds);
       if(binds)
 	cmd_binds = binds;
-      return;
+      return 1;
     }
       
     iter = buffer;
@@ -733,7 +744,7 @@
 	  else
 	    printf("Buffer is too small for this key name : %s\n",iter);
 	  mp_input_free_binds(binds);
-	  return;
+	  return 0;
 	}
 	memmove(buffer,iter,end-iter);
 	bs = end-iter;
@@ -747,7 +758,7 @@
 	if(code < 0) {
 	  printf("Unknow key %s\n",name);
 	  mp_input_free_binds(binds);
-	  return;
+	  return 0;
 	}
       }
       if( bs > (end-buffer))
@@ -772,7 +783,7 @@
 	if(iter == buffer) {
 	  printf("Buffer is too small for command %s\n",buffer);
 	  mp_input_free_binds(binds);
-	  return;
+	  return 0;
 	}
 	memmove(buffer,iter,end - iter);
 	bs = end - iter;
@@ -797,6 +808,7 @@
     }
   }
   printf("What are we doing here ?\n");
+  return 0;
 }
 
 extern char *get_path(char *filename);
@@ -809,7 +821,8 @@
   if(!file)
     return;
   
-  mp_input_parse_config(file);
+  if(! mp_input_parse_config(file))
+    printf("Falling back on default (hardcoded) config\n");
 
 #ifdef HAVE_JOYSTICK
   {