diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-12-15 11:08:51 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-12-15 11:08:51 +0000 |
commit | f696626acb802b7ff1055f1dd41a6800a1a84c4a (patch) | |
tree | 79be6efc6f14b431ad6bbfca8f3ad87aa7354445 | |
parent | 50e6a2d16257955ea01b05015753918c66800fcb (diff) | |
download | mandi-f696626acb802b7ff1055f1dd41a6800a1a84c4a.tar mandi-f696626acb802b7ff1055f1dd41a6800a1a84c4a.tar.gz mandi-f696626acb802b7ff1055f1dd41a6800a1a84c4a.tar.bz2 mandi-f696626acb802b7ff1055f1dd41a6800a1a84c4a.tar.xz mandi-f696626acb802b7ff1055f1dd41a6800a1a84c4a.zip |
pass interface name to events
-rw-r--r-- | src/plugins/wireless/plugin.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/wireless/plugin.c b/src/plugins/wireless/plugin.c index 2dac3c4..5549060 100644 --- a/src/plugins/wireless/plugin.c +++ b/src/plugins/wireless/plugin.c @@ -20,6 +20,7 @@ static DBusHandlerResult wpa_supplicant_request(DBusConnection *connection, DBus typedef struct { struct wpa_ctrl *ctrl_conn; + const char *interface; } w_plugin_t; static int init(plugin_t *plugin, DBusConnection *connection) { @@ -50,7 +51,7 @@ static int init(plugin_t *plugin, DBusConnection *connection) { return -1; snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, dent->d_name); w_plugin->ctrl_conn = wpa_ctrl_open(cfile); - w_plugin->ctrl_conn = wpa_ctrl_open(cfile); + w_plugin->interface = strdup(dent->d_name); free(cfile); break; } @@ -73,7 +74,8 @@ static void deinit(plugin_t *plugin, DBusConnection *connection) { close(plugin->fd); } -static void notify_event(DBusConnection *bus, char *event) { +static void notify_event(DBusConnection *bus, plugin_t *plugin, char *event) { + w_plugin_t *w_plugin = (w_plugin_t *) plugin->priv; DBusMessage *message; message = dbus_message_new_signal(WIRELESS_PATH, WIRELESS_INTERFACE, @@ -82,6 +84,8 @@ static void notify_event(DBusConnection *bus, char *event) { dbus_message_append_args(message, DBUS_TYPE_STRING, &event, + DBUS_TYPE_STRING, + &w_plugin->interface, DBUS_TYPE_INVALID); dbus_connection_send(bus, message, NULL); dbus_connection_flush(bus); @@ -94,8 +98,8 @@ static void handle_incoming(plugin_t *plugin, DBusConnection *connection) { size_t len = sizeof(buf); wpa_ctrl_recv(w_plugin->ctrl_conn, buf, &len); buf[len] = '\0'; - printf("received event: %s\n", buf); - notify_event(connection, buf); + printf("received event for %s: %s\n", w_plugin->interface, buf); + notify_event(connection, plugin, buf); } static DBusHandlerResult handle_message(DBusConnection *connection, DBusMessage *message, plugin_t *plugin) { |