Intel Centrino Wireless-N 2230 -- working now

When I bought my GA-Z77N-WiFi motherboard about a year ago, I was more or less disappointed that the pre-installed Intel Centrino Wireless-N 2230 Wifi module didn't work with iwn(4) driver, neither was there much expectation that it would.

Right now the situation has changed. Although it still doesn't work in 10.1-STABLE, but it does in HEAD.
As I didn't want to switch to CURRENT from STABLE, for the very well known reasons of (1) stability and (2) installed ports, I've found a satisfying solution.

The solution is to copy head/sys/dev/iwn info the existing 10.1-STABLE source tree:
Code:
svn co https://svn0.us-west.freebsd.org/base/head/sys/dev/iwn $somewhere
cp $somewhere/iwn/* /usr/src/sys/dev/iwn
This, however, is not enough, and for this driver to compile this way it is necessary to also copy head/sys/net80211/ieee80211_proto.h and head/sys/net80211/ieee80211_output.c into /usr/src/sys/net80211 respectively.
It is also possible to copy the new head/share/man/man4/iwn.4 man file from head in likewise manner. Or else, it may be just copied to some place and then made ready to use with this command:
Code:
#gzip -cn $somewhere/iwn.4 > /usr/share/man/man4/iwn.4.gz
That will add the mentioning of "Intel Centrino Wireless-N 2230" and other new supported devices to the man page:).

After these procedures this new version of iwn(4) builds OK and then Intel Centrino Wireless-N 2230 works very fine. The only problem I had with setup, was caused by the usage of the characters '& in my pre-shared key. When these were replaced, the connection was established.

Thanks to Adrian Chadd and other people working on wireless drivers. Adrian was VERY helpful in getting this one to work in my case.
 
Last edited:
Hi. I have a problem.
I made all the steps but on kernel rebuild I get this error

Code:
 -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -gdwarf-2 -Werror  /usr/src/sys/dev/iwn/if_iwn.c
/usr/src/sys/dev/iwn/if_iwn.c:2968:3: error: implicit declaration of function 'if_inc_counter' is invalid in
  C99 [-Werror,-Wimplicit-function-declaration]
  if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:2968:23: error: use of undeclared identifier 'IFCOUNTER_IERRORS'
  if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:2975:23: error: use of undeclared identifier 'IFCOUNTER_IERRORS'
  if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:2983:23: error: use of undeclared identifier 'IFCOUNTER_IERRORS'
  if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:3006:23: error: use of undeclared identifier 'IFCOUNTER_IERRORS'
  if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:3164:24: error: use of undeclared identifier 'IFCOUNTER_OERRORS'
  if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:3169:24: error: use of undeclared identifier 'IFCOUNTER_OPACKETS'
  if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:3511:23: error: use of undeclared identifier 'IFCOUNTER_OERRORS'
  if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:3515:23: error: use of undeclared identifier 'IFCOUNTER_OPACKETS'
  if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:4827:23: error: use of undeclared identifier 'IFCOUNTER_OERRORS'
  if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:4874:24: error: use of undeclared identifier 'IFCOUNTER_OERRORS'
  if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:6746:8: error: implicit declaration of function 'ieee80211_add_ssid' is invalid
  in C99 [-Werror,-Wimplicit-function-declaration]
  frm = ieee80211_add_ssid(frm, NULL, 0);
  ^
/usr/src/sys/dev/iwn/if_iwn.c:6746:6: error: incompatible integer to pointer conversion assigning to
  'uint8_t *' (aka 'unsigned char *') from 'int' [-Werror,-Wint-conversion]
  frm = ieee80211_add_ssid(frm, NULL, 0);
  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 errors generated.
*** Error code 1

Stop.
make[2]: stopped in /usr/obj/usr/src/sys/MYKERNEL
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src

Also there is no /usr/src/net80211
There is /usr/src/sys/net80211

But also tried to put all HEAD net80211 to /usr/src and still get the same error
 
Isn't possible from RELEASE? The only thing I need is this "small" part of code who will make my wireless card work on my 10.1-RELEASE.
Stability is critical for me. Especially on a laptop where I make a lot of tweaking to make it work.
 
At least not possible with this guide as "small part of code" relies on features introduced in 10-STABLE.
If stability is critical to you, you're probably on ZFS, so such experiments can be produced without any risks with sysutils/beadm Just create new environment to boot into for test.
 
...
Also there is no /usr/src/net80211
There is /usr/src/sys/net80211...
Thank you, you're right, I've corrected this in the OP -- it is /usr/src/sys/net80211. You don't need to copy over all the directory, only the files mentioned. It has to do with ieee80211_add_ssid function being made public, so the declarations were moved from if_iwn.c into the ieee80211_proto.h, and ieee80211_output.c was also changed accordingly -- in /usr/src/sys/net80211 directory. It must fix this particular error you have:
Code:
error: implicit declaration of function 'ieee80211_add_ssid' is invalid
But apart from this, yes, I used STABLE. In fact, it wasn't me who found this "shortcut" to building the newest version of the driver, it was recommended by its developers and I found this in one of the mailing lists upon the subject.
It's not bad at all, because STABLE at this stage is really more or less stable. And, needless to add, you DON'T have to rebuild all the ports when switching between the minor releases.

I'm using this also on my laptop and it works fine. Speed matters there, so I usually build the release on my desktop, but then install it on my laptop. When everything has been built, I NFS-mount /usr/src and /usr/obj from the desktop to /usr/src and /usr/obj on my laptop. Then on my laptop I cd to /usr/src and make install everything according to the existing documentation. You can use this guide provided by wblock@.

For the NFS stuff to work, however, /usr/obj must not be tmpfs, as the guide above recommends for speed, but regular filesystem. Otherwise NFS-mounting becomes very problematic, if at all possible.
 
If I move to STABLE, how I will update my system and my ports tree? Also If I want to go back to RELEASE is possible?
Follow the guide I've mentioned if you want to move over to STABLE. There's nothing more complicated to it than several make commands. Updating ports tree will be the same, because moving from 10.x to 10.x won't tell on ports at all. You're only upgrading the base system. You'll only have to watch the replacement of your config files during the mergemaster command -- which must not be complicated. I left untouched all the files the update system offered to overwrite, and it's OK.
 
...Also If I want to go back to RELEASE is possible?
Should be. I don't remember how I did it when STABLE proved to be not really that stable... But it was right at the time the new RELEASE was out, and at that time the new STABLE is not yet that stable. I think I just extracted the RELEASE tarballs into where they're meant to be extracted. Yep, backed up some customized config files and just did it.
But you can also use src.txz from RELEASE and compile + install it the same you compile and install STABLE sources, can you? Then mergemaster and remove old libs will do the complete replacement, I think...
 
Is there a certain revision I should be using for 10.1-STABLE? When I tried this with my ThinkPad Edge E531 and the rev, it was able to detect the existence of my wifi network, but it wouldn't connect to it.

Also, whenever I attempted to configure it with # bsdinstall netconfig instead of writing wpa_supplicant.conf by hand, it would fail with the message that wpa_supplicant couldn't be started.
 
Is there a certain revision I should be using for 10.1-STABLE? When I tried this with my ThinkPad Edge E531 and the rev, it was able to detect the existence of my wifi network, but it wouldn't connect to it.

Also, whenever I attempted to configure it with "# bsdinstall netconfig" instead of writing wpa_supplicant.conf by hand, it would fail with the message that wpa_supplicant couldn't be started.
I didn't even try anything bsdinstall(8). In my case I also had problem connecting to the network. It proved to be the passphrase contained characters ' and &, which caused problems. Once these were replaced, it connected OK. But in your case it may be something different. Try wpa_cli(8) utility.

And you can also subscribe to the mailing list for FreeBSD Wi-Fi, there you'll get help from the developers of the driver. They helped me to solve my problem.
 
Hello, i've tried this in 10.3-STABLE but the compilation failed with

Code:
In file included from @/net80211/ieee80211_var.h:54:
@/net80211/ieee80211_proto.h:87:13: error: declaration of 'struct ieee80211_rx_stats' will not be visible outside of this function
  [-Werror,-Wvisibility]
  struct ieee80211_rx_stats *);
  ^
@/net80211/ieee80211_proto.h:89:13: error: declaration of 'struct ieee80211_rx_stats' will not be visible outside of this function
  [-Werror,-Wvisibility]
  struct ieee80211_rx_stats *);
  ^
In file included from /usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:73:
@/dev/iwn/if_iwnvar.h:427:16: error: field has incomplete type 'struct mbufq'
  struct mbufq  sc_xmit_queue;
  ^
@/dev/iwn/if_iwnvar.h:427:9: note: forward declaration of 'struct mbufq'
  struct mbufq  sc_xmit_queue;
  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:564:6: error: no member named 'ic_softc' in 'struct ieee80211com'
  ic->ic_softc = sc;
  ~~  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:565:6: error: no member named 'ic_name' in 'struct ieee80211com'; did you mean
  'ic_wme'?
  ic->ic_name = device_get_nameunit(dev);
  ^~~~~~~
  ic_wme
@/net80211/ieee80211_var.h:205:29: note: 'ic_wme' declared here
  struct ieee80211_wme_state ic_wme;  /* WME/WMM state */
  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:565:14: error: assigning to 'struct ieee80211_wme_state' from incompatible type
  'const char *'
  ic->ic_name = device_get_nameunit(dev);
  ^ ~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:588:39: error: no member named 'ic_macaddr' in 'struct ieee80211com'
  if ((error = iwn_read_eeprom(sc, ic->ic_macaddr)) != 0) {
  ~~  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:606:11: error: no member named 'ic_macaddr' in 'struct ieee80211com'
  ic->ic_macaddr, ":");
  ~~  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:647:23: error: too few arguments to function call, expected 2, have 1
  ieee80211_ifattach(ic);
  ~~~~~~~~~~~~~~~~~~  ^
@/net80211/ieee80211_var.h:677:1: note: 'ieee80211_ifattach' declared here
void  ieee80211_ifattach(struct ieee80211com *,
^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:649:6: error: no member named 'ic_ioctl' in 'struct ieee80211com'
  ic->ic_ioctl = iwn_ioctl;
  ~~  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:650:6: error: no member named 'ic_parent' in 'struct ieee80211com'; did you mean
  'ic_spare'?
  ic->ic_parent = iwn_parent;
  ^~~~~~~~~
  ic_spare
@/net80211/ieee80211_var.h:331:12: note: 'ic_spare' declared here
  uint64_t  ic_spare[7];
  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:650:16: error: array type 'uint64_t [7]' is not assignable
  ic->ic_parent = iwn_parent;
  ~~~~~~~~~~~~~ ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:652:6: error: no member named 'ic_transmit' in 'struct ieee80211com'
  ic->ic_transmit = iwn_transmit;
  ~~  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:667:22: error: incompatible pointer types assigning to 'void (*)(struct ifnet *)' from
  'void (struct ieee80211com *)' [-Werror,-Wincompatible-pointer-types]
  ic->ic_update_mcast = iwn_update_mcast;
  ^ ~~~~~~~~~~~~~~~~
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:686:2: error: implicit declaration of function 'mbufq_init' is invalid in C99
  [-Werror,-Wimplicit-function-declaration]
  mbufq_init(&sc->sc_xmit_queue, 1024);
  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:686:2: note: did you mean 'ifq_init'?
@/net/if_var.h:977:6: note: 'ifq_init' declared here
void  ifq_init(struct ifaltq *, struct ifnet *ifp);
  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:1332:29: error: no member named 'ic_softc' in 'struct ieee80211com'
  struct iwn_softc *sc = ic->ic_softc;
  ~~  ^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:1341:63: error: too few arguments to function call, expected 8, have 7
  ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid);
  ~~~~~~~~~~~~~~~~~~~  ^
@/net80211/ieee80211_var.h:680:1: note: 'ieee80211_vap_setup' declared here
int  ieee80211_vap_setup(struct ieee80211com *, struct ieee80211vap *,
^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:1352:6: error: too many arguments to function call, expected 3, have 4
  mac);
  ^~~
@/net80211/ieee80211_var.h:685:1: note: 'ieee80211_vap_attach' declared here
int  ieee80211_vap_attach(struct ieee80211vap *,
^
/usr/src/sys/modules/iwn/../../dev/iwn/if_iwn.c:1374:14: error: implicit declaration of function 'mbufq_dequeue' is invalid in C99
  [-Werror,-Wimplicit-function-declaration]
  while ((m = mbufq_dequeue(&sc->sc_xmit_queue)) != NULL) {
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
*** Error code 1

Stop.
make: stopped in /usr/src/sys/modules/iwn

any idea?
 
Back
Top