Am 23.04.2013 01:38, schrieb Andrew Morton:On Fri, 19 Apr 2013 17:14:12 +0200 Alexander Holler
<holler@xxxxxxxxxxxxx> wrote:
drivers/rtc/hctosys (CONFIG_RTC_HCTOSYS) doesn't work for
rtc-hid-sensor-time because it will be called in late_init, and thus
before
rtc-hid-sensor-time gets loaded.
Isn't that true of all RTC drivers which are built as modules? There's
nothing special about hid-sensor-time here?
I assume the standard answer here is "your RTC driver should be built
into vmlinux". If we wish to make things work for modular RTC drivers
then we should find a solution which addresses *all* RTC drivers?
No. I having rtc-hid-sensor-time, hid-sensor-hub (and USB) statically
linked in doesn't help. Here is what happens here with such an
configuration:
--
[ 7.638970] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 7.645639] Waiting 180sec before mounting root device...
[ 16.598759] HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: rtc core:
registered hid-sensor-time as rtc0
[ 16.608712] HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: hctosys: setting
system clock to 2013-04-19 16:45:06 UTC (1366389906)
--
I havent't looked in detail at why rtc-hid-sensor-time gets loaded that
late, but I assume it's because the USB stack (and/or the device or the
communication inbetween) needs some time (and I assume that's why
rootwait and rootdelay got invented too).
To set the time through rtc-hid-sensor-time
at startup, the module now checks by default if the system time is
before
1970-01-02 and sets the system time (once) if this is the case.
To disable this behaviour, set the module option hctosys to zero,
e.g. by
using rtc-hid-sensor-time.hctosys=0 at the kernel command line if the
driver is statically linked into the kernel.
Is a bit hacky, no?
I didn't have any other idea to prevent an USB (or any other
hot-pluggable HID) device to change the time while still beeing able (by
default) to set the time by such an device at boot. But I'm open to
suggestions. (E.g. one of the scenarios I want to prevent is, that a
computer gets it's time by NTP and someone is able to change the time
later on by simply plugging in some HID device.)