summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-23 22:05:09 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-23 22:05:09 +0000
commit5edfd74c9883d821a7b47c7d31e3e6f547323313 (patch)
treec25c4788fad6a3d179a88daf24d77369c18dd619 /mplayer.c
parent8ee6205828e630cb688d4344c2991489af26019e (diff)
downloadmpv-5edfd74c9883d821a7b47c7d31e3e6f547323313.tar.bz2
mpv-5edfd74c9883d821a7b47c7d31e3e6f547323313.tar.xz
RTC fixes by Sidik Isani <lksi@cfht.hawaii.edu>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7495 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/mplayer.c b/mplayer.c
index aff9f6bcff..53b079bfe1 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -684,15 +684,16 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
#ifdef HAVE_RTC
if(!nortc)
{
+ // 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_ERR, "Linux RTC init error: %s\n", strerror(errno));
- else {
- unsigned long irqp;
-
- /* if (ioctl(rtc_fd, RTC_IRQP_SET, _) < 0) { */
- if (ioctl(rtc_fd, RTC_IRQP_READ, &irqp) < 0) {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC init error in ioctl (rtc_irqp_read): %s\n", strerror(errno));
- close (rtc_fd);
+ 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));
+ else {
+ unsigned long irqp = 1024; /* 512 seemed OK. 128 is jerky. */
+
+ if (ioctl(rtc_fd, RTC_IRQP_SET, irqp) < 0) {
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n", irqp, strerror(errno));
+ mp_msg(MSGT_CPLAYER, MSGL_HINT, "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n", irqp);
+ close (rtc_fd);
rtc_fd = -1;
} else if (ioctl(rtc_fd, RTC_PIE_ON, 0) < 0) {
/* variable only by the root */
@@ -1688,7 +1689,7 @@ if(time_frame>0.001 && !(vo_flags&256)){
// -------- RTC -----------
current_module="sleep_rtc";
while (time_frame > 0.000) {
- unsigned long long rtc_ts;
+ unsigned long rtc_ts;
if (read (rtc_fd, &rtc_ts, sizeof(rtc_ts)) <= 0)
mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC read error: %s\n", strerror(errno));
time_frame-=GetRelativeTime();