device: Set blocked field depending on the technology status
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 8 Oct 2010 15:23:38 +0000 (17:23 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 8 Oct 2010 15:25:07 +0000 (17:25 +0200)
If a device is created before any rfkill event is received, it will not
be blocked. Otherwise, it will mirror the technology blocked status.

src/device.c

index f6fc15e..373eb5f 100644 (file)
@@ -205,7 +205,7 @@ int __connman_device_enable(struct connman_device *device)
 {
        int err;
 
-       DBG("device %p", device);
+       DBG("device %p %d", device, device->blocked);
 
        if (!device->driver || !device->driver->enable)
                return -EOPNOTSUPP;
@@ -742,6 +742,7 @@ struct connman_device *connman_device_create(const char *node,
 {
        struct connman_device *device;
        const char *str;
+       enum connman_service_type service_type;
 
        DBG("node %s type %d", node, type);
 
@@ -774,6 +775,9 @@ struct connman_device *connman_device_create(const char *node,
 
        device->phyindex = -1;
 
+       service_type = __connman_device_get_service_type(device);
+       device->blocked = __connman_technology_get_blocked(service_type);
+
        switch (type) {
        case CONNMAN_DEVICE_TYPE_UNKNOWN:
        case CONNMAN_DEVICE_TYPE_VENDOR: