From 282a0b35b8cad48ddaa246af597e2f1d94b01a4a Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 8 Dec 2016 11:08:14 -0800 Subject: [PATCH 1/3] supplicant(interface): Minor fixes in P2P iface Fixing couple of issues found in the interface during implementation. 1. WpsProvisionMethod::KEYPAD is not used in wpa_supplicant core. It is only used inside Android framework. So, remove them. 2. Added |setDisallowedFrequencies| method. 3. Changed the pin type to string from vector of bytes because that is used by Android framework and wpa_supplicant. Bug: 31497295 Test: Compiles Change-Id: I69db530e23c2d3af907c3a5c824cf8291cf12c35 --- wifi/supplicant/1.0/ISupplicantP2pIface.hal | 44 ++++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/wifi/supplicant/1.0/ISupplicantP2pIface.hal b/wifi/supplicant/1.0/ISupplicantP2pIface.hal index 48a4f5b41d..0cdac2dce2 100644 --- a/wifi/supplicant/1.0/ISupplicantP2pIface.hal +++ b/wifi/supplicant/1.0/ISupplicantP2pIface.hal @@ -37,11 +37,7 @@ interface ISupplicantP2pIface extends ISupplicantIface { /** * Keypad pin method configuration - pin is entered on device. */ - KEYPAD, - /** - * Label pin method configuration - pin is labelled on device. - */ - LABEL + KEYPAD }; enum GroupCapabilityMask : uint32_t { @@ -54,6 +50,15 @@ interface ISupplicantP2pIface extends ISupplicantIface { GROUP_FORMATION = 1 << 6 }; + /** + * Use to specify a range of frequencies. + * For example: 2412-2432,2462,5000-6000, etc. + */ + struct FreqRange { + uint32_t min; + uint32_t max; + }; + /** * Register for callbacks from this interface. * @@ -97,7 +102,7 @@ interface ISupplicantP2pIface extends ISupplicantIface { * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_IFACE_INVALID| */ - setSsidPostfix(string postfix) generates (SupplicantStatus status); + setSsidPostfix(vec postfix) generates (SupplicantStatus status); /** * Set the Maximum idle time in seconds for P2P groups. @@ -106,6 +111,7 @@ interface ISupplicantP2pIface extends ISupplicantIface { * associated stations in the group. As a P2P client, this means no * group owner seen in scan results. * + * @param groupIfName Group interface name to use. * @param timeoutInSec Timeout value in seconds. * @return status Status of the operation. * Possible status codes: @@ -113,11 +119,13 @@ interface ISupplicantP2pIface extends ISupplicantIface { * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_IFACE_INVALID| */ - setGroupIdle(uint32_t timeoutInSec) generates (SupplicantStatus status); + setGroupIdle(string groupIfName, uint32_t timeoutInSec) + generates (SupplicantStatus status); /** * Turn on/off power save mode for the interface. * + * @param groupIfName Group interface name to use. * @param enable Indicate if power save is to be turned on/off. * @return status Status of the operation. * Possible status codes: @@ -126,7 +134,8 @@ interface ISupplicantP2pIface extends ISupplicantIface { * |SupplicantStatusCode.FAILURE_IFACE_INVALID|, * |SupplicantStatusCode.FAILURE_IFACE_DISABLED| */ - setPowerSave(bool enable) generates (SupplicantStatus status); + setPowerSave(string groupIfName, bool enable) + generates (SupplicantStatus status); /** * Initiate a P2P service discovery with an optional timeout. @@ -192,11 +201,11 @@ interface ISupplicantP2pIface extends ISupplicantIface { */ connect(MacAddress peerAddress, WpsProvisionMethod provisionMethod, - vec preSelectedPin, + string preSelectedPin, bool joinExistingGroup, bool persistent, uint32_t goIntent) - generates (SupplicantStatus status, vec generatedPin); + generates (SupplicantStatus status, string generatedPin); /** * Cancel an ongoing P2P group formation and joining-a-group related @@ -357,6 +366,21 @@ interface ISupplicantP2pIface extends ISupplicantIface { setListenChannel(uint32_t channel, uint32_t operatingClass) generates (SupplicantStatus status); + /** + * Set P2P disallowed frequency ranges. + * + * Specify ranges of frequencies that are disallowed for any p2p operations. + + * @param ranges List of ranges which needs to be disallowed. + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + */ + setDisallowedFrequencies(vec ranges) + generates (SupplicantStatus status); + /** * Gets the operational SSID of the device. * From e3f25f1d0fbcb0d9e62d321db9625e56cddc7be5 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 8 Dec 2016 13:20:05 -0800 Subject: [PATCH 2/3] supplicant(interface): Correct ANQP enum value/type Correct the HS20 subtype & Anqp Info ID enum value/type to match what is used in wpa_supplicant core. Bug: 33493298 Test: Compiles Change-Id: I5b25d334271c39d977e2990c643f4a2b01872f1a --- wifi/supplicant/1.0/ISupplicantStaIface.hal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/supplicant/1.0/ISupplicantStaIface.hal b/wifi/supplicant/1.0/ISupplicantStaIface.hal index 868758ec9d..31706cd610 100644 --- a/wifi/supplicant/1.0/ISupplicantStaIface.hal +++ b/wifi/supplicant/1.0/ISupplicantStaIface.hal @@ -28,7 +28,7 @@ interface ISupplicantStaIface extends ISupplicantIface { * Access Network Query Protocol info ID elements * for IEEE Std 802.11u-2011. */ - enum AnqpInfoId : uint32_t { + enum AnqpInfoId : uint16_t { VENUE_NAME = 258, ROAMING_CONSORTIUM = 261, IP_ADDR_TYPE_AVAILABILITY = 262, @@ -42,7 +42,7 @@ interface ISupplicantStaIface extends ISupplicantIface { * for Hotspot 2.0. */ enum Hs20AnqpSubtypes : uint32_t { - OPERATOR_FRIENDLY_NAME = 2, + OPERATOR_FRIENDLY_NAME = 3, WAN_METRICS = 4, CONNECTION_CAPABILITY = 5, OSU_PROVIDERS_LIST = 8, From 073d5b9fdc67bc3ffda7fa3b895d7a51497ab2d0 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 8 Dec 2016 19:10:06 -0800 Subject: [PATCH 3/3] wifi: Disallow iface creation based on mode Based on the mode configured, limit the iface creation. Note: Support for iface removal will be added in a follow up CL which should help us use P2P or NAN iface dynamically. Bug: 31997422 Test: Compiles Change-Id: Idde2f3b749264d542d5d6608b0b2c5aa8103ade6 --- wifi/1.0/default/wifi_chip.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp index 4f3c192c1a..af194912a3 100644 --- a/wifi/1.0/default/wifi_chip.cpp +++ b/wifi/1.0/default/wifi_chip.cpp @@ -465,7 +465,9 @@ WifiChip::requestFirmwareDebugDumpInternal() { } std::pair> WifiChip::createApIfaceInternal() { - // TODO(b/31997422): Disallow this based on the chip combination. + if (current_mode_id_ != kApChipModeId || ap_iface_.get()) { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + } std::string ifname = legacy_hal_.lock()->getApIfaceName(); ap_iface_ = new WifiApIface(ifname, legacy_hal_); return {createWifiStatus(WifiStatusCode::SUCCESS), ap_iface_}; @@ -490,7 +492,11 @@ std::pair> WifiChip::getApIfaceInternal( } std::pair> WifiChip::createNanIfaceInternal() { - // TODO(b/31997422): Disallow this based on the chip combination. + // Only 1 of NAN or P2P iface can be active at a time. + if (current_mode_id_ != kStaChipModeId || nan_iface_.get() || + p2p_iface_.get()) { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + } std::string ifname = legacy_hal_.lock()->getNanIfaceName(); nan_iface_ = new WifiNanIface(ifname, legacy_hal_); return {createWifiStatus(WifiStatusCode::SUCCESS), nan_iface_}; @@ -515,7 +521,11 @@ std::pair> WifiChip::getNanIfaceInternal( } std::pair> WifiChip::createP2pIfaceInternal() { - // TODO(b/31997422): Disallow this based on the chip combination. + // Only 1 of NAN or P2P iface can be active at a time. + if (current_mode_id_ != kStaChipModeId || p2p_iface_.get() || + nan_iface_.get()) { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + } std::string ifname = legacy_hal_.lock()->getP2pIfaceName(); p2p_iface_ = new WifiP2pIface(ifname, legacy_hal_); return {createWifiStatus(WifiStatusCode::SUCCESS), p2p_iface_}; @@ -540,7 +550,9 @@ std::pair> WifiChip::getP2pIfaceInternal( } std::pair> WifiChip::createStaIfaceInternal() { - // TODO(b/31997422): Disallow this based on the chip combination. + if (current_mode_id_ != kStaChipModeId || sta_iface_.get()) { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + } std::string ifname = legacy_hal_.lock()->getStaIfaceName(); sta_iface_ = new WifiStaIface(ifname, legacy_hal_); return {createWifiStatus(WifiStatusCode::SUCCESS), sta_iface_};