Skip to contentSkip to conversation

RTC Inappropriate ioctl for device

DISCUSSION Aurélien GÉRÔME 2 participants 5 messages Feb 13, 2005 – Feb 15, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

Having CONFIG_RTC=y, I tried on x86 the rtctest program found in linux-2.6.10/Documentation/rtc.txt. However, it failed at:

ioctl(fd, RTC_UIE_ON, 0);

with:

ioctl: Inappropriate ioctl for device

Did I miss something? Maybe something else conflicts with CONFIG_RTC?

Cheers.

#1 lore raw
Quoted 7 lines · Aurélien GÉRÔME

Hi,

Having CONFIG_RTC=y, I tried on x86 the rtctest program found in linux-2.6.10/Documentation/rtc.txt. However, it failed at:

ioctl(fd, RTC_UIE_ON, 0);

Quoted 7 lines

with:

ioctl: Inappropriate ioctl for device

Did I miss something? Maybe something else conflicts with CONFIG_RTC?

Cheers.

Do you have an HPET timer enabled? That could cause a conflict.

Does /proc/interrupts report rtc interrupts increasing when you run rtctest?
I.e., does the number of this line increase like this?

8: 131 IO-APIC-edge rtc

rtctest works for me (2.6.11-rc4). Maybe send me the strace output when you run rtctest and your .config file. Oh, and your kernel boot log, maybe there are some rtc driver messages in it.

Signature · 1 line
~Randy
#2 lore raw
Quoted 10 lines · Randy.Dunlap
Quoted 9 lines · Aurélien GÉRÔME

Hi,

Having CONFIG_RTC=y, I tried on x86 the rtctest program found in linux-2.6.10/Documentation/rtc.txt. However, it failed at:

ioctl(fd, RTC_UIE_ON, 0);

with:

Quoted 7 lines
Quoted 5 lines

ioctl: Inappropriate ioctl for device

Did I miss something? Maybe something else conflicts with CONFIG_RTC?

Cheers.

Do you have an HPET timer enabled? That could cause a conflict.

I have HPET timer enabled.

Quoted 5 lines

Does /proc/interrupts report rtc interrupts increasing when you run rtctest?
I.e., does the number of this line increase like this?

8: 131 IO-APIC-edge rtc

I have no lines with rtc at the end, maybe due to HPET.

Is it a known behaviour of RTC with HPET?

Quoted 2 lines

rtctest works for me (2.6.11-rc4). Maybe send me the strace output when you run rtctest and your .config file.

See attachment for strace and .config.

Quoted 2 lines

Oh, and your kernel boot log, maybe there are some rtc driver messages in it.

See attachment for kern.log.

I have bzip2'ed kern.log and .config, since they were rather large.

Cheers.

execve("./rtctest", ["./rtctest"], [/* 15 vars */]) = 0
uname({sys="Linux", node="caladan", ...}) = 0
brk(0) = 0x804b000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe9000

access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=41661, ...}) = 0
old_mmap(NULL, 41661, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fde000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360Y\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1253924, ...}) = 0
old_mmap(NULL, 1260140, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xb7eaa000
old_mmap(0xb7fd3000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x129000) = 0xb7fd3000
old_mmap(0xb7fdb000, 10860, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fdb000

close(3) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ea9000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7ea9460, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0xb7fde000, 41661) = 0
open("/dev/rtc", O_RDONLY) = 3
write(2, "\n\t\t\tRTC Driver Test Example.\n\n", 30
RTC Driver Test Example.

) = 30
ioctl(3, RTC_UIE_ON, 0) = -1 ENOTTY (Inappropriate ioctl for device)
write(2, "ioctl: Inappropriate ioctl for d"..., 38ioctl: Inappropriate ioctl for device ) = 38
exit_group(25) = ?

#3 lore raw
Quoted 15 lines · Aurélien GÉRÔME
Quoted 13 lines · Randy.Dunlap
Quoted 11 lines · Aurélien GÉRÔME

Hi,

Having CONFIG_RTC=y, I tried on x86 the rtctest program found in linux-2.6.10/Documentation/rtc.txt. However, it failed at:

ioctl(fd, RTC_UIE_ON, 0);

with:

ioctl: Inappropriate ioctl for device

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Did I miss something? Maybe something else conflicts with CONFIG_RTC?

Cheers.

Do you have an HPET timer enabled? That could cause a conflict.

I have HPET timer enabled.

Please add/enable the second line here:
CONFIG_HPET_TIMER=y
# CONFIG_HPET_EMULATE_RTC is not set

and try it again.

Quoted 10 lines
Quoted 5 lines

Does /proc/interrupts report rtc interrupts increasing when you run rtctest?
I.e., does the number of this line increase like this?

8: 131 IO-APIC-edge rtc

I have no lines with rtc at the end, maybe due to HPET.

Is it a known behaviour of RTC with HPET?

Apparently that's why a config option was added for it.

Quoted 14 lines
Quoted 2 lines

rtctest works for me (2.6.11-rc4). Maybe send me the strace output when you run rtctest and your .config file.

See attachment for strace and .config.

Quoted 2 lines

Oh, and your kernel boot log, maybe there are some rtc driver messages in it.

See attachment for kern.log.

I have bzip2'ed kern.log and .config, since they were rather large.

Signature · 1 line
~Randy
#4 lore raw
Quoted 5 lines · Randy.Dunlap

Please add/enable the second line here:
CONFIG_HPET_TIMER=y
# CONFIG_HPET_EMULATE_RTC is not set

and try it again.

It works now. Well, I had not seen "Provide RTC interrupt" in menuconfig... :)

Thanks for the tip.

Cheers.