LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-14-2011, 04:47 AM   #1
cruiser
LQ Newbie
 
Registered: Apr 2011
Distribution: Ubuntu, RedHat, Fedora, Customised Linux Kernels
Posts: 23

Rep: Reputation: 1
Arrow Error no 25: Inappropriate ioctl for device for RTC


Hi,

I am carrying out some RTC related tests on the MontaVista Kernel (2.6.32). I receive the following errors.

Code:
        int fd;
	unsigned long data;
   	int ret;
	struct rtc_time rtc_tm;
int main()
{
 fd = open("/dev/rtc", O_RDONLY,0);
        if (fd == -1)
        {
                printf("/dev/rtc open error\n");
                exit(1);
        }
        else printf("open success fd = %d \n",fd);

ret = ioctl(fd, RTC_UIE_ON, 0);
        if (ret == -1)
        {
                printf("Error number = %d\n", errno);
                perror("Error" );
        }

ret = read(fd, &data, sizeof(unsigned long));
                if (ret == -1)
                {
                  printf("Error number = %d\n", errno);
                  perror("Error" );
                }
                else
                  printf("RTC read %d\r\n", i);

close(fd);
return 0;
}

Output:
open success fd = 3

Error number = 25
Error: Inappropriate ioctl for device

Error number = 5
Error: Input/output error
Any suggestion?

Regards,cruiser
 
Old 10-16-2011, 11:13 PM   #2
cruiser
LQ Newbie
 
Registered: Apr 2011
Distribution: Ubuntu, RedHat, Fedora, Customised Linux Kernels
Posts: 23

Original Poster
Rep: Reputation: 1
The problem was that the function within which the RTC_UIE_ON condition was defined was disabled due to a #ifdef condition. Hence owing to this we were receiving the Error 25, ENOTTY as those functions were disabled. After enabling the right flags we were able to enable the required functions. This solved the problem.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird Perl error with "Inappropriate ioctl for device" bnutting Programming 9 03-12-2012 07:25 AM
Inappropriate ioctl for device while reading flags w1k0 Slackware 3 06-01-2009 07:45 PM
Inappropriate ioctl for device with perl Punakuono Linux - Newbie 3 05-15-2009 02:05 AM
inappropriate ioctl for device praetorrian Linux - Software 1 05-09-2006 12:11 AM
Inappropriate ioctl for device(25) why1957 Linux - Networking 0 08-03-2003 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration