# do not edit this file, it will be overwritten on update
-SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc"
SUBSYSTEM=="virtio-ports", KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb"
SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty"
KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"
-SUBSYSTEM=="rtc", ATTR{hctosys}=="1", MODE="0644"
-
SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"
SUBSYSTEM=="input", KERNEL=="mouse*|mice|event*", MODE="0640"
int fd;
DIR *d;
- /* First, we try to make use of the /dev/rtc symlink. If that
- * doesn't exist, we open the first RTC which has hctosys=1
- * set. If we don't find any we just take the first RTC that
- * exists at all. */
-
- fd = open("/dev/rtc", flags);
- if (fd >= 0)
- return fd;
-
+ /*
+ * Some "chaotic platforms" have multiple RTCs and we need to
+ * find the "system RTC", which is in some setups /dev/rtc1.
+ *
+ * First, we try to find the RTC which has hctosys=1 set. If we
+ * don't find any we just take the first RTC that exists at all,
+ * then try to open /dev/rtc0.
+ */
d = opendir("/sys/class/rtc");
if (!d)
goto fallback;