summaryrefslogtreecommitdiff
path: root/lib/op-rfkill.c
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-04-20 17:11:28 -0700
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-04-21 15:01:25 -0700
commitfdf913c4e26d8b25861f95152e3308c38cbbda7a (patch)
tree8b8c3f11b800d029ef9b902526684dae19a4bad7 /lib/op-rfkill.c
parent822eb164a15ae746c5a8c514f581fb47200fe463 (diff)
libwimaxll: introduce 'any' handles to receive callbacks from any device
An 'any' handle is a handle opened with NULL as device name. No commands can be executed with it, but it will emit callbacks for any WiMAX device that would otherwise generate them for a handle opened for it exclusively. When the callback is executed, the handle is temporarily modified to contain the interface index for whom the callback is emitted, which can be recovered with wimaxll_ifidx(). The code modifications are quite minimal, mainly dealing with not allowing command execution and updating the handle's interface index before executing a callback. This code also adds a path in wimaxll_open() to allow opening an interface by interface index, by specifying "#NUMBER" (where NUMBER is the interface index). Errors to in some calls to libnl are better reported now. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'lib/op-rfkill.c')
-rw-r--r--lib/op-rfkill.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/op-rfkill.c b/lib/op-rfkill.c
index 5cdf738..08cf4e5 100644
--- a/lib/op-rfkill.c
+++ b/lib/op-rfkill.c
@@ -95,6 +95,9 @@ int wimaxll_rfkill(struct wimaxll_handle *wmx, enum wimax_rf_state state)
struct nl_msg *msg;
d_fnstart(3, wmx, "(wmx %p state %u)\n", wmx, state);
+ result = -EBADF;
+ if (wmx->ifidx == 0)
+ goto error_not_any;
msg = nlmsg_new();
if (msg == NULL) {
result = errno;
@@ -126,6 +129,7 @@ error_msg_prep:
error_msg_send:
nlmsg_free(msg);
error_msg_alloc:
+error_not_any:
d_fnend(3, wmx, "(wmx %p state %u) = %d\n", wmx, state, result);
return result;
}