]> err.no Git - linux-2.6/blobdiff - net/ieee80211/softmac/ieee80211softmac_event.c
Pull trivial1 into release branch
[linux-2.6] / net / ieee80211 / softmac / ieee80211softmac_event.c
index 0d0a8327252f84c1a9bb990562126bf3611302bb..8cc8f3f0f8e73d3809556a6cb30c3c8cf588c111 100644 (file)
@@ -1,9 +1,33 @@
-#include "ieee80211softmac_priv.h"
-
 /*
  * Event system
- * Also see comments in public header file
+ * Also see comments in public header file and longer explanation below.
+ *
+ * Copyright (c) 2005, 2006 Johannes Berg <johannes@sipsolutions.net>
+ *                          Joseph Jezak <josejx@gentoo.org>
+ *                          Larry Finger <Larry.Finger@lwfinger.net>
+ *                          Danny van Dyk <kugelfang@gentoo.org>
+ *                          Michael Buesch <mbuesch@freenet.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
  *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called COPYING.
+ */
+
+#include "ieee80211softmac_priv.h"
+
+/*
  * Each event has associated to it
  *  - an event type (see constants in public header)
  *  - an event context (see below)
@@ -43,6 +67,7 @@ static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = {
        "authenticating failed",
        "authenticating timed out",
        "associating failed because no suitable network was found",
+       "disassociated",
 };
 
 
@@ -104,13 +129,42 @@ void
 ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx)
 {
        struct ieee80211softmac_event *eventptr, *tmp;
-       union iwreq_data wrqu;
-       char *msg;
+       struct ieee80211softmac_network *network;
        
        if (event >= 0) {
-               msg = event_descriptions[event];
-               wrqu.data.length = strlen(msg);
-               wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg);
+               union iwreq_data wrqu;
+               int we_event;
+               char *msg = NULL;
+
+               switch(event) {
+               case IEEE80211SOFTMAC_EVENT_ASSOCIATED:
+                       network = (struct ieee80211softmac_network *)event_ctx;
+                       wrqu.data.length = 0;
+                       wrqu.data.flags = 0;
+                       memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN);
+                       wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+                       we_event = SIOCGIWAP;
+                       break;
+               case IEEE80211SOFTMAC_EVENT_DISASSOCIATED:
+                       wrqu.data.length = 0;
+                       wrqu.data.flags = 0;
+                       memset(&wrqu, '\0', sizeof (union iwreq_data));
+                       wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+                       we_event = SIOCGIWAP;
+                       break;
+               case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED:
+                       wrqu.data.length = 0;
+                       wrqu.data.flags = 0;
+                       memset(&wrqu, '\0', sizeof (union iwreq_data));
+                       we_event = SIOCGIWSCAN;
+                       break;
+               default:
+                       msg = event_descriptions[event];
+                       wrqu.data.length = strlen(msg);
+                       we_event = IWEVCUSTOM;
+                       break;
+               }
+               wireless_send_event(mac->dev, we_event, &wrqu, msg);
        }
 
        if (!list_empty(&mac->events))
@@ -118,7 +172,7 @@ ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int eve
                        if ((eventptr->event_type == event || eventptr->event_type == -1)
                                && (eventptr->event_context == NULL || eventptr->event_context == event_ctx)) {
                                list_del(&eventptr->list);
-                               queue_work(mac->workqueue, &eventptr->work);
+                               schedule_work(&eventptr->work);
                        }
                }
 }