]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
D-Bus: Add 'freq' option to P2P Find method to specify starting channel
authorAmit Purwar <amit.purwar@samsung.com>
Mon, 19 Dec 2016 10:12:30 +0000 (15:42 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 19 Dec 2016 11:09:31 +0000 (13:09 +0200)
This allows user to start P2P Find/Scan on a particular frequency and
then move to scanning social channels. This support is already present
on control socket.

Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
doc/dbus.doxygen
wpa_supplicant/dbus/dbus_new_handlers_p2p.c

index b0e67d45b0376d875824d61bfddbc6c483eb58fc..f3bdb20cc35b21c03217b41462739ea8a0cde691 100644 (file)
@@ -1297,6 +1297,7 @@ Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations.
        <tr><td>Timeout</td><td>i</td><td>Timeout for operating in seconds</td><td>no</td></tr>
        <tr><td>RequestedDeviceTypes</td><td>aay</td><td>WPS Device Types to search for</td><td>no</td></tr>
        <tr><td>DiscoveryType</td><td>s</td><td>"start_with_full" (default, if not specified), "social", "progressive"</td><td>no</td></tr>
+       <tr><td>freq</td><td>i</td><td>Initial scan channel (frequency in MHz) for the start_with_full case to limit the initial scan to the specified channel</td><td>no</td></tr>
        </table>
       </dd>
     </dl>
index f50420b1a6997610b347312ce240348a8f9d8b66..4c91ee58f09a13f9d04bedf93ba7ffce52bcc782 100644 (file)
@@ -90,6 +90,7 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message,
        int num_req_dev_types = 0;
        unsigned int i;
        u8 *req_dev_types = NULL;
+       unsigned int freq = 0;
 
        dbus_message_iter_init(message, &iter);
        entry.key = NULL;
@@ -134,6 +135,10 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message,
                                type = P2P_FIND_PROGRESSIVE;
                        else
                                goto error_clear;
+               } else if (os_strcmp(entry.key, "freq") == 0 &&
+                          (entry.type == DBUS_TYPE_INT32 ||
+                           entry.type == DBUS_TYPE_UINT32)) {
+                       freq = entry.uint32_value;
                } else
                        goto error_clear;
                wpa_dbus_dict_entry_clear(&entry);
@@ -142,7 +147,7 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message,
        wpa_s = wpa_s->global->p2p_init_wpa_s;
 
        wpas_p2p_find(wpa_s, timeout, type, num_req_dev_types, req_dev_types,
-                     NULL, 0, 0, NULL, 0);
+                     NULL, 0, 0, NULL, freq);
        os_free(req_dev_types);
        return reply;