diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2004-11-18 21:02:43 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2004-11-18 21:02:43 +0000 |
commit | 5202f3110eef90c0443d32c4807f9295dd358661 (patch) | |
tree | 9e89fb5e546fe566b6960663afe8c06bec9e2402 /sbin/ipwcontrol | |
parent | 7d254a13bfe6b946843ade9d4283f4a7072db0d5 (diff) |
use the filesystem based firmware loader; deraadt ok
Diffstat (limited to 'sbin/ipwcontrol')
-rw-r--r-- | sbin/ipwcontrol/ipwcontrol.8 | 25 | ||||
-rw-r--r-- | sbin/ipwcontrol/ipwcontrol.c | 54 |
2 files changed, 5 insertions, 74 deletions
diff --git a/sbin/ipwcontrol/ipwcontrol.8 b/sbin/ipwcontrol/ipwcontrol.8 index 78f02ccfb8b..e2afecf0165 100644 --- a/sbin/ipwcontrol/ipwcontrol.8 +++ b/sbin/ipwcontrol/ipwcontrol.8 @@ -1,4 +1,4 @@ -.\" $Id: ipwcontrol.8,v 1.2 2004/10/20 21:01:38 deraadt Exp $ +.\" $Id: ipwcontrol.8,v 1.3 2004/11/18 21:02:31 damien Exp $ .\" .\" Copyright (c) 2004 .\" Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. @@ -34,8 +34,6 @@ .Sh SYNOPSIS .Nm .Op Fl i Ar interface -.Op Fl f Ar firmware -.Op Fl k .Op Fl r .Sh DESCRIPTION The @@ -54,30 +52,9 @@ The options are as follows: .Bl -tag -width indent .It Fl i Ar interface Display adapter's internal statistics. -.It Fl f Ar firmware -Download firmware binary image -.Ar firmware -to the driver. -.It Fl k -Kill (remove) the firmware and reset the adapter. .It Fl r Display the radio switch state (on or off). .El -.Sh FILES -The firmware is not shipped with OpenBSD; install the -.Pa ipw-firmware -package. -The original archive is available from Intel at: -.Pa http://ipw2100.sourceforge.net/firmware.php?fid=3 . -.Pp -.Bl -tag -width ipw2100-1.2-i.fw -compact -.It Pa ipw2100-1.2.fw -BSS mode (connection to an access point) firmware -.It Pa ipw2100-1.2-i.fw -IBSS mode (point-to-point connection) firmware -.It Pa ipw2100-1.2-p.fw -Monitor mode firmware -.El .Sh SEE ALSO .Xr ipw 4 , .Xr ifconfig 8 diff --git a/sbin/ipwcontrol/ipwcontrol.c b/sbin/ipwcontrol/ipwcontrol.c index 13b2aef9684..acb1ff6fece 100644 --- a/sbin/ipwcontrol/ipwcontrol.c +++ b/sbin/ipwcontrol/ipwcontrol.c @@ -1,4 +1,4 @@ -/* $Id: ipwcontrol.c,v 1.6 2004/11/03 17:40:49 damien Exp $ */ +/* $Id: ipwcontrol.c,v 1.7 2004/11/18 21:02:32 damien Exp $ */ /*- * Copyright (c) 2004 @@ -28,14 +28,12 @@ */ #ifndef lint -static char rcsid[] = "$Id: ipwcontrol.c,v 1.6 2004/11/03 17:40:49 damien Exp $"; +static char rcsid[] = "$Id: ipwcontrol.c,v 1.7 2004/11/18 21:02:32 damien Exp $"; #endif /* not lint */ #include <sys/types.h> #include <sys/ioctl.h> -#include <sys/mman.h> #include <sys/socket.h> -#include <sys/stat.h> #include <net/if.h> @@ -48,8 +46,6 @@ static char rcsid[] = "$Id: ipwcontrol.c,v 1.6 2004/11/03 17:40:49 damien Exp $" #include <sysexits.h> #include <unistd.h> -#define SIOCSLOADFW _IOW('i', 137, struct ifreq) -#define SIOCSKILLFW _IOW('i', 138, struct ifreq) #define SIOCGRADIO _IOWR('i', 139, struct ifreq) #define SIOCGTABLE1 _IOWR('i', 140, struct ifreq) @@ -58,8 +54,6 @@ extern int optind; static void usage(void); static int do_req(char *, unsigned long, void *); -static void load_firmware(char *, char *); -static void kill_firmware(char *); static void get_radio_state(char *); static void get_statistics(char *); @@ -76,21 +70,13 @@ main(int argc, char **argv) optind = 2; } - while ((ch = getopt(argc, argv, "hf:i:kr")) != -1) { + while ((ch = getopt(argc, argv, "hi:r")) != -1) { switch (ch) { case 'i': if (!ifspecified) iface = optarg; break; - case 'f': - load_firmware(iface, optarg); - return EX_OK; - - case 'k': - kill_firmware(iface); - return EX_OK; - case 'r': get_radio_state(iface); return EX_OK; @@ -111,9 +97,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, - "usage: %s [interface] [-f firmware] [-kr]\n", - __progname); + fprintf(stderr, "usage: %s [interface] [-r]\n", __progname); exit(EX_USAGE); } @@ -139,36 +123,6 @@ do_req(char *iface, unsigned long req, void *data) } static void -load_firmware(char *iface, char *firmware) -{ - int fd; - struct stat st; - void *map; - - if ((fd = open(firmware, O_RDONLY)) == -1) - err(EX_OSERR, "%s", firmware); - - if (fstat(fd, &st) == -1) - err(EX_OSERR, "Unable to stat %s", firmware); - - if ((map = mmap(NULL, st.st_size, PROT_READ, 0, fd, 0)) == NULL) - err(EX_OSERR, "Can't map %s into memory", firmware); - - if (do_req(iface, SIOCSLOADFW, map) == -1) - err(EX_OSERR, "Can't load %s to driver", firmware); - - (void)munmap(map, st.st_size); - (void)close(fd); -} - -static void -kill_firmware(char *iface) -{ - if (do_req(iface, SIOCSKILLFW, NULL) == -1) - err(EX_OSERR, "Can't kill firmware"); -} - -static void get_radio_state(char *iface) { int radio; |