1 | /* |
---|
2 | * Copyright (C) 2009 Joshua Oreman <oremanj@rwcr.net>. |
---|
3 | * |
---|
4 | * This program is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU General Public License as |
---|
6 | * published by the Free Software Foundation; either version 2 of the |
---|
7 | * License, or any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, but |
---|
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
12 | * General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License |
---|
15 | * along with this program; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
17 | */ |
---|
18 | |
---|
19 | FILE_LICENCE ( GPL2_OR_LATER ); |
---|
20 | |
---|
21 | #include <gpxe/netdevice.h> |
---|
22 | #include <gpxe/net80211.h> |
---|
23 | #include <gpxe/command.h> |
---|
24 | #include <usr/iwmgmt.h> |
---|
25 | #include <hci/ifmgmt_cmd.h> |
---|
26 | |
---|
27 | /* "iwstat" command */ |
---|
28 | |
---|
29 | static int iwstat_payload ( struct net_device *netdev ) { |
---|
30 | struct net80211_device *dev = net80211_get ( netdev ); |
---|
31 | |
---|
32 | if ( dev ) |
---|
33 | iwstat ( dev ); |
---|
34 | |
---|
35 | return 0; |
---|
36 | } |
---|
37 | |
---|
38 | static int iwstat_exec ( int argc, char **argv ) { |
---|
39 | return ifcommon_exec ( argc, argv, |
---|
40 | iwstat_payload, "Display wireless status of" ); |
---|
41 | } |
---|
42 | |
---|
43 | /* "iwlist" command */ |
---|
44 | |
---|
45 | static int iwlist_payload ( struct net_device *netdev ) { |
---|
46 | struct net80211_device *dev = net80211_get ( netdev ); |
---|
47 | |
---|
48 | if ( dev ) |
---|
49 | return iwlist ( dev ); |
---|
50 | |
---|
51 | return 0; |
---|
52 | } |
---|
53 | |
---|
54 | static int iwlist_exec ( int argc, char **argv ) { |
---|
55 | return ifcommon_exec ( argc, argv, iwlist_payload, |
---|
56 | "List wireless networks available via" ); |
---|
57 | } |
---|
58 | |
---|
59 | /** Wireless interface management commands */ |
---|
60 | struct command iwmgmt_commands[] __command = { |
---|
61 | { |
---|
62 | .name = "iwstat", |
---|
63 | .exec = iwstat_exec, |
---|
64 | }, |
---|
65 | { |
---|
66 | .name = "iwlist", |
---|
67 | .exec = iwlist_exec, |
---|
68 | }, |
---|
69 | }; |
---|