add txpwr with reg. override to wlc
SVN-Revision: 375
This commit is contained in:
parent
c39a42b2f1
commit
9bf860684b
2 changed files with 47 additions and 4 deletions
|
@ -562,8 +562,8 @@ typedef struct wlc_rev_info {
|
||||||
#define WLC_SET_WEP 43
|
#define WLC_SET_WEP 43
|
||||||
#define WLC_GET_KEY 44
|
#define WLC_GET_KEY 44
|
||||||
#define WLC_SET_KEY 45
|
#define WLC_SET_KEY 45
|
||||||
#define WLC_GET_PASSIVE 48 /* added by nbd */
|
#define WLC_GET_PASSIVE 48 /* added by nbd */
|
||||||
#define WLC_SET_PASSIVE 49 /* added by nbd */
|
#define WLC_SET_PASSIVE 49 /* added by nbd */
|
||||||
#define WLC_SCAN 50
|
#define WLC_SCAN 50
|
||||||
#define WLC_SCAN_RESULTS 51
|
#define WLC_SCAN_RESULTS 51
|
||||||
#define WLC_DISASSOC 52
|
#define WLC_DISASSOC 52
|
||||||
|
|
|
@ -24,6 +24,29 @@
|
||||||
#include <typedefs.h>
|
#include <typedefs.h>
|
||||||
#include <wlutils.h>
|
#include <wlutils.h>
|
||||||
|
|
||||||
|
int _argc;
|
||||||
|
char **_argv;
|
||||||
|
|
||||||
|
void qtxpwr() {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
if (_argc > 3) {
|
||||||
|
if (_argv[3][0] == '@') {
|
||||||
|
i = atoi(_argv[3] + 1);
|
||||||
|
i |= 0x80000000;
|
||||||
|
} else {
|
||||||
|
i = atoi(_argv[3]);
|
||||||
|
}
|
||||||
|
wl_set_val(_argv[1], "qtxpower", &i, sizeof(i));
|
||||||
|
} else {
|
||||||
|
wl_get_val(_argv[1], "qtxpower", &i, sizeof(i));
|
||||||
|
if ((i & 0x80000000) == 0x80000000)
|
||||||
|
printf("@");
|
||||||
|
printf("%d\n", i & 0x7ffffff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct wl_config {
|
struct wl_config {
|
||||||
char *name, *desc;
|
char *name, *desc;
|
||||||
enum {
|
enum {
|
||||||
|
@ -33,11 +56,12 @@ struct wl_config {
|
||||||
} type;
|
} type;
|
||||||
int get, set;
|
int get, set;
|
||||||
int r1, r2;
|
int r1, r2;
|
||||||
char *data;
|
void *handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wl_config commands[] = {
|
struct wl_config commands[] = {
|
||||||
{"txpwr", "transmit power (in mW)", INT, WLC_GET_TXPWR, WLC_SET_TXPWR, 0, 255, NULL},
|
{"txpwr", "transmit power (in mW)", INT, WLC_GET_TXPWR, WLC_SET_TXPWR, 0, 255, NULL},
|
||||||
|
{"qtxpwr", "\ttransmit power (in qdbm)\n\t\t\t\"@\" before value means regulatory override", OTHER, 0, 0, 0, 0, qtxpwr},
|
||||||
{"promisc", "promiscuous mode", BOOL, WLC_GET_PROMISC, WLC_SET_PROMISC, 0, 0, NULL},
|
{"promisc", "promiscuous mode", BOOL, WLC_GET_PROMISC, WLC_SET_PROMISC, 0, 0, NULL},
|
||||||
{"monitor", "monitor mode", BOOL, WLC_GET_MONITOR, WLC_SET_MONITOR, 0, 0, NULL},
|
{"monitor", "monitor mode", BOOL, WLC_GET_MONITOR, WLC_SET_MONITOR, 0, 0, NULL},
|
||||||
{"passive", "passive mode", BOOL, WLC_GET_PASSIVE, WLC_SET_PASSIVE, 0, 0, NULL},
|
{"passive", "passive mode", BOOL, WLC_GET_PASSIVE, WLC_SET_PASSIVE, 0, 0, NULL},
|
||||||
|
@ -45,6 +69,7 @@ struct wl_config commands[] = {
|
||||||
{"infra", "infrastructure mode (0 = IBSS, 1 = Infra BSS)", BOOL, WLC_GET_INFRA, WLC_SET_INFRA, 0, 0, NULL},
|
{"infra", "infrastructure mode (0 = IBSS, 1 = Infra BSS)", BOOL, WLC_GET_INFRA, WLC_SET_INFRA, 0, 0, NULL},
|
||||||
{"antdiv", "rx antenna diversity (0 = antenna 0, 1 = antenna 1, 3 = auto select)", INT, WLC_GET_ANTDIV, WLC_SET_ANTDIV, 0, 3, NULL},
|
{"antdiv", "rx antenna diversity (0 = antenna 0, 1 = antenna 1, 3 = auto select)", INT, WLC_GET_ANTDIV, WLC_SET_ANTDIV, 0, 3, NULL},
|
||||||
{"txant", "set tx antenna (0 = antenna 0, 1 = antenna 1, 3 = rx antenna)", INT, WLC_GET_TXANT, WLC_SET_TXANT, 0, 3, NULL},
|
{"txant", "set tx antenna (0 = antenna 0, 1 = antenna 1, 3 = rx antenna)", INT, WLC_GET_TXANT, WLC_SET_TXANT, 0, 3, NULL},
|
||||||
|
{"wet", "wireless ethernet bridging mode", BOOL, WLC_GET_WET, WLC_SET_WET, 0, 0, NULL},
|
||||||
{"channel", "set channel", INT, WLC_GET_CHANNEL, WLC_SET_CHANNEL, 1, 14, NULL},
|
{"channel", "set channel", INT, WLC_GET_CHANNEL, WLC_SET_CHANNEL, 1, 14, NULL},
|
||||||
{NULL, NULL, 0, 0, 0, 0, 0, NULL}
|
{NULL, NULL, 0, 0, 0, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
@ -68,7 +93,10 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct wl_config *cmd;
|
struct wl_config *cmd;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
_argc = argc;
|
||||||
|
_argv = argv;
|
||||||
|
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
fprintf(stderr, "Usage: %s <interface> <command> [...]\n\n", argv[0]);
|
fprintf(stderr, "Usage: %s <interface> <command> [...]\n\n", argv[0]);
|
||||||
fprintf(stderr, "Commands:\n\n");
|
fprintf(stderr, "Commands:\n\n");
|
||||||
|
@ -109,6 +137,16 @@ int main(int argc, char **argv)
|
||||||
fprintf(stderr, "ioctl = 0x%x (%d)\nold value = 0x%x (%d)\n", ioctl, ioctl, i, i);
|
fprintf(stderr, "ioctl = 0x%x (%d)\nold value = 0x%x (%d)\n", ioctl, ioctl, i, i);
|
||||||
wl_ioctl(argv[1], ioctl, &i, sizeof(i));
|
wl_ioctl(argv[1], ioctl, &i, sizeof(i));
|
||||||
fprintf(stderr, "new value = 0x%x (%d)\n", i, i);
|
fprintf(stderr, "new value = 0x%x (%d)\n", i, i);
|
||||||
|
} else if (strcmp(argv[3], "intval") == 0) {
|
||||||
|
i = 0;
|
||||||
|
fprintf(stderr, "var = \"%s\"\nold value = 0x%x (%d)\n", argv[4], i, i);
|
||||||
|
if (argc > 5) {
|
||||||
|
i = atoi(argv[5]);
|
||||||
|
wl_set_val(argv[1], argv[4], &i, sizeof(i));
|
||||||
|
} else {
|
||||||
|
wl_get_val(argv[1], argv[4], &i, sizeof(i));
|
||||||
|
}
|
||||||
|
fprintf(stderr, "new value = 0x%x (%d)\n", i, i);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -124,6 +162,11 @@ int main(int argc, char **argv)
|
||||||
set_int(argv[1], cmd->set, atoi(argv[3]), cmd->r1, cmd->r2);
|
set_int(argv[1], cmd->set, atoi(argv[3]), cmd->r1, cmd->r2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case OTHER: {
|
||||||
|
void (*handler)(void) = cmd->handler;
|
||||||
|
handler();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
|
|
Loading…
Reference in a new issue