blob: 176bf308974b8b63c14ef743a7c9064b438b9413 [file] [log] [blame]
--- a/device.c
+++ b/device.c
@@ -167,7 +167,9 @@ static int set_device_state(struct devic
dev->orig_settings.flags &= dev->settings.flags;
system_if_apply_settings(dev, &dev->settings, dev->settings.flags);
- if (!dev->external)
+ if (!strcmp("usbnet0", dev->ifname))
+ uloop_timeout_set(&dev->delay_up, 200);
+ else if (!dev->external)
system_if_up(dev);
system_if_apply_settings_after_up(dev, &dev->settings);
@@ -210,6 +212,14 @@ simple_device_set_state(struct device *d
return set_device_state(dev, state);
}
+static void
+simple_device_delay_up_cb(struct uloop_timeout *timeout)
+{
+ struct device *dev = container_of(timeout, struct device, delay_up);
+
+ system_if_up(dev);
+}
+
static struct device *
simple_device_create(const char *name, struct device_type *devtype,
struct blob_attr *attr)
@@ -235,6 +245,8 @@ static void simple_device_free(struct de
{
if (dev->parent.dev)
device_remove_user(&dev->parent);
+
+ uloop_timeout_cancel(&dev->delay_up);
free(dev);
}
@@ -854,6 +866,7 @@ device_create_default(const char *name,
}
dev->default_config = true;
+ dev->delay_up.cb = simple_device_delay_up_cb;
device_check_state(dev);
return dev;
--- a/device.h
+++ b/device.h
@@ -294,6 +294,7 @@ struct device {
struct device_settings orig_settings;
struct device_settings settings;
+ struct uloop_timeout delay_up;
};
struct device_hotplug_ops {