aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r--drivers/net/wireless/libertas/debugfs.c169
1 files changed, 0 insertions, 169 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index b600f2439b57..8f88786b036f 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -164,173 +164,6 @@ out_unlock:
164 return ret; 164 return ret;
165} 165}
166 166
167static ssize_t lbs_extscan(struct file *file, const char __user *userbuf,
168 size_t count, loff_t *ppos)
169{
170 struct lbs_private *priv = file->private_data;
171 ssize_t res, buf_size;
172 union iwreq_data wrqu;
173 unsigned long addr = get_zeroed_page(GFP_KERNEL);
174 char *buf = (char *)addr;
175
176 buf_size = min(count, len - 1);
177 if (copy_from_user(buf, userbuf, buf_size)) {
178 res = -EFAULT;
179 goto out_unlock;
180 }
181
182 lbs_send_specific_ssid_scan(priv, buf, strlen(buf)-1, 0);
183
184 memset(&wrqu, 0, sizeof(union iwreq_data));
185 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
186
187out_unlock:
188 free_page(addr);
189 return count;
190}
191
192static void lbs_parse_bssid(char *buf, size_t count,
193 struct lbs_ioctl_user_scan_cfg *scan_cfg)
194{
195 char *hold;
196 unsigned int mac[ETH_ALEN];
197
198 hold = strstr(buf, "bssid=");
199 if (!hold)
200 return;
201 hold += 6;
202 sscanf(hold, "%02x:%02x:%02x:%02x:%02x:%02x",
203 mac, mac+1, mac+2, mac+3, mac+4, mac+5);
204 memcpy(scan_cfg->bssid, mac, ETH_ALEN);
205}
206
207static void lbs_parse_ssid(char *buf, size_t count,
208 struct lbs_ioctl_user_scan_cfg *scan_cfg)
209{
210 char *hold, *end;
211 ssize_t size;
212
213 hold = strstr(buf, "ssid=");
214 if (!hold)
215 return;
216 hold += 5;
217 end = strchr(hold, ' ');
218 if (!end)
219 end = buf + count - 1;
220
221 size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold));
222 strncpy(scan_cfg->ssid, hold, size);
223
224 return;
225}
226
227static int lbs_parse_clear(char *buf, size_t count, const char *tag)
228{
229 char *hold;
230 int val;
231
232 hold = strstr(buf, tag);
233 if (!hold)
234 return 0;
235 hold += strlen(tag);
236 sscanf(hold, "%d", &val);
237
238 if (val != 0)
239 val = 1;
240
241 return val;
242}
243
244static int lbs_parse_dur(char *buf, size_t count,
245 struct lbs_ioctl_user_scan_cfg *scan_cfg)
246{
247 char *hold;
248 int val;
249
250 hold = strstr(buf, "dur=");
251 if (!hold)
252 return 0;
253 hold += 4;
254 sscanf(hold, "%d", &val);
255
256 return val;
257}
258
259static void lbs_parse_type(char *buf, size_t count,
260 struct lbs_ioctl_user_scan_cfg *scan_cfg)
261{
262 char *hold;
263 int val;
264
265 hold = strstr(buf, "type=");
266 if (!hold)
267 return;
268 hold += 5;
269 sscanf(hold, "%d", &val);
270
271 /* type=1,2 or 3 */
272 if (val < 1 || val > 3)
273 return;
274
275 scan_cfg->bsstype = val;
276
277 return;
278}
279
280static ssize_t lbs_setuserscan(struct file *file,
281 const char __user *userbuf,
282 size_t count, loff_t *ppos)
283{
284 struct lbs_private *priv = file->private_data;
285 ssize_t res, buf_size;
286 struct lbs_ioctl_user_scan_cfg *scan_cfg;
287 union iwreq_data wrqu;
288 int dur;
289 char *buf = (char *)get_zeroed_page(GFP_KERNEL);
290
291 if (!buf)
292 return -ENOMEM;
293
294 buf_size = min(count, len - 1);
295 if (copy_from_user(buf, userbuf, buf_size)) {
296 res = -EFAULT;
297 goto out_buf;
298 }
299
300 scan_cfg = kzalloc(sizeof(struct lbs_ioctl_user_scan_cfg), GFP_KERNEL);
301 if (!scan_cfg) {
302 res = -ENOMEM;
303 goto out_buf;
304 }
305 res = count;
306
307 scan_cfg->bsstype = LBS_SCAN_BSS_TYPE_ANY;
308
309 dur = lbs_parse_dur(buf, count, scan_cfg);
310 lbs_parse_bssid(buf, count, scan_cfg);
311 scan_cfg->clear_bssid = lbs_parse_clear(buf, count, "clear_bssid=");
312 lbs_parse_ssid(buf, count, scan_cfg);
313 scan_cfg->clear_ssid = lbs_parse_clear(buf, count, "clear_ssid=");
314 lbs_parse_type(buf, count, scan_cfg);
315
316 lbs_scan_networks(priv, scan_cfg, 1);
317 wait_event_interruptible(priv->cmd_pending,
318 priv->surpriseremoved || !priv->scan_channel);
319
320 if (priv->surpriseremoved)
321 goto out_scan_cfg;
322
323 memset(&wrqu, 0x00, sizeof(union iwreq_data));
324 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
325
326 out_scan_cfg:
327 kfree(scan_cfg);
328 out_buf:
329 free_page((unsigned long)buf);
330 return res;
331}
332
333
334/* 167/*
335 * When calling CMD_802_11_SUBSCRIBE_EVENT with CMD_ACT_GET, me might 168 * When calling CMD_802_11_SUBSCRIBE_EVENT with CMD_ACT_GET, me might
336 * get a bunch of vendor-specific TLVs (a.k.a. IEs) back from the 169 * get a bunch of vendor-specific TLVs (a.k.a. IEs) back from the
@@ -857,8 +690,6 @@ static struct lbs_debugfs_files debugfs_files[] = {
857 write_file_dummy), }, 690 write_file_dummy), },
858 { "sleepparams", 0644, FOPS(lbs_sleepparams_read, 691 { "sleepparams", 0644, FOPS(lbs_sleepparams_read,
859 lbs_sleepparams_write), }, 692 lbs_sleepparams_write), },
860 { "extscan", 0600, FOPS(NULL, lbs_extscan), },
861 { "setuserscan", 0600, FOPS(NULL, lbs_setuserscan), },
862}; 693};
863 694
864static struct lbs_debugfs_files debugfs_events_files[] = { 695static struct lbs_debugfs_files debugfs_events_files[] = {