From patchwork Thu Nov 23 18:39:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 840875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yjT9N3LRjz9s71 for ; Fri, 24 Nov 2017 05:57:59 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 49CBD87D5C; Thu, 23 Nov 2017 18:57:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7AXL8OWEk1-7; Thu, 23 Nov 2017 18:57:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E04B587CE0; Thu, 23 Nov 2017 18:57:49 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 801621C0C51 for ; Thu, 23 Nov 2017 18:39:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7A08888BCD for ; Thu, 23 Nov 2017 18:39:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZCjUVMd65ADR for ; Thu, 23 Nov 2017 18:39:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by whitealder.osuosl.org (Postfix) with ESMTPS id D722988BC9 for ; Thu, 23 Nov 2017 18:39:47 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Nov 2017 10:39:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,441,1505804400"; d="scan'208";a="5089561" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 23 Nov 2017 10:39:45 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8CC39A6; Thu, 23 Nov 2017 20:39:14 +0200 (EET) From: Andy Shevchenko To: Adam Duskett , buildroot@buildroot.org, thomas.petazzoni@free-electrons.com Date: Thu, 23 Nov 2017 21:39:14 +0300 Message-Id: <20171123183914.71769-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.15.0 Subject: [Buildroot] [PATCH v1] busybox: Fix rtcwake to use /dev/rtc0 properly X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andy Shevchenko MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 --- ...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 +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 +--- + 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 +