[MPlayer-users] [PATCH] /dev/rtc & linux devfs

Mark Szabo mw3 at bsd.hu
Fri Dec 27 15:58:02 CET 2002


Thus spoke Eric Schmeddes <erix at xotix.net> on 2002-12-27 15:08:49:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> I'm not sure this is actually a bug, but devfs seems
> to have the 'rtc' device on '/dev/misc/rtc' by default.
> The mplayer configuration script and mplayer.c only
> check '/dev/rtc', even with the '--enable-linux-devfs'
> configuration option. Personally I patch mplayer.c to fix
> the bug, but I assume you'll want some '/dev/misc/rtc'
> detection patch instead (which I do not have).
> 
> 

hi

ok, i made a patch. it's attached.

--
Mark Szabo
mw3 at bsd.hu

-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.625
diff -u -r1.625 configure
--- configure	23 Dec 2002 00:33:05 -0000	1.625
+++ configure	27 Dec 2002 14:52:55 -0000
@@ -3562,6 +3562,11 @@
     _rtc=no
     cc_check && _rtc=yes
   fi
+  if test "$_linux_devfs" = yes; then
+      _def_rtc_devrtc='#define PATH_DEV_RTC "/dev/misc/rtc"'
+  else
+      _def_rtc_devrtc='#define PATH_DEV_RTC "/dev/rtc"'
+  fi
   echores "$_rtc"
 else
   _rtc=no
@@ -4891,6 +4896,7 @@
 
 /* define this to use RTC (/dev/rtc) for video timers (LINUX only) */
 $_def_rtc
+$_def_rtc_devrtc
 
 /* set up max. outburst. use 65536 for ALSA 0.5, for others 16384 is enough */
 #define MAX_OUTBURST 65536
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.631
diff -u -r1.631 mplayer.c
--- mplayer.c	23 Dec 2002 01:54:58 -0000	1.631
+++ mplayer.c	27 Dec 2002 14:52:55 -0000
@@ -877,9 +877,10 @@
 #ifdef HAVE_RTC
   if(!nortc)
   {
+    static char *rtc = PATH_DEV_RTC;
     // seteuid(0); /* Can't hurt to try to get root here */
-    if ((rtc_fd = open("/dev/rtc", O_RDONLY)) < 0)
-	mp_msg(MSGT_CPLAYER, MSGL_WARN, "Failed to open /dev/rtc: %s (mplayer should be setuid root or /dev/rtc should be readable by the user.)\n", strerror(errno));
+    if ((rtc_fd = open(rtc, O_RDONLY)) < 0)
+	mp_msg(MSGT_CPLAYER, MSGL_WARN, "Failed to open %s: %s (mplayer should be setuid root or %s should be readable by the user.)\n", rtc, strerror(errno), rtc);
      else {
 	unsigned long irqp = 1024; /* 512 seemed OK. 128 is jerky. */
 


More information about the MPlayer-users mailing list