* A standardized way of reporting kernel events to userspace
@ 2011-05-27 23:04 Arvid Brodin
2011-05-28 0:26 ` Greg KH
2011-05-30 7:56 ` Oliver Neukum
0 siblings, 2 replies; 3+ messages in thread
From: Arvid Brodin @ 2011-05-27 23:04 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-usb, Juergen Beisert
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: A standardized way of reporting kernel events to userspace
2011-05-27 23:04 A standardized way of reporting kernel events to userspace Arvid Brodin
@ 2011-05-28 0:26 ` Greg KH
2011-05-30 7:56 ` Oliver Neukum
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2011-05-28 0:26 UTC (permalink / raw)
To: Arvid Brodin; +Cc: linux-kernel, linux-usb, Juergen Beisert
On Sat, May 28, 2011 at 01:04:49AM +0200, Arvid Brodin wrote:
> 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:
We've discussed why using uevents for this is not a good idea in the
past, and I don't think anything has changed since then. You might want
to search the archives for details if you are curious.
As to other solutions, there's always netlink, and people have proposed,
seriously, to put dbus in the kernel to allow it to emit messages that
way. I don't object to that, and I think there was even some patches
floating around to do that as well. You might want to revive them and
see if that would fit your requirement here.
hope this helps,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: A standardized way of reporting kernel events to userspace
2011-05-27 23:04 A standardized way of reporting kernel events to userspace Arvid Brodin
2011-05-28 0:26 ` Greg KH
@ 2011-05-30 7:56 ` Oliver Neukum
1 sibling, 0 replies; 3+ messages in thread
From: Oliver Neukum @ 2011-05-30 7:56 UTC (permalink / raw)
To: Arvid Brodin, Alan Stern; +Cc: linux-kernel, linux-usb, Juergen Beisert
Am Samstag, 28. Mai 2011, 01:04:49 schrieb Arvid Brodin:
> 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:
Still, I am not convinced you want to divorce reporting a problem and reacting
to it. The possible countermeasures, like reenabling a port, port reset,
cutting power or using another configuration are specific to a port or device.
Regards
Oliver
--
- - -
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5
90409 Nürnberg
Germany
- - -
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-30 7:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-27 23:04 A standardized way of reporting kernel events to userspace Arvid Brodin
2011-05-28 0:26 ` Greg KH
2011-05-30 7:56 ` Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox