WiFi stack prototype works

Blog post by ColinG on Sun, 2009-07-12 08:44
Screenshot of working WiFi prototypeScreenshot of working WiFi prototype Today I fiddled out the last hurdle on getting my WiFi-card up and running. It only connects to unprotected open wireless LANs, because there is no configuring mechanism implemented yet. Though it is far away from completeness.

On the screenshot, you see Firefox surfing www.haiku-os.org and downloading a 100 MiB file from my ftp server in parallel. The terminal is showing the result of the ifconfig command for my WiFi-card.

I managed to port the FreeBSD WiFi-stack, utilizing Haiku's FreeBSD compatibility layer. Thus I could use the WiFi-card driver for my atheros chipset from FreeBSD without any major changes to its codebase (I had to move some interrupt handler code into driver-specific glue code).

The driver-binary has a size of 500 KiB, due to compiling the WiFi-stack into a static library and statically linking it and the FreeBSD compat layer with the driver. Update: The sources are up in the haiku-wifi repository on www.osdrawer.net (read "For the bravery" down the line for more info on how to get it).

The atheros driver should support every atheros chipset, which are supported by the FreeBSD driver (look in the corresponding FreeBSD manpage for more information on supported chipsets).

Designing a Haiku specific WiFi-stack will be my next step.

For the brave only: The source can be checked out via svn checkout http://svn.osdrawer.net/haiku-wifi/prototype/trunk/wifi. I recommend the 3rdparty subdirectory as checkout location, because the Jamfiles expect themselves there. With jam ath everything needed (customized FreeBSD compat layer, WiFi stack, atheros driver) gets built.

Update: For developing I used a gcc2 build environment and Haiku rev. 31286 was the newest I tested it on.

There are no settings to set to make this driver work. Just put the driver in /home/config/add-ons/kernel/drivers/bin and make a symlink to /home/config/add-ons/kernel/drivers/dev/net/ath. A reboot could be required to make Haiku recognize the new driver.

To check whether your atheros card gets at least detected by this driver, watch the debug messages during the bootphase or look into the /boot/var/log/syslog file. If you see something like

Adding entry for IEEE 802.11 Wireless Ethernet mode autoselect autoselect
Adding entry for IEEE 802.11 Wireless Ethernet mode autoselect autoselect <adhoc>
Adding entry for IEEE 802.11 Wireless Ethernet mode autoselect autoselect <hostap>
Adding entry for IEEE 802.11 Wireless Ethernet mode autoselect autoselect <flag0,adhoc>
Adding entry for IEEE 802.11 Wireless Ethernet mode autoselect autoselect <monitor>
you know that your card is detected

Update2: To connect to a WLAN make sure that it is an unprotected (no WPE, WPA, WPA2) one that doesn't need a password for login. On my Fritz!Box this is called "unverschl├╝sselten Zugang aktivieren" (activate unencrypted access).

For more information on technical aspects of the hardware I use surf to the bounty proposal on haikuware and select the "Technical Information" tab.

I will give no support for this prototype 'cuz it is a prototype ;-). It is intended for the purpose of gaining knowledge, only.

Comments

Re: WiFi stack prototype works

wow this is good news! i've been waiting for this a long time:) good job!

Re: WiFi stack prototype works

Colin, how exciting it is to see you making every step towards a milestone achievement in Haiku!

Re: WiFi stack prototype works

Really cool, nice work.

Re: WiFi stack prototype works

This is of course: AWESOME!

I might give it a try on my Acer Aspire One - which also has Atheros wifi.

I'd love to demo this at OSCON on July 22-23, and OpenSourceWorld in August :)

- Urias

Re: WiFi stack prototype works

umccullough wrote:

This is of course: AWESOME!

I might give it a try on my Acer Aspire One - which also has Atheros wifi.

I'd love to demo this at OSCON on July 22-23, and OpenSourceWorld in August :)

- Urias

I don't have a open wlan (perhaps I would open one up) but do tell if it works, I have a ONE as well.

Update:
It was easy to build (under Zeta anyway) harder to find :)
look under generated/objects/haiku/x86/release/wifi/ath

Update2:
But no luck in getting it to work in my Aspire One, perhaps some setting I'm missing that I need to set?

Update3:
I'm getting a Error, can't load HAL 13(somting like that). Looking at some FreeBSD pages it look that the aspire one need some HAL updates.
http://forums.freebsd.org/showpost.php?s=b6faf0e06422e83efc0101af8652e52...
http://forums.freebsd.org/showthread.php?t=382

Re: WiFi stack prototype works

Congrats Colin! Nice to see this progressing :)

Quote:

Designing a Haiku specific WiFi-stack will be my next step.

Will the native stack still retain FreeBSD's driver compatibility?

Re: WiFi stack prototype works

kvdman wrote:

Will the native stack still retain FreeBSD's driver compatibility?

Yes, it will gain this compatibility by using a translation module. You can look at the drawing on my blog to see how I'm planning to realize it ;-)

Re: WiFi stack prototype works

Quote:

The sources are up in the repository.

Just a note: You might want to clarify that this is the OSDrawer repository, and maybe provide a link. I'd hate to have people thinking this is all in the Haiku repo already ;)

Re: WiFi stack prototype works

"Designing a Haiku specific WiFi-stack will be my next step."

Im looking forward it.

Congrats for this first step.

Please let us know as soon as you get wpa and wpa2, im going to be your beta tester.

Re: WiFi stack prototype works

Quote:

Please let us know as soon as you get wpa and wpa2, im going to be your beta tester.

This wasn't part of the bounty's guidelines, although is mentioned under 'beyond this bounty' under the technical information tab here:

http://www.haikuware.com/wireless-network-stack-bounty

Re: WiFi stack prototype works

Nice work ... I'll have to try this with my MSI Wind U100.

Re: WiFi stack prototype works

Sikosis wrote:

Nice work ... I'll have to try this with my MSI Wind U100.

I take it you're like me and replaced the stock Realtek with an Atheros card? That said, I'm yet to get this to work just yet, as it's not quite as straight-forward given my building environment. It also requires some fixing (inline asm and -Werror issues) if one tries to build it under GCC4.

In any case, I