From: Arvid Brodin <arvid.brodin@enea.com>
To: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org, Juergen Beisert <jbe@pengutronix.de>
Subject: A standardized way of reporting kernel events to userspace
Date: Sat, 28 May 2011 01:04:49 +0200 [thread overview]
Message-ID: <4DE02E11.5060007@enea.com> (raw)
Hi,
After I asked on linux-usb for a way for userspace to catch over-current events
on the usb bus, it turned out that Juergen Beisert had had the need to do the
exact same thing some time ago. He posted this patch using a uevent to notify
userspace:
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
drivers/usb/core/hub.c | 4 ++++
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 84c18971..c615292 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3372,9 +3372,13 @@ static void hub_events(void)
}
if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
+ char event[] = "POWERFAIL=1";
+ char *envp[] = { event, NULL };
+
dev_err (hub_dev,
"over-current change on port %d\n",
i);
+ kobject_uevent_env(&hub->intfdev->kobj, KOBJ_CHANGE, envp);
clear_port_feature(hdev, i,
USB_PORT_FEAT_C_OVER_CURRENT);
hub_power_on(hub, true);
Alan Stern noted that having a standardized, accepted way for the kernel to
report important hardware or software events to userspace could be useful, and
suggested we start a discussion about this here on lkml. He noted some
things to consider:
The type of event (hardware failure, data structure corruption,
imminent data loss, imminent hardware destruction...).
Whether or not the user can do anything to fix the problem.
Whatever else you can think of.
So, please feel free to comment on this, and perhaps with time some kind of
consensus can be reached on how to report issues like this to userspace.
(My initial email to linux-usb: http://www.spinics.net/lists/linux-usb/msg47088.html)
--
Arvid Brodin
Enea Services Stockholm AB
next reply other threads:[~2011-05-27 23:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-27 23:04 Arvid Brodin [this message]
2011-05-28 0:26 ` A standardized way of reporting kernel events to userspace Greg KH
2011-05-30 7:56 ` Oliver Neukum
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=4DE02E11.5060007@enea.com \
--to=arvid.brodin@enea.com \
--cc=jbe@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@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