| author | Kay Sievers <kay.sievers@vrfy.org> | 2007-08-31 01:20:57 (GMT) |
|---|---|---|
| committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-08-31 01:20:57 (GMT) |
| commit | f3e160d0ab85f62b76400cb521b4d1b5813d0711 (patch) | |
| tree | f4c75b2982b4b355813156946cf15633b7c19692 | |
| parent | a871c7d40e13eb247bce34aae7a9ceafaf719b10 (diff) | |
| download | hal-f3e160d0ab85f62b76400cb521b4d1b5813d0711.zip hal-f3e160d0ab85f62b76400cb521b4d1b5813d0711.tar.gz hal-f3e160d0ab85f62b76400cb521b4d1b5813d0711.tar.bz2 | |
hotplug: handle "change" events for unknown devices as "add"
If we see a "change" event for a device we do not already know, we use
the event to add the device. For already known devices, we call refresh().
| -rw-r--r-- | hald/linux/hotplug.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/hald/linux/hotplug.c b/hald/linux/hotplug.c index eb73f7e..38e416c 100644 --- a/hald/linux/hotplug.c +++ b/hald/linux/hotplug.c @@ -153,7 +153,8 @@ hotplug_event_begin_sysfs (HotplugEvent *hotplug_event) } if (hotplug_event->type == HOTPLUG_EVENT_SYSFS_DEVICE) { - if (hotplug_event->action == HOTPLUG_ACTION_ADD) { + if (hotplug_event->action == HOTPLUG_ACTION_ADD || + (d == NULL && hotplug_event->action == HOTPLUG_ACTION_CHANGE)) { HalDevice *parent; gchar *parent_path; @@ -175,9 +176,12 @@ hotplug_event_begin_sysfs (HotplugEvent *hotplug_event) hotplug_event->sysfs.sysfs_path, d, (void *) hotplug_event); + } else { + hotplug_event_end ((void *) hotplug_event); } } else if (hotplug_event->type == HOTPLUG_EVENT_SYSFS_BLOCK) { - if (hotplug_event->action == HOTPLUG_ACTION_ADD) { + if (hotplug_event->action == HOTPLUG_ACTION_ADD || + (d == NULL && hotplug_event->action == HOTPLUG_ACTION_CHANGE)) { HalDevice *parent; int range; gboolean is_partition; @@ -210,6 +214,8 @@ hotplug_event_begin_sysfs (HotplugEvent *hotplug_event) hotplug_event_refresh_blockdev (hotplug_event->sysfs.sysfs_path, d, (void *) hotplug_event); + } else { + hotplug_event_end ((void *) hotplug_event); } } else { /* just ignore this hotplug event */ |
