NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: iwi(4) and its non-free firmware



It turns out that on the Acer TravelMate 290, there is a magic switch
controlling whether the radio is on or not.  I stumbled across a
program at <http://damien.bergamini.free.fr/ipw/download.html> to turn
the switch on, but that program is specific to FreeBSD.  Fortunately
it was pretty straightforward to port it to NetBSD; I've attached a
patch.  I don't know whether this would be appropriate to include in
NetBSD, since it is so extremely specialized, but it would be nice if
this information were more readily available.
diff -ru 290radio.old/290radio.c 290radio.new/290radio.c
--- 290radio.old/290radio.c     2004-10-18 09:43:15.000000000 +0000
+++ 290radio.new/290radio.c     2008-08-07 19:46:15.000000000 +0000
@@ -37,6 +37,7 @@
 #include <machine/bus.h>
 #include <machine/sysarch.h>
 
+#include <err.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -119,10 +120,8 @@
        int ch, num_options=0;
        char *cmd_queue[3];
 
-       if (open("/dev/io", O_RDWR, 000) == -1) {
-               printf("Error open /dev/io\n");
-               return 1;
-       }
+       if (i386_iopl(1) == -1)
+               err(1, "unable to set I/O privilege");
 
        while ((ch = getopt(argc, argv, "hWwBb")) != -1) {
                if (num_options == 4)
@@ -163,5 +162,8 @@
                if (cmd_queue[i] == "b") switch_bluetooth_state(0);
        }
 
+       if (i386_iopl(0) == -1)
+               err(1, "unable to reset I/O privilege level");
+
        return 0;
 }
diff -ru 290radio.old/Makefile 290radio.new/Makefile
--- 290radio.old/Makefile       2004-10-18 08:34:16.000000000 +0000
+++ 290radio.new/Makefile       2008-08-07 19:55:25.000000000 +0000
@@ -5,6 +5,7 @@
 MAN             =
 
 CFLAGS          += -Wall
+LDFLAGS         += -li386
 
 BINDIR          = /usr/local/sbin
 


Home | Main Index | Thread Index | Old Index