adapter: Do not send a poll command when adapter is down
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 11 Oct 2013 15:40:51 +0000 (17:40 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 11 Oct 2013 15:40:51 +0000 (17:40 +0200)
No need to go through the kernel netlink NFC API if the adapter is known
to be down.

src/adapter.c

index 0b85ef5..e91fc30 100644 (file)
@@ -444,6 +444,11 @@ static DBusMessage *start_poll_loop(DBusConnection *conn,
 
        DBG("conn %p", conn);
 
+       if (!adapter->powered) {
+               near_error("Adapter is down, can not start polling");
+               return __near_error_failed(msg, ENODEV);
+       }
+
        dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &dbus_mode,
                                                        DBUS_TYPE_INVALID);