diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-16 21:50:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 21:50:49 -0400 |
commit | ccc580571cf0799d0460a085a7632b77753f083e (patch) | |
tree | 018e0f83776b089b1f272694132688ac93be25b4 /drivers/net/wireless/zd1201.c | |
parent | 0f5cabba49021d36e9f76bd97d7fa0f4a408063f (diff) |
wext: Emit event stream entries correctly when compat.
Three major portions to this change:
1) Add IW_EV_COMPAT_LCP_LEN, IW_EV_COMPAT_POINT_OFF,
and IW_EV_COMPAT_POINT_LEN helper defines.
2) Delete iw_stream_check_add_*(), they are unused.
3) Add iw_request_info argument to iwe_stream_add_*(), and use it to
size the event and pointer lengths correctly depending upon whether
IW_REQUEST_FLAG_COMPAT is set or not.
4) The mechanical transformations to the drivers and wireless stack
bits to get the iw_request_info passed down into the routines
modified in #3. Also, explicit references to IW_EV_LCP_LEN are
replaced with iwe_stream_lcp_len(info).
With a lot of help and bug fixes from Masakazu Mokuno.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/zd1201.c')
-rw-r--r-- | drivers/net/wireless/zd1201.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index d5c0c66188ca..07e4d1f73207 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c | |||
@@ -1152,32 +1152,36 @@ static int zd1201_get_scan(struct net_device *dev, | |||
1152 | iwe.cmd = SIOCGIWAP; | 1152 | iwe.cmd = SIOCGIWAP; |
1153 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | 1153 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; |
1154 | memcpy(iwe.u.ap_addr.sa_data, zd->rxdata+i+6, 6); | 1154 | memcpy(iwe.u.ap_addr.sa_data, zd->rxdata+i+6, 6); |
1155 | cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_ADDR_LEN); | 1155 | cev = iwe_stream_add_event(info, cev, end_buf, |
1156 | &iwe, IW_EV_ADDR_LEN); | ||
1156 | 1157 | ||
1157 | iwe.cmd = SIOCGIWESSID; | 1158 | iwe.cmd = SIOCGIWESSID; |
1158 | iwe.u.data.length = zd->rxdata[i+16]; | 1159 | iwe.u.data.length = zd->rxdata[i+16]; |
1159 | iwe.u.data.flags = 1; | 1160 | iwe.u.data.flags = 1; |
1160 | cev = iwe_stream_add_point(cev, end_buf, &iwe, zd->rxdata+i+18); | 1161 | cev = iwe_stream_add_point(info, cev, end_buf, |
1162 | &iwe, zd->rxdata+i+18); | ||
1161 | 1163 | ||
1162 | iwe.cmd = SIOCGIWMODE; | 1164 | iwe.cmd = SIOCGIWMODE; |
1163 | if (zd->rxdata[i+14]&0x01) | 1165 | if (zd->rxdata[i+14]&0x01) |
1164 | iwe.u.mode = IW_MODE_MASTER; | 1166 | iwe.u.mode = IW_MODE_MASTER; |
1165 | else | 1167 | else |
1166 | iwe.u.mode = IW_MODE_ADHOC; | 1168 | iwe.u.mode = IW_MODE_ADHOC; |
1167 | cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_UINT_LEN); | 1169 | cev = iwe_stream_add_event(info, cev, end_buf, |
1170 | &iwe, IW_EV_UINT_LEN); | ||
1168 | 1171 | ||
1169 | iwe.cmd = SIOCGIWFREQ; | 1172 | iwe.cmd = SIOCGIWFREQ; |
1170 | iwe.u.freq.m = zd->rxdata[i+0]; | 1173 | iwe.u.freq.m = zd->rxdata[i+0]; |
1171 | iwe.u.freq.e = 0; | 1174 | iwe.u.freq.e = 0; |
1172 | cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_FREQ_LEN); | 1175 | cev = iwe_stream_add_event(info, cev, end_buf, |
1176 | &iwe, IW_EV_FREQ_LEN); | ||
1173 | 1177 | ||
1174 | iwe.cmd = SIOCGIWRATE; | 1178 | iwe.cmd = SIOCGIWRATE; |
1175 | iwe.u.bitrate.fixed = 0; | 1179 | iwe.u.bitrate.fixed = 0; |
1176 | iwe.u.bitrate.disabled = 0; | 1180 | iwe.u.bitrate.disabled = 0; |
1177 | for (j=0; j<10; j++) if (zd->rxdata[i+50+j]) { | 1181 | for (j=0; j<10; j++) if (zd->rxdata[i+50+j]) { |
1178 | iwe.u.bitrate.value = (zd->rxdata[i+50+j]&0x7f)*500000; | 1182 | iwe.u.bitrate.value = (zd->rxdata[i+50+j]&0x7f)*500000; |
1179 | cev=iwe_stream_add_event(cev, end_buf, &iwe, | 1183 | cev = iwe_stream_add_event(info, cev, end_buf, |
1180 | IW_EV_PARAM_LEN); | 1184 | &iwe, IW_EV_PARAM_LEN); |
1181 | } | 1185 | } |
1182 | 1186 | ||
1183 | iwe.cmd = SIOCGIWENCODE; | 1187 | iwe.cmd = SIOCGIWENCODE; |
@@ -1186,14 +1190,15 @@ static int zd1201_get_scan(struct net_device *dev, | |||
1186 | iwe.u.data.flags = IW_ENCODE_ENABLED; | 1190 | iwe.u.data.flags = IW_ENCODE_ENABLED; |
1187 | else | 1191 | else |
1188 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 1192 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
1189 | cev = iwe_stream_add_point(cev, end_buf, &iwe, NULL); | 1193 | cev = iwe_stream_add_point(info, cev, end_buf, &iwe, NULL); |
1190 | 1194 | ||
1191 | iwe.cmd = IWEVQUAL; | 1195 | iwe.cmd = IWEVQUAL; |
1192 | iwe.u.qual.qual = zd->rxdata[i+4]; | 1196 | iwe.u.qual.qual = zd->rxdata[i+4]; |
1193 | iwe.u.qual.noise= zd->rxdata[i+2]/10-100; | 1197 | iwe.u.qual.noise= zd->rxdata[i+2]/10-100; |
1194 | iwe.u.qual.level = (256+zd->rxdata[i+4]*100)/255-100; | 1198 | iwe.u.qual.level = (256+zd->rxdata[i+4]*100)/255-100; |
1195 | iwe.u.qual.updated = 7; | 1199 | iwe.u.qual.updated = 7; |
1196 | cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_QUAL_LEN); | 1200 | cev = iwe_stream_add_event(info, cev, end_buf, |
1201 | &iwe, IW_EV_QUAL_LEN); | ||
1197 | } | 1202 | } |
1198 | 1203 | ||
1199 | if (!enabled_save) | 1204 | if (!enabled_save) |