diff input/input.c @ 26763:c13288eeb9f6

Add support for AppleIR Remote as an input under Linux systems. This requires Linux 2.6 with evdev and appleir drivers. The keymapping is done to mimics the one that was done for MacOSX. WARNING: Most distributions do not seems to bother and only let root access to the device. Modify udev rules accordingly if you want regular user to be able to use the remote.
author ben
date Sun, 18 May 2008 11:53:00 +0000
parents 45fc8351ca9b
children 2873fbda71f8
line wrap: on
line diff
--- a/input/input.c	Sat May 17 14:33:45 2008 +0000
+++ b/input/input.c	Sun May 18 11:53:00 2008 +0000
@@ -569,6 +569,7 @@
 static int use_ar = 1;
 
 static char* js_dev = NULL;
+static char* ar_dev = NULL;
 
 static char* in_file = NULL;
 static int in_file_fd = -1;
@@ -579,6 +580,7 @@
 // Our command line options
 static m_option_t input_conf[] = {
   { "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
+  { "ar-dev", &ar_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
   { "ar-delay", &ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
   { "ar-rate", &ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
   { "keylist", mp_input_print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
@@ -1760,6 +1762,16 @@
   }
 #endif
 
+#ifdef HAVE_APPLE_IR
+  if(use_ar) {
+    int fd = mp_input_appleir_init(ar_dev);
+    if(fd < 0)
+      mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantInitAppleRemote);
+    else
+      mp_input_add_key_fd(fd,1,mp_input_appleir_read,(mp_close_func_t)close);
+  }
+#endif
+  
   if(in_file) {
     struct stat st;
     if(stat(in_file,&st))