David Warren | 5f6ca4f | 2009-04-30 17:11:58 -0700 | [diff] [blame] | 1 | page.title=Wi-Fi |
| 2 | pdk.version=1.0 |
| 3 | @jd:body |
| 4 | |
| 5 | <a name="toc"/> |
| 6 | <div style="padding:10px"> |
| 7 | <a href="#androidWifiIntroduction">Introduction</a><br/> |
| 8 | <a href="#androidWifiBuildingDriver">Building a Wi-Fi Library</a><br/> |
| 9 | <a href="#androidWifiInterface">Interface</a><br/></div> |
| 10 | |
| 11 | <a name="androidWifiIntroduction"></a><h2>Introduction</h2> |
| 12 | |
| 13 | <p>Android uses wpa_supplicant as the platform interface to the Wi-Fi device. Your Wi-Fi driver must be compatible with the standard wpa_supplicant in addition to extensions added to the supplicant (specifically, the "DRIVER" commands described in <code>wifi.h/wifi_command()</code>).</p> |
| 14 | |
| 15 | |
| 16 | <a name="androidWifiBuildingDriver"></a><h2>Building a Wi-Fi Library</h2> |
| 17 | |
| 18 | <p>To create a Wi-Fi driver for Android:</p> |
| 19 | <p><ul> |
| 20 | <li>create a shared library that implements the interface defined in <code>include/hardware/wifi.h</code>, which also defines the Wi-Fi supplicant.</li> |
| 21 | <li>Follow the instructions posted at <a href="http://hostap.epitest.fi/wpa_supplicant/">http://hostap.epitest.fi/wpa_supplicant/</a>.</li> |
| 22 | <li>Place your driver in <code>libs/hardware/wifi/</code></li> |
| 23 | <li>Test your driver using the command line <code>wpa_cli</code> utilities.</li> |
| 24 | </ul> |
| 25 | |
| 26 | <p>You can find the default implementation in <code>libs/hardware/wifi/wifi.c</code>. If you need to make changes, create a new source file similar to <code>wifi.c</code>, for example, <code>wifi_mywifi.c</code>. </p> |
| 27 | |
| 28 | <p>Update the default <code>Android.mk</code> file (<code>libs/hardware/wifi/Android.mk</code>) as shown below.</p> |
| 29 | <pre class="prettify"> |
| 30 | LOCAL_SHARED_LIBRARIES += libnetutils |
| 31 | |
| 32 | ifeq ($(TARGET_PRODUCT),acme) |
| 33 | LOCAL_SRC_FILES += wifi/wifi_mywifi.c |
| 34 | else |
| 35 | LOCAL_SRC_FILES += wifi/wifi.c |
| 36 | endif |
| 37 | </pre> |
| 38 | |
| 39 | |
| 40 | <a name="androidWifiInterface"></a><h2>Interface</h2> |
| 41 | |
| 42 | |
| 43 | |
| 44 | <p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="wifi.html">click here</a>.</p> |
| 45 | |
| 46 | |
| 47 | <iframe onLoad="resizeDoxFrameHeight();" src="wifi_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe> |