Skip to contentSkip to conversation

mac80211: Add association LED trigger

PATCH New Michael Buesch 1 participant 1 message Sep 27, 2007 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: Add association LED trigger

Many devices have LEDs to indicate the link status. Export this functionality to drivers.

include/net/mac80211.h +11 -0
Index: wireless-2.6/include/net/mac80211.h
===================================================================
@@ -926,6 +926,7 @@ int ieee80211_register_hw(struct ieee802
 #ifdef CONFIG_MAC80211_LEDS
 extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
 extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
+extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
 #endif
 static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
 {
@@ -945,6 +946,16 @@ static inline char *ieee80211_get_rx_led
 #endif
 }
 
+static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
+{
+#ifdef CONFIG_MAC80211_LEDS
+	return __ieee80211_get_assoc_led_name(hw);
+#else
+	return NULL;
+#endif
+}
+
+
 /* Register a new hardware PHYMODE capability to the stack. */
 int ieee80211_register_hwmode(struct ieee80211_hw *hw,
 			      struct ieee80211_hw_mode *mode);
net/mac80211/ieee80211_i.h +2 -2
Index: wireless-2.6/net/mac80211/ieee80211_i.h
===================================================================
@@ -510,8 +510,8 @@ struct ieee80211_local {
 
 #ifdef CONFIG_MAC80211_LEDS
 	int tx_led_counter, rx_led_counter;
-	struct led_trigger *tx_led, *rx_led;
-	char tx_led_name[32], rx_led_name[32];
+	struct led_trigger *tx_led, *rx_led, *assoc_led;
+	char tx_led_name[32], rx_led_name[32], assoc_led_name[32];
 #endif
 
 	u32 channel_use;
net/mac80211/ieee80211_led.c +51 -16

90 lines not on this page · raw message

net/mac80211/ieee80211_led.h +6 -0
Index: wireless-2.6/net/mac80211/ieee80211_led.h
===================================================================
@@ -14,6 +14,8 @@
 #ifdef CONFIG_MAC80211_LEDS
 extern void ieee80211_led_rx(struct ieee80211_local *local);
 extern void ieee80211_led_tx(struct ieee80211_local *local, int q);
+extern void ieee80211_led_assoc(struct ieee80211_local *local,
+				bool associated);
 extern void ieee80211_led_init(struct ieee80211_local *local);
 extern void ieee80211_led_exit(struct ieee80211_local *local);
 #else
@@ -23,6 +25,10 @@ static inline void ieee80211_led_rx(stru
 static inline void ieee80211_led_tx(struct ieee80211_local *local, int q)
 {
 }
+static inline void ieee80211_led_assoc(struct ieee80211_local *local,
+				       bool associated)
+{
+}
 static inline void ieee80211_led_init(struct ieee80211_local *local)
 {
 }
net/mac80211/ieee80211_sta.c +4 -1
Index: wireless-2.6/net/mac80211/ieee80211_sta.c
===================================================================
@@ -31,6 +31,7 @@
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
 #include "ieee80211_rate.h"
+#include "ieee80211_led.h"
 #include "hostapd_ioctl.h"
 
 #define IEEE80211_AUTH_TIMEOUT (HZ / 5)
@@ -408,8 +409,9 @@ static void ieee80211_sta_send_associnfo
 
 static void ieee80211_set_associated(struct net_device *dev,
 				     struct ieee80211_if_sta *ifsta,
-				     unsigned int assoc)
+				     bool assoc)
 {
+	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 	union iwreq_data wrqu;
 
 	if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc)
@@ -447,6 +449,7 @@ static void ieee80211_set_associated(str
 	wrqu.ap_addr.sa_family = ARPHRD_ETHER;
 	wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
 	ifsta->last_probe = jiffies;
+	ieee80211_led_assoc(local, assoc);
 }
 
 static void ieee80211_set_disassoc(struct net_device *dev,