From 3674b8ab31a628c5d0834890ba3549bf8badf4ea Mon Sep 17 00:00:00 2001 From: Dedy Lansky Date: Fri, 11 Sep 2015 01:39:13 +0300 Subject: wifi: introduce wifi_fst module New wifi_fst module is responsible for: 1. insmod/rmmod of 2nd Wifi driver used for Fast Session Transfer (FST) rate upgrade. 2. start/stop FST Manager service. wifi_fst functionality is controlled by system property persist.fst.rate.upgrade.en. Existing module wifi.c calls into wifi_fst upon wifi_load/unload_driver and upon start/stop supplicant Change-Id: I8b4eddf26ab345b9e1e60e4850eaa081f8b89641 --- include/hardware_legacy/wifi.h | 14 ++++ include/hardware_legacy/wifi_fst.h | 136 ++++++++----------------------------- 2 files changed, 42 insertions(+), 108 deletions(-) (limited to 'include') diff --git a/include/hardware_legacy/wifi.h b/include/hardware_legacy/wifi.h index a60718d..e4aa93c 100644 --- a/include/hardware_legacy/wifi.h +++ b/include/hardware_legacy/wifi.h @@ -22,6 +22,20 @@ extern "C" { #endif /** + * Load kernel module + * + * @return 0 on success, < 0 on failure. + */ +int insmod(const char *filename, const char *args); + +/** +* Unload kernel module +* +* @return 0 on success, < 0 on failure. +*/ +int rmmod(const char *modname); + +/** * Load the Wi-Fi driver. * * @return 0 on success, < 0 on failure. diff --git a/include/hardware_legacy/wifi_fst.h b/include/hardware_legacy/wifi_fst.h index a60718d..952f132 100644 --- a/include/hardware_legacy/wifi_fst.h +++ b/include/hardware_legacy/wifi_fst.h @@ -1,4 +1,7 @@ /* + * Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Not a Contribution. * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,149 +17,66 @@ * limitations under the License. */ -#ifndef _WIFI_H -#define _WIFI_H +#ifndef _WIFI_FST_H +#define _WIFI_FST_H #if __cplusplus extern "C" { #endif /** - * Load the Wi-Fi driver. + * returns whether FST is enabled or not according to + * persist.fst.rate.upgrade.en system property * - * @return 0 on success, < 0 on failure. + * @return 1 if FST enabled. */ -int wifi_load_driver(); +int is_fst_enabled(); /** - * Unload the Wi-Fi driver. - * - * @return 0 on success, < 0 on failure. - */ -int wifi_unload_driver(); - -/** - * Check if the Wi-Fi driver is loaded. - * Check if the Wi-Fi driver is loaded. - - * @return 0 on success, < 0 on failure. - */ -int is_wifi_driver_loaded(); - +* returns whether FST Soft AP is enabled or not according to +* persist.fst.softap.en system property +* +* @return 1 if FST Soft AP enabled. +*/ +int is_fst_softap_enabled(); /** - * Start supplicant. + * Load the Wi-Fi driver for FST rate upgrade. * * @return 0 on success, < 0 on failure. */ -int wifi_start_supplicant(int p2pSupported); +int wifi_fst_load_driver(); /** - * Stop supplicant. + * Unload the Wi-Fi driver for FST rate upgrade. * * @return 0 on success, < 0 on failure. */ -int wifi_stop_supplicant(int p2pSupported); +int wifi_fst_unload_driver(); /** - * Open a connection to supplicant - * - * @return 0 on success, < 0 on failure. - */ -int wifi_connect_to_supplicant(); + * Check if the Wi-Fi driver for FST rate upgrade is loaded. -/** - * Close connection to supplicant - * * @return 0 on success, < 0 on failure. */ -void wifi_close_supplicant_connection(); - -/** - * wifi_wait_for_event() performs a blocking call to - * get a Wi-Fi event and returns a string representing - * a Wi-Fi event when it occurs. - * - * @param buf is the buffer that receives the event - * @param len is the maximum length of the buffer - * - * @returns number of bytes in buffer, 0 if no - * event (for instance, no connection), and less than 0 - * if there is an error. - */ -int wifi_wait_for_event(char *buf, size_t len); +int is_fst_driver_loaded(); /** - * wifi_command() issues a command to the Wi-Fi driver. + * Start FST Manager. * - * Android extends the standard commands listed at - * /link http://hostap.epitest.fi/wpa_supplicant/devel/ctrl_iface_page.html - * to include support for sending commands to the driver: - * - * See wifi/java/android/net/wifi/WifiNative.java for the details of - * driver commands that are supported - * - * @param command is the string command (preallocated with 32 bytes) - * @param commandlen is command buffer length - * @param reply is a buffer to receive a reply string - * @param reply_len on entry, this is the maximum length of - * the reply buffer. On exit, the number of - * bytes in the reply buffer. - * - * @return 0 if successful, < 0 if an error. + * @return 0 on success, < 0 on failure. */ -int wifi_command(const char *command, char *reply, size_t *reply_len); +int wifi_start_fstman(int softap_mode); /** - * do_dhcp_request() issues a dhcp request and returns the acquired - * information. - * - * All IPV4 addresses/mask are in network byte order. - * - * @param ipaddr return the assigned IPV4 address - * @param gateway return the gateway being used - * @param mask return the IPV4 mask - * @param dns1 return the IPV4 address of a DNS server - * @param dns2 return the IPV4 address of a DNS server - * @param server return the IPV4 address of DHCP server - * @param lease return the length of lease in seconds. + * Stop FST Manager. * - * @return 0 if successful, < 0 if error. - */ -int do_dhcp_request(int *ipaddr, int *gateway, int *mask, - int *dns1, int *dns2, int *server, int *lease); - -/** - * Return the error string of the last do_dhcp_request(). - */ -const char *get_dhcp_error_string(); - -/** - * Return the path to requested firmware - */ -#define WIFI_GET_FW_PATH_STA 0 -#define WIFI_GET_FW_PATH_AP 1 -#define WIFI_GET_FW_PATH_P2P 2 -const char *wifi_get_fw_path(int fw_type); - -/** - * Change the path to firmware for the wlan driver - */ -int wifi_change_fw_path(const char *fwpath); - -/** - * Check and create if necessary initial entropy file + * @return 0 on success, < 0 on failure. */ -#define WIFI_ENTROPY_FILE "/data/misc/wifi/entropy.bin" -int ensure_entropy_file_exists(); - -/** -* Check and create if necessary the desired configuration file -*/ -int ensure_config_file_exists(const char *config_file, const char *config_file_template); +int wifi_stop_fstman(int softap_mode); #if __cplusplus }; // extern "C" #endif -#endif // _WIFI_H +#endif // _WIFI_FST_H -- cgit v1.1