1 Index: linux-2.6.24.7/drivers/net/wireless/hostap/hostap_ap.c
2 ===================================================================
3 --- linux-2.6.24.7.orig/drivers/net/wireless/hostap/hostap_ap.c
4 +++ linux-2.6.24.7/drivers/net/wireless/hostap/hostap_ap.c
5 @@ -2358,13 +2358,13 @@ int prism2_ap_get_sta_qual(local_info_t
6 addr[count].sa_family = ARPHRD_ETHER;
7 memcpy(addr[count].sa_data, sta->addr, ETH_ALEN);
8 if (sta->last_rx_silence == 0)
9 - qual[count].qual = sta->last_rx_signal < 27 ?
10 - 0 : (sta->last_rx_signal - 27) * 92 / 127;
11 + qual[count].qual = (sta->last_rx_signal - 156) == 0 ?
12 + 0 : (sta->last_rx_signal - 156) * 92 / 64;
14 - qual[count].qual = sta->last_rx_signal -
15 - sta->last_rx_silence - 35;
16 - qual[count].level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal);
17 - qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence);
18 + qual[count].qual = (sta->last_rx_signal -
19 + sta->last_rx_silence) * 92 / 64;
20 + qual[count].level = sta->last_rx_signal;
21 + qual[count].noise = sta->last_rx_silence;
22 qual[count].updated = sta->last_rx_updated;
24 sta->last_rx_updated = IW_QUAL_DBM;
25 @@ -2429,13 +2429,13 @@ int prism2_ap_translate_scan(struct net_
26 memset(&iwe, 0, sizeof(iwe));
28 if (sta->last_rx_silence == 0)
29 - iwe.u.qual.qual = sta->last_rx_signal < 27 ?
30 - 0 : (sta->last_rx_signal - 27) * 92 / 127;
31 + iwe.u.qual.qual = (sta->last_rx_signal -156) == 0 ?
32 + 0 : (sta->last_rx_signal - 156) * 92 / 64;
34 - iwe.u.qual.qual = sta->last_rx_signal -
35 - sta->last_rx_silence - 35;
36 - iwe.u.qual.level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal);
37 - iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence);
38 + iwe.u.qual.qual = (sta->last_rx_signal -
39 + sta->last_rx_silence) * 92 / 64;
40 + iwe.u.qual.level = sta->last_rx_signal;
41 + iwe.u.qual.noise = sta->last_rx_silence;
42 iwe.u.qual.updated = sta->last_rx_updated;
43 iwe.len = IW_EV_QUAL_LEN;
44 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
45 Index: linux-2.6.24.7/drivers/net/wireless/hostap/hostap_config.h
46 ===================================================================
47 --- linux-2.6.24.7.orig/drivers/net/wireless/hostap/hostap_config.h
48 +++ linux-2.6.24.7/drivers/net/wireless/hostap/hostap_config.h
51 /* #define PRISM2_NO_STATION_MODES */
53 +/* Enable TX power Setting functions
54 + * (min att = -128 , max att = 127)
56 +#define RAW_TXPOWER_SETTING
58 #endif /* HOSTAP_CONFIG_H */
59 Index: linux-2.6.24.7/drivers/net/wireless/hostap/hostap.h
60 ===================================================================
61 --- linux-2.6.24.7.orig/drivers/net/wireless/hostap/hostap.h
62 +++ linux-2.6.24.7/drivers/net/wireless/hostap/hostap.h
63 @@ -89,6 +89,7 @@ extern const struct iw_handler_def hosta
64 extern const struct ethtool_ops prism2_ethtool_ops;
66 int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
67 +int hostap_restore_power(struct net_device *dev);
71 Index: linux-2.6.24.7/drivers/net/wireless/hostap/hostap_hw.c
72 ===================================================================
73 --- linux-2.6.24.7.orig/drivers/net/wireless/hostap/hostap_hw.c
74 +++ linux-2.6.24.7/drivers/net/wireless/hostap/hostap_hw.c
75 @@ -933,6 +933,7 @@ static int hfa384x_set_rid(struct net_de
79 + hostap_restore_power(dev);
83 Index: linux-2.6.24.7/drivers/net/wireless/hostap/hostap_info.c
84 ===================================================================
85 --- linux-2.6.24.7.orig/drivers/net/wireless/hostap/hostap_info.c
86 +++ linux-2.6.24.7/drivers/net/wireless/hostap/hostap_info.c
87 @@ -433,6 +433,11 @@ static void handle_info_queue_linkstatus
90 /* Get BSSID if we have a valid AP address */
92 + if ( val == HFA384X_LINKSTATUS_CONNECTED ||
93 + val == HFA384X_LINKSTATUS_DISCONNECTED )
94 + hostap_restore_power(local->dev);
97 netif_carrier_on(local->dev);
98 netif_carrier_on(local->ddev);
99 Index: linux-2.6.24.7/drivers/net/wireless/hostap/hostap_ioctl.c
100 ===================================================================
101 --- linux-2.6.24.7.orig/drivers/net/wireless/hostap/hostap_ioctl.c
102 +++ linux-2.6.24.7/drivers/net/wireless/hostap/hostap_ioctl.c
103 @@ -1501,23 +1501,20 @@ static int prism2_txpower_hfa386x_to_dBm
113 static u16 prism2_txpower_dBm_to_hfa386x(int val)
119 - else if (val < -43)
122 + else if (val < -128)
129 return (unsigned char) tmp;
131 @@ -4077,3 +4074,35 @@ int hostap_ioctl(struct net_device *dev,
136 +/* BUG FIX: Restore power setting value when lost due to F/W bug */
138 +int hostap_restore_power(struct net_device *dev)
140 + struct hostap_interface *iface = dev->priv;
141 + local_info_t *local = iface->local;
146 + if (local->txpower_type == PRISM2_TXPOWER_OFF) {
147 + val = 0xff; /* use all standby and sleep modes */
148 + ret = local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF,
149 + HFA386X_CR_A_D_TEST_MODES2,
153 +#ifdef RAW_TXPOWER_SETTING
154 + if (local->txpower_type == PRISM2_TXPOWER_FIXED) {
155 + val = HFA384X_TEST_CFG_BIT_ALC;
156 + local->func->cmd(dev, HFA384X_CMDCODE_TEST |
157 + (HFA384X_TEST_CFG_BITS << 8), 0, &val, NULL);
158 + val = prism2_txpower_dBm_to_hfa386x(local->txpower);
159 + ret = (local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF,
160 + HFA386X_CR_MANUAL_TX_POWER, &val, NULL));
162 +#endif /* RAW_TXPOWER_SETTING */
163 + return (ret ? -EOPNOTSUPP : 0);
166 +EXPORT_SYMBOL(hostap_restore_power);