From: "João Paulo Rechi Vita" <jprvita@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>,
"Darren Hart" <dvhart@infradead.org>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
platform-driver-x86@vger.kernel.org, linux-api@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@endlessm.com,
"João Paulo Rechi Vita" <jprvita@endlessm.com>,
"João Paulo Rechi Vita" <jprvita@gmail.com>
Subject: [RESEND PATCH 3/3] rfkill: Notify userspace of airplane-mode state changes
Date: Mon, 2 May 2016 10:39:08 -0400 [thread overview]
Message-ID: <1462199948-6424-4-git-send-email-jprvita@endlessm.com> (raw)
In-Reply-To: <1462199948-6424-1-git-send-email-jprvita@endlessm.com>
From: João Paulo Rechi Vita <jprvita@gmail.com>
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
Documentation/rfkill.txt | 3 +++
include/uapi/linux/rfkill.h | 4 ++--
net/rfkill/core.c | 13 +++++++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt
index 9dbe3fc..588b4bf 100644
--- a/Documentation/rfkill.txt
+++ b/Documentation/rfkill.txt
@@ -133,5 +133,8 @@ applications to take control. Changes to the airplane-mode indicator state can
be made using RFKILL_OP_AIRPLANE_MODE_INDICATOR_CHANGE, passing the new value
in the 'soft' field of 'struct rfkill_event'.
+This same API is also used to provide userspace with notifications of changes
+to airplane-mode indicator state.
+
For further details consult Documentation/ABI/stable/sysfs-class-rfkill.
diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h
index 36e0770..2ccb02f 100644
--- a/include/uapi/linux/rfkill.h
+++ b/include/uapi/linux/rfkill.h
@@ -63,8 +63,8 @@ enum rfkill_type {
* are hot-plugged later.
* @RFKILL_OP_AIRPLANE_MODE_INDICATOR_ACQUIRE: userspace acquires control of
* the airplane-mode indicator.
- * @RFKILL_OP_AIRPLANE_MODE_INDICATOR_CHANGE: userspace changes the
- * airplane-mode indicator state.
+ * @RFKILL_OP_AIRPLANE_MODE_INDICATOR_CHANGE: the airplane-mode indicator state
+ * changed -- userspace changes the airplane-mode indicator state.
*/
enum rfkill_operation {
RFKILL_OP_ADD = 0,
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index 95824b3..c4bbd19 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -131,7 +131,20 @@ static struct led_trigger rfkill_apm_led_trigger;
static void rfkill_apm_led_trigger_event(bool state)
{
+ struct rfkill_data *data;
+ struct rfkill_int_event *ev;
+
led_trigger_event(&rfkill_apm_led_trigger, state ? LED_FULL : LED_OFF);
+
+ list_for_each_entry(data, &rfkill_fds, list) {
+ ev = kzalloc(sizeof(*ev), GFP_KERNEL);
+ if (!ev)
+ continue;
+ ev->ev.op = RFKILL_OP_AIRPLANE_MODE_INDICATOR_CHANGE;
+ ev->ev.soft = state;
+ list_add_tail(&ev->list, &data->events);
+ wake_up_interruptible(&data->read_wait);
+ }
}
static void rfkill_apm_led_trigger_activate(struct led_classdev *led)
--
2.5.0
prev parent reply other threads:[~2016-05-02 14:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 14:39 [RESEND PATCH 0/3] RFKill airplane-mode indicator João Paulo Rechi Vita
2016-05-02 14:39 ` [RESEND PATCH 1/3] rfkill: Create "rfkill-airplane-mode" LED trigger João Paulo Rechi Vita
2016-05-04 7:29 ` Pavel Machek
2016-05-12 9:32 ` Johannes Berg
2016-05-19 7:16 ` Pavel Machek
2016-06-09 12:43 ` Johannes Berg
2016-06-13 15:24 ` João Paulo Rechi Vita
2016-06-13 19:00 ` Pavel Machek
2016-06-13 19:59 ` João Paulo Rechi Vita
2016-06-13 21:01 ` Pavel Machek
2016-06-13 21:10 ` João Paulo Rechi Vita
2016-06-13 21:21 ` Pavel Machek
2016-06-21 9:35 ` Johannes Berg
2016-05-02 14:39 ` [RESEND PATCH 2/3] rfkill: Userspace control for airplane mode João Paulo Rechi Vita
2016-05-02 14:39 ` João Paulo Rechi Vita [this message]
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=1462199948-6424-4-git-send-email-jprvita@endlessm.com \
--to=jprvita@gmail.com \
--cc=davem@davemloft.net \
--cc=dvhart@infradead.org \
--cc=johannes@sipsolutions.net \
--cc=jprvita@endlessm.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@endlessm.com \
--cc=netdev@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).