Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v1] busybox: Fix rtcwake to use /dev/rtc0 properly
Date: Thu, 23 Nov 2017 21:39:14 +0300	[thread overview]
Message-ID: <20171123183914.71769-1-andriy.shevchenko@linux.intel.com> (raw)

rtcwake from busybox has failed in case the /dev/rtc is a symlink
(which is default case for udev enabled systems) due to wrong pathname
used for a sysfs wakeup attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 ...bb-Try-dev-rtc0-first-followed-by-dev-rtc.patch | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/busybox/0006-libbb-Try-dev-rtc0-first-followed-by-dev-rtc.patch

diff --git a/package/busybox/0006-libbb-Try-dev-rtc0-first-followed-by-dev-rtc.patch b/package/busybox/0006-libbb-Try-dev-rtc0-first-followed-by-dev-rtc.patch
new file mode 100644
index 0000000000..0702c3c065
--- /dev/null
+++ b/package/busybox/0006-libbb-Try-dev-rtc0-first-followed-by-dev-rtc.patch
@@ -0,0 +1,45 @@
+From b59088ab14fb9c336414e2c9b27a9f5b7447ce5b Mon Sep 17 00:00:00 2001
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Date: Thu, 23 Nov 2017 19:33:08 +0200
+Subject: [PATCH v1] libbb: Try /dev/rtc0 first followed by /dev/rtc
+
+In case we run
+
+% rtcwake -s5 -mmem
+
+in udev environment we will get an error:
+
+rtcwake: /dev/rtc not enabled for wakeup events
+
+because /dev/rtc is a symlink to /dev/rtc0 in Buildroot and other Linux
+distributions (like Fedora) and make_wakeup() obviously fails.
+
+As a quick fix just reorder probe of device nodes to try /dev/rtc0
+first.
+
+The proper solution, of course much expensive by code footprint,
+is to resolve /dev/rtc to a proper device node and then
+to follow sysfs attributes.
+
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+---
+ libbb/rtc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libbb/rtc.c b/libbb/rtc.c
+index c4117ba34..e087a8fd6 100644
+--- a/libbb/rtc.c
++++ b/libbb/rtc.c
+@@ -64,8 +64,8 @@ int FAST_FUNC rtc_xopen(const char **default_rtc, int flags)
+ {
+ 	int rtc;
+ 	const char *name =
+-		"/dev/rtc""\0"
+ 		"/dev/rtc0""\0"
++		"/dev/rtc""\0"
+ 		"/dev/misc/rtc""\0";
+ 
+ 	if (!*default_rtc)
+-- 
+2.15.0
+
-- 
2.15.0

             reply	other threads:[~2017-11-23 18:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 18:39 Andy Shevchenko [this message]
2017-11-23 22:46 ` [Buildroot] [PATCH v1] busybox: Fix rtcwake to use /dev/rtc0 properly Arnout Vandecappelle
2017-11-24 13:27   ` Andy Shevchenko
2017-11-25 17:40     ` Arnout Vandecappelle
2017-11-27 11:20       ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171123183914.71769-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox