ap6212 softap support

This commit is contained in:
August 2018-08-10 14:17:52 +08:00
parent 73a04365cb
commit 6e8b520dcb
7 changed files with 13 additions and 10 deletions

View file

@ -44,8 +44,8 @@ bool DriverTool::TakeOwnershipOfFirmwareReload() {
return true; return true;
} }
bool DriverTool::LoadDriver() { bool DriverTool::LoadDriver(int mode) {
return ::wifi_load_driver() == 0; return ::wifi_load_driver(mode) == 0;
} }
bool DriverTool::UnloadDriver() { bool DriverTool::UnloadDriver() {

View file

@ -27,7 +27,7 @@ extern "C"
* *
* @return 0 on success, < 0 on failure. * @return 0 on success, < 0 on failure.
*/ */
int wifi_load_driver(); int wifi_load_driver(int mode);
/** /**
* Unload the Wi-Fi driver. * Unload the Wi-Fi driver.

View file

@ -36,7 +36,7 @@ class DriverTool {
// These methods allow manipulation of the WiFi driver. // These methods allow manipulation of the WiFi driver.
// They all return true on success, and false otherwise. // They all return true on success, and false otherwise.
virtual bool LoadDriver(); virtual bool LoadDriver(int mode);
virtual bool UnloadDriver(); virtual bool UnloadDriver();
virtual bool IsDriverLoaded(); virtual bool IsDriverLoaded();

View file

@ -140,7 +140,7 @@ int is_wifi_driver_loaded(const char* wifi_driver_name) {
#endif #endif
} }
int wifi_load_driver() { int wifi_load_driver(int mode) {
#ifdef WIFI_DRIVER_MODULE_PATH #ifdef WIFI_DRIVER_MODULE_PATH
char module_path[128] = {0}; char module_path[128] = {0};
char module_arg[128] = {0}; char module_arg[128] = {0};
@ -149,7 +149,7 @@ int wifi_load_driver() {
return 0; return 0;
} }
LOG(ERROR) << "wifi_load_driver: Start to insmod " << wifi_driver_name << ".ko"; LOG(ERROR) << "wifi_load_driver: Start to insmod " << wifi_driver_name << ".ko";
get_driver_module_arg(module_arg); get_driver_module_arg(module_arg, mode);
LOG(ERROR) << "module_arg= " << module_arg; LOG(ERROR) << "module_arg= " << module_arg;
if (!strstr(WIFI_DRIVER_MODULE_PATH, ".ko")) { if (!strstr(WIFI_DRIVER_MODULE_PATH, ".ko")) {
snprintf(module_path, sizeof(module_path), "%s%s.ko", WIFI_DRIVER_MODULE_PATH, wifi_driver_name); snprintf(module_path, sizeof(module_path), "%s%s.ko", WIFI_DRIVER_MODULE_PATH, wifi_driver_name);

View file

@ -60,7 +60,7 @@ bool WifiModeController::isFirmwareModeChangeNeeded(IfaceType type) {
} }
bool WifiModeController::changeFirmwareMode(IfaceType type) { bool WifiModeController::changeFirmwareMode(IfaceType type) {
if (!driver_tool_->LoadDriver()) { if (!driver_tool_->LoadDriver(convertIfaceTypeToFirmwareMode(type))) {
LOG(ERROR) << "Failed to load WiFi driver"; LOG(ERROR) << "Failed to load WiFi driver";
return false; return false;
} }

View file

@ -27,7 +27,7 @@ const char *get_wifi_driver_name();
const char *get_fw_path_sta(); const char *get_fw_path_sta();
const char *get_fw_path_ap(); const char *get_fw_path_ap();
const char *get_fw_path_p2p(); const char *get_fw_path_p2p();
void get_driver_module_arg(char* arg); void get_driver_module_arg(char* arg, int mode);
const char *get_supplicant_para(int set_p2p_supported); const char *get_supplicant_para(int set_p2p_supported);
#if __cplusplus #if __cplusplus

View file

@ -705,18 +705,21 @@ const char *get_fw_path_p2p()
return selected_wifi.fw_path_p2p; return selected_wifi.fw_path_p2p;
} }
void get_driver_module_arg(char* arg) void get_driver_module_arg(char* arg, int mode)
{ {
char module_arg[256] = {0}; char module_arg[256] = {0};
const char *vendor_name = get_wifi_vendor_name(); const char *vendor_name = get_wifi_vendor_name();
ALOGE("get_driver_module_arg mode=%d", mode);
if(strcmp(vendor_name, "realtek") == 0) { if(strcmp(vendor_name, "realtek") == 0) {
const char *driver_module_arg = "ifname=wlan0 if2name=p2p0"; const char *driver_module_arg = "ifname=wlan0 if2name=p2p0";
snprintf(module_arg, sizeof(module_arg), "%s", driver_module_arg); snprintf(module_arg, sizeof(module_arg), "%s", driver_module_arg);
} else if(strcmp(vendor_name, "broadcom") == 0) { } else if(strcmp(vendor_name, "broadcom") == 0) {
const char *nvram_path = "nvram_path=/system/vendor/modules/nvram"; const char *nvram_path = "nvram_path=/system/vendor/modules/nvram";
const char *config_path = "config_path=/system/vendor/modules/config"; const char *config_path = "config_path=/system/vendor/modules/config";
snprintf(module_arg, sizeof(module_arg), "%s_%s.txt %s_%s.txt", snprintf(module_arg, sizeof(module_arg), "%s %s_%s.txt %s_%s.txt",
(mode == 1) ? "op_mode=2" : "",
nvram_path, get_wifi_module_name(), config_path, get_wifi_module_name()); nvram_path, get_wifi_module_name(), config_path, get_wifi_module_name());
}else if(strcmp(get_wifi_vendor_name(), "xradio") == 0) { }else if(strcmp(get_wifi_vendor_name(), "xradio") == 0) {
const char *driver_module_arg = ""; const char *driver_module_arg = "";