Hi,

On Mon, 2009-03-02 at 15:55 +0100, ext Javier S. Pedro wrote:
> Long story short: I'm releasing under the GPL an alpha-quality icd
> network plugin which uses wpa_supplicant. Code is at
> http://svn.javispedro.com/libicd-network-wpa/trunk/ .

Great work! Thanks for the network module!

> - On link_up, it calls wlancond 'settings_and_connect' d-bus method to
> initialize the interface and enable powersaving features.
> - On post_link_up, it spawns wpa_supplicant, then uses settings from
> gconf to configure it via D-Bus, then waits for it to enter state
> "COMPLETED" (aka connected).
> - On pre_link_down, it kills wpa_supplicant.
> - On link_down, it calls wlancond's 'disconnect'.
> - If It gets a "DISCONNECTED" event from wpa_supplicant, It sets up a
> 100 second timeout. If wpa_supplicant goes up again (roaming?) then
> the timeout is removed. If it doesn't, then it tells icd to close the
> connection.

> - Does this design seem OK to you?

This looks 100% correct from an icd2 point of view.

One thing you should add to the code: if you already have a WLAN
connection ongoing and icd2 calls the link up function again, make the
module reply with the ICD_NW_TOO_MANY_CONNECTIONS icd network status in
the callback. This makes icd2 (the framework) figure out that this
particular network is limited to one connection at a time and it also
makes switching from one WLAN to another work correctly. The
ICD_NW_TOO_MANY_CONNECTIONS status must be returned by every network
module (layer) that supports only one connection at a time in order to
keep icd2 on track of things.

> - I've yet to come with the right "rssi -> signal" formula,

Maybe a linear conversion could be good enough for starters, e.g. full
10 with the lowest rssi that can use 54Mbit and 1 when the only option
is 1Mbit?

> and I'm
> having problems with the link_status callback. May I ask for better
> documentation on this?

This one?

typedef void (*icd_nw_link_stats_cb_fn) (const gpointer
link_stats_cb_token,
                                         const gchar *network_type,
                                         const guint network_attrs,
                                         const gchar *network_id,
                                         guint time_active,
                                         gint signal,
                                         gchar *station_id,
                                         gint dB,
                                         guint rx_bytes,
                                         guint tx_bytes);

The first gpointer and the 3 network_* parameters are the same as
received in the icd_nw_link_stats_fn. This of course assumes that the
network whose stats are queried is the one connected, but this is
handled by icd2 as long as the network module does not support more than
one connection at a time. The time_active you can set to zero, the ipv4
network module will handle it anyway. Signal is the rssi converted to
any of the ICD_NW_LEVEL_*, station id is the MAC address and dB the rssi
value. rx and tx bytes you can pass as zero, the ipv4 network module
provides them too. Unfortunately I feel like I'm repeating the .h file.
Please tell what more information you need.

> I also don't understand what search_lifetime
> and search_interval on network_api.h are for.

Search lifetime is the time in seconds the network is kept cached by
icd2, search interval is the time in seconds after which a new network
scan is to be triggered by icd2. With this setup not all networks need
to be found in every scan; this is especially true if search_lifetime =
2 * search_interval + the amount of seconds it takes to scan. icd2
checks that the search interval is less than the search lifetime when
loading your module.


HTH,

        Patrik

_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to