Create DBus getter/setter for ScanInterval
Enable control of wpa_s->scan_interval via D-Bus. This parameter controls the delay between successive scans for a suitable AP. Also, update dbus.doxygen with ScanInterval, and some other parameters that were undocumented. Signed-hostap: Mukesh Agrawal <quiche@chromium.org>
This commit is contained in:
parent
ca8e039fec
commit
c6e86b63d2
7 changed files with 113 additions and 4 deletions
|
@ -351,6 +351,21 @@ fi.w1.wpa_supplicant1.CreateInterface.
|
||||||
<p>Identical to ap_scan entry in %wpa_supplicant configuration file. Possible values are 0, 1 or 2.</p>
|
<p>Identical to ap_scan entry in %wpa_supplicant configuration file. Possible values are 0, 1 or 2.</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h3>BSSExpireAge - u - (read/write)</h3>
|
||||||
|
<p>Identical to bss_expiration_age entry in %wpa_supplicant configuration file.</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h3>BSSExpireCount - u - (read/write)</h3>
|
||||||
|
<p>Identical to bss_expiration_scan_count entry in %wpa_supplicant configuration file.</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h3>Country - s - (read/write)</h3>
|
||||||
|
<p>Identical to country entry in %wpa_supplicant configuration file.</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<h3>Ifname - s - (read)</h3>
|
<h3>Ifname - s - (read)</h3>
|
||||||
<p>Name of network interface controlled by the interface, e.g., wlan0.</p>
|
<p>Name of network interface controlled by the interface, e.g., wlan0.</p>
|
||||||
|
@ -390,6 +405,16 @@ fi.w1.wpa_supplicant1.CreateInterface.
|
||||||
<h3>Networks - ao - (read)</h3>
|
<h3>Networks - ao - (read)</h3>
|
||||||
<p>List of D-Bus objects paths representing configured networks.</p>
|
<p>List of D-Bus objects paths representing configured networks.</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h3>FastReauth - b - (read/write)</h3>
|
||||||
|
<p>Identical to fast_reauth entry in %wpa_supplicant configuration file.</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h3>ScanInterval - i - (read/write)</h3>
|
||||||
|
<p>Time (in seconds) between scans for a suitable AP. Must be >= 0.</p>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
\subsection dbus_interface_signals Signals
|
\subsection dbus_interface_signals Signals
|
||||||
|
|
|
@ -2581,10 +2581,7 @@ static int wpa_supplicant_ctrl_iface_scan_interval(
|
||||||
struct wpa_supplicant *wpa_s, char *cmd)
|
struct wpa_supplicant *wpa_s, char *cmd)
|
||||||
{
|
{
|
||||||
int scan_int = atoi(cmd);
|
int scan_int = atoi(cmd);
|
||||||
if (scan_int < 0)
|
return wpa_supplicant_set_scan_interval(wpa_s, scan_int);
|
||||||
return -1;
|
|
||||||
wpa_s->scan_interval = scan_int;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2559,6 +2559,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
|
||||||
wpas_dbus_getter_fast_reauth,
|
wpas_dbus_getter_fast_reauth,
|
||||||
wpas_dbus_setter_fast_reauth
|
wpas_dbus_setter_fast_reauth
|
||||||
},
|
},
|
||||||
|
{ "ScanInterval", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
|
||||||
|
wpas_dbus_getter_scan_interval,
|
||||||
|
wpas_dbus_setter_scan_interval
|
||||||
|
},
|
||||||
#ifdef CONFIG_WPS
|
#ifdef CONFIG_WPS
|
||||||
{ "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b",
|
{ "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b",
|
||||||
wpas_dbus_getter_process_credentials,
|
wpas_dbus_getter_process_credentials,
|
||||||
|
|
|
@ -2461,6 +2461,56 @@ dbus_bool_t wpas_dbus_setter_country(DBusMessageIter *iter, DBusError *error,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpas_dbus_getter_scan_interval - Get scan interval
|
||||||
|
* @iter: Pointer to incoming dbus message iter
|
||||||
|
* @error: Location to store error on failure
|
||||||
|
* @user_data: Function specific data
|
||||||
|
* Returns: TRUE on success, FALSE on failure
|
||||||
|
*
|
||||||
|
* Getter function for "ScanInterval" property.
|
||||||
|
*/
|
||||||
|
dbus_bool_t wpas_dbus_getter_scan_interval(DBusMessageIter *iter,
|
||||||
|
DBusError *error,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct wpa_supplicant *wpa_s = user_data;
|
||||||
|
dbus_int32_t scan_interval = wpa_s->scan_interval;
|
||||||
|
|
||||||
|
return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT32,
|
||||||
|
&scan_interval, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpas_dbus_setter_scan_interval - Control scan interval
|
||||||
|
* @iter: Pointer to incoming dbus message iter
|
||||||
|
* @error: Location to store error on failure
|
||||||
|
* @user_data: Function specific data
|
||||||
|
* Returns: TRUE on success, FALSE on failure
|
||||||
|
*
|
||||||
|
* Setter function for "ScanInterval" property.
|
||||||
|
*/
|
||||||
|
dbus_bool_t wpas_dbus_setter_scan_interval(DBusMessageIter *iter,
|
||||||
|
DBusError *error,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct wpa_supplicant *wpa_s = user_data;
|
||||||
|
dbus_int32_t scan_interval;
|
||||||
|
|
||||||
|
if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_INT32,
|
||||||
|
&scan_interval))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (wpa_supplicant_set_scan_interval(wpa_s, scan_interval)) {
|
||||||
|
dbus_set_error_const(error, DBUS_ERROR_FAILED,
|
||||||
|
"scan_interval must be >= 0");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpas_dbus_getter_ifname - Get interface name
|
* wpas_dbus_getter_ifname - Get interface name
|
||||||
* @iter: Pointer to incoming dbus message iter
|
* @iter: Pointer to incoming dbus message iter
|
||||||
|
|
|
@ -168,6 +168,14 @@ dbus_bool_t wpas_dbus_getter_country(DBusMessageIter *iter, DBusError *error,
|
||||||
dbus_bool_t wpas_dbus_setter_country(DBusMessageIter *iter, DBusError *error,
|
dbus_bool_t wpas_dbus_setter_country(DBusMessageIter *iter, DBusError *error,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
dbus_bool_t wpas_dbus_getter_scan_interval(DBusMessageIter *iter,
|
||||||
|
DBusError *error,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
|
dbus_bool_t wpas_dbus_setter_scan_interval(DBusMessageIter *iter,
|
||||||
|
DBusError *error,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
dbus_bool_t wpas_dbus_getter_ifname(DBusMessageIter *iter, DBusError *error,
|
dbus_bool_t wpas_dbus_getter_ifname(DBusMessageIter *iter, DBusError *error,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
|
|
@ -1782,6 +1782,29 @@ int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpa_supplicant_set_scan_interval - Set scan interval
|
||||||
|
* @wpa_s: wpa_supplicant structure for a network interface
|
||||||
|
* @scan_interval: scan interval in seconds
|
||||||
|
* Returns: 0 if succeed or -1 if scan_interval has an invalid value
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
|
||||||
|
int scan_interval)
|
||||||
|
{
|
||||||
|
if (scan_interval < 0) {
|
||||||
|
wpa_msg(wpa_s, MSG_ERROR, "Invalid scan interval %d",
|
||||||
|
scan_interval);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
wpa_msg(wpa_s, MSG_DEBUG, "Setting scan interval: %d sec",
|
||||||
|
scan_interval);
|
||||||
|
wpa_s->scan_interval = scan_interval;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpa_supplicant_set_debug_params - Set global debug params
|
* wpa_supplicant_set_debug_params - Set global debug params
|
||||||
* @global: wpa_global structure
|
* @global: wpa_global structure
|
||||||
|
|
|
@ -588,6 +588,8 @@ int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
|
||||||
unsigned int expire_age);
|
unsigned int expire_age);
|
||||||
int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
|
int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
|
||||||
unsigned int expire_count);
|
unsigned int expire_count);
|
||||||
|
int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
|
||||||
|
int scan_interval);
|
||||||
int wpa_supplicant_set_debug_params(struct wpa_global *global,
|
int wpa_supplicant_set_debug_params(struct wpa_global *global,
|
||||||
int debug_level, int debug_timestamp,
|
int debug_level, int debug_timestamp,
|
||||||
int debug_show_keys);
|
int debug_show_keys);
|
||||||
|
|
Loading…
Reference in a new issue