# HG changeset patch
# User Darren Salt <[EMAIL PROTECTED]>
# Date 1172073848 0
# Node ID 8ef0ab0b32e2bf875d1e13abe431024ac3112b7e
# Parent  7386caafa735247909a2852a13acf3194580a340
Support for HAL device info collection on different operating systems.
Currently handles Linux (tested) and Solaris (untested at commit; info from
Albert Lee).

diff -r 8ef0ab0b32e2bf875d1e13abe431024ac3112b7e -r 
7386caafa735247909a2852a13acf3194580a340 configure.ac
--- a/configure.ac      Wed Feb 21 16:04:08 2007 +0000
+++ b/configure.ac      Wed Feb 21 15:00:38 2007 +0000
@@ -164,6 +164,7 @@ fi
 fi
 if test "$with_hal" = yes; then
   AC_DEFINE(WITH_HAL, 1, [Define if HAL is present and you want to use it.])
+  GXINE_HAL_DEVICE_INFO
 fi
 
 dnl ---------------------------------------------
diff -r 8ef0ab0b32e2bf875d1e13abe431024ac3112b7e -r 
7386caafa735247909a2852a13acf3194580a340 m4/_gxine.m4
--- a/m4/_gxine.m4      Wed Feb 21 16:04:08 2007 +0000
+++ b/m4/_gxine.m4      Wed Feb 21 15:00:38 2007 +0000
@@ -40,3 +40,33 @@ AC_DEFUN([AC_LD_ASNEEDED],
     AC_MSG_RESULT([$ac_cv_ld_asneeded])
     test x"$ac_cv_ld_asneeded" = xyes || LDFLAGS="$SAVE_LDFLAGS"
     ])
+
+dnl OS-specific HAL device info lookup
+dnl HAL_DEVICE_FILE_PROPERTY = HAL property giving the device pathname
+dnl HAL_DEVICE_FILE_PREFIX   = Prefix for the device file property,
+dnl                            e.g. "/dev/", were "/dev" omitted on Linux
+dnl                            (note the trailing "/"!)
+AC_DEFUN([GXINE_HAL_DEVICE_INFO],
+    [AC_MSG_CHECKING([how to acquire device info via HAL])
+    HAL_DEVICE_FILE_PROPERTY=''
+    HAL_DEVICE_FILE_PREFIX=''
+    case "$build_os" in
+      linux-*)
+       HAL_DEVICE_FILE_PROPERTY=linux.device_file
+       ;;
+      solaris-*)
+       HAL_DEVICE_FILE_PROPERTY=solaris.devfs_path
+       HAL_DEVICE_FILE_PREFIX=/devices/
+       ;;
+    esac
+    AC_MSG_RESULT(["$HAL_DEVICE_FILE_PROPERTY", prefix 
"$HAL_DEVICE_FILE_PREFIX"])
+    if test "$HAL_DEVICE_FILE_PROPERTY" = ''; then
+      AC_MSG_WARN([I don't know how to get HAL path info for $build_os.])
+      AC_MSG_WARN([You won't see some info when viewing/selecting default 
devices.])
+    else
+      AC_DEFINE_UNQUOTED(HAL_DEVICE_FILE_PROPERTY, 
["$HAL_DEVICE_FILE_PROPERTY"], [HAL device pathname property])
+      if test "$HAL_DEVICE_FILE_PREFIX" != ''; then
+        AC_DEFINE_UNQUOTED(HAL_DEVICE_FILE_PREFIX, 
["$HAL_DEVICE_FILE_PREFIX"], [Common prefix for the HAL device pathname 
property])
+      fi
+    fi
+    ])
diff -r 8ef0ab0b32e2bf875d1e13abe431024ac3112b7e -r 
7386caafa735247909a2852a13acf3194580a340 src/preferences.c
--- a/src/preferences.c Wed Feb 21 16:04:08 2007 +0000
+++ b/src/preferences.c Wed Feb 21 15:00:38 2007 +0000
@@ -369,9 +369,17 @@ get_hal_device_info (const char *dev)
     }
   }
 
+#ifdef HAL_DEVICE_FILE_PREFIX
+  char *const buf_unprefixed =
+    strncmp (buf, HAL_DEVICE_FILE_PREFIX, sizeof (HAL_DEVICE_FILE_PREFIX) - 1)
+    ? "" : buf + sizeof (HAL_DEVICE_FILE_PREFIX) - 2;
+#else
+  char *const buf_unprefixed = buf;
+#endif
+
   return get_hal_property (buf, "block.device", "storage.model")
         ? : get_hal_property (buf, "block.device", "info.product")
-        ? : get_hal_property (buf, "linux.device_file", "info.product")
+        ? : get_hal_property (buf_unprefixed, HAL_DEVICE_FILE_PROPERTY, 
"info.product")
         /* FIXME - BSD etc. */
         ;
 }

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog

Reply via email to