diff --git a/README.md b/README.md index 6f5ea91..6dee9b0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # FreeBSD net80211 template driver ## Introduction @@ -27,6 +28,17 @@ ifconfig wlan create wlandev i3e0 ## How to read +Like all drivers, this might come off like a wall of code with no context. +The order to read this code is: +1) `i3e_attach` - Executed after the device is identified by +the `probe` function. Note, because this driver is a software-only +implementation, not a real USB, PCI or SDIO driver. It should power on the device, read any hardcoded values (ie, device version, MAC address, etc) and enable the device accordingly. The end result will be the `i3e0` interface. + * Subfunction `i3e_getradiocaps` - Sets the device modes and frequencies. Technically this could be merged or inlined into `i3e_attach`, but keeping it a separate function is convention. +2) `i3e_parent`, `i3e_vap_create` and `i3e_init` - These three functions operate in tandem when creating the interface with `ifconfig wlan create wlandev i3e`. + * `i3e_vap_create` - This is executed when `wlan`, which is a virtual interface to connect to multiple nodes at once. + * `i3e_parent` - This function is executed when the device is set to `up` or `down`. It must be assigned in `i3e_attach`, such as `ic->ic_parent = i3e_parent`. If the device is off, it will run `i3e_init` and then start or stop all VAPs. + * `i3e_init` - This function turns the device on and starts reading or writing. + ### Explanation ## Source Files diff --git a/i3e_driver.c b/i3e_driver.c index a3f4164..f2db6a7 100644 --- a/i3e_driver.c +++ b/i3e_driver.c @@ -125,7 +125,6 @@ i3e_detach(struct i3e_softc *sc) static int i3e_init(struct i3e_softc *sc) { - printf("i3e_init\n"); sc->sc_running = 1; return (0); } @@ -456,21 +455,24 @@ i3e_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, } /* - * Set the device modes that the physical device is capable of doing + * Set the modes that the physical device is capable of. * The modes are enumerated in ieee80211_phymode (sys/net80211/_ieee80211.h) * * Simple example: zyd_getradiocaps */ static void -i3e_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans, struct ieee80211_channel chans[]) +i3e_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans, + struct ieee80211_channel chans[]) { uint8_t bands[IEEE80211_MODE_BYTES]; memset(bands, 0, sizeof(bands)); /* - * These are possible options that the device can physically module the signal and its associated frequency - * such as OFDM, CCK, GFSK, and 5GHz and 2GHz. - * The options are located in the enum ieee80211_phymode (sys/net80211/_ieee80211.h) + * These are possible options that the device can physically module the + * signal and its associated frequency such as OFDM, CCK, GFSK, and 5GHz + * and 2GHz. + * The options are located in the enum ieee80211_phymode + * (sys/net80211/_ieee80211.h): * - IEEE80211_MODE_AUTO * - IEEE80211_MODE_11A * - IEEE80211_MODE_11B