Mercurial > mplayer.hg
comparison mplayer.c @ 7494:229287c14cd4
RTC fixes by Sidik Isani <lksi@cfht.hawaii.edu>
author | arpi |
---|---|
date | Mon, 23 Sep 2002 22:05:09 +0000 |
parents | 8dcbed9ff5db |
children | 12b2c735ad07 |
comparison
equal
deleted
inserted
replaced
7493:bd423c9c835a | 7494:229287c14cd4 |
---|---|
682 vo_init_osd(); | 682 vo_init_osd(); |
683 | 683 |
684 #ifdef HAVE_RTC | 684 #ifdef HAVE_RTC |
685 if(!nortc) | 685 if(!nortc) |
686 { | 686 { |
687 // seteuid(0); /* Can't hurt to try to get root here */ | |
687 if ((rtc_fd = open("/dev/rtc", O_RDONLY)) < 0) | 688 if ((rtc_fd = open("/dev/rtc", O_RDONLY)) < 0) |
688 mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC init error: %s\n", strerror(errno)); | 689 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)); |
689 else { | 690 else { |
690 unsigned long irqp; | 691 unsigned long irqp = 1024; /* 512 seemed OK. 128 is jerky. */ |
691 | 692 |
692 /* if (ioctl(rtc_fd, RTC_IRQP_SET, _) < 0) { */ | 693 if (ioctl(rtc_fd, RTC_IRQP_SET, irqp) < 0) { |
693 if (ioctl(rtc_fd, RTC_IRQP_READ, &irqp) < 0) { | 694 mp_msg(MSGT_CPLAYER, MSGL_WARN, "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n", irqp, strerror(errno)); |
694 mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC init error in ioctl (rtc_irqp_read): %s\n", strerror(errno)); | 695 mp_msg(MSGT_CPLAYER, MSGL_HINT, "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n", irqp); |
695 close (rtc_fd); | 696 close (rtc_fd); |
696 rtc_fd = -1; | 697 rtc_fd = -1; |
697 } else if (ioctl(rtc_fd, RTC_PIE_ON, 0) < 0) { | 698 } else if (ioctl(rtc_fd, RTC_PIE_ON, 0) < 0) { |
698 /* variable only by the root */ | 699 /* variable only by the root */ |
699 mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC init error in ioctl (rtc_pie_on): %s\n", strerror(errno)); | 700 mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC init error in ioctl (rtc_pie_on): %s\n", strerror(errno)); |
700 close (rtc_fd); | 701 close (rtc_fd); |
1686 #ifdef HAVE_RTC | 1687 #ifdef HAVE_RTC |
1687 if(rtc_fd>=0){ | 1688 if(rtc_fd>=0){ |
1688 // -------- RTC ----------- | 1689 // -------- RTC ----------- |
1689 current_module="sleep_rtc"; | 1690 current_module="sleep_rtc"; |
1690 while (time_frame > 0.000) { | 1691 while (time_frame > 0.000) { |
1691 unsigned long long rtc_ts; | 1692 unsigned long rtc_ts; |
1692 if (read (rtc_fd, &rtc_ts, sizeof(rtc_ts)) <= 0) | 1693 if (read (rtc_fd, &rtc_ts, sizeof(rtc_ts)) <= 0) |
1693 mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC read error: %s\n", strerror(errno)); | 1694 mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC read error: %s\n", strerror(errno)); |
1694 time_frame-=GetRelativeTime(); | 1695 time_frame-=GetRelativeTime(); |
1695 } | 1696 } |
1696 } else | 1697 } else |