From 5202f3110eef90c0443d32c4807f9295dd358661 Mon Sep 17 00:00:00 2001 From: Damien Bergamini Date: Thu, 18 Nov 2004 21:02:43 +0000 Subject: use the filesystem based firmware loader; deraadt ok --- sbin/ipwcontrol/ipwcontrol.8 | 25 +------------------- sbin/ipwcontrol/ipwcontrol.c | 54 ++++---------------------------------------- 2 files changed, 5 insertions(+), 74 deletions(-) (limited to 'sbin/ipwcontrol') 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 . 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 #include -#include #include -#include #include @@ -48,8 +46,6 @@ static char rcsid[] = "$Id: ipwcontrol.c,v 1.6 2004/11/03 17:40:49 damien Exp $" #include #include -#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); } @@ -138,36 +122,6 @@ do_req(char *iface, unsigned long req, void *data) return error; } -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) { -- cgit v1.2.3