Split up wifi networking code - move it into separate file (#13262)

This commit is contained in:
Autechre 2021-11-21 12:37:39 +01:00 committed by GitHub
parent ed437fdd8e
commit 71b30d7846
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 473 additions and 356 deletions

View file

@ -783,12 +783,14 @@ ifeq ($(HAVE_BLUETOOTH), 1)
endif
ifeq ($(HAVE_LAKKA), 1)
OBJ += wifi/drivers/connmanctl.o
OBJ += network/drivers_wifi/connmanctl.o
OBJ += misc/cpufreq/cpufreq.o
endif
ifeq ($(HAVE_WIFI), 1)
OBJ += wifi/drivers/nmcli.o
OBJ += network/wifi_driver.o
OBJ += tasks/task_wifi.o
OBJ += network/drivers_wifi/nmcli.o
DEFINES += -DHAVE_WIFI
endif
@ -2084,8 +2086,7 @@ ifeq ($(HAVE_NETWORKING), 1)
tasks/task_netplay_lan_scan.o \
tasks/task_netplay_nat_traversal.o \
tasks/task_bluetooth.o \
tasks/task_wifi.o \
tasks/task_pl_thumbnail_download.o \
tasks/task_pl_thumbnail_download.o \
tasks/task_netplay_find_content.o
ifeq ($(HAVE_MENU_COMMON), 1)

View file

@ -27,7 +27,11 @@
#include "verbosity.h"
#include "bluetooth/bluetooth_driver.h"
#include "wifi/wifi_driver.h"
#ifdef HAVE_NETWORKING
#ifdef HAVE_WIFI
#include "network/wifi_driver.h"
#endif
#endif
#include "led/led_driver.h"
#include "midi_driver.h"
#include "gfx/video_driver.h"
@ -68,33 +72,6 @@ const bluetooth_driver_t *bluetooth_drivers[] = {
NULL,
};
wifi_driver_t wifi_null = {
NULL, /* init */
NULL, /* free */
NULL, /* start */
NULL, /* stop */
NULL, /* enable */
NULL, /* connection_info */
NULL, /* scan */
NULL, /* get_ssids */
NULL, /* ssid_is_online */
NULL, /* connect_ssid */
NULL, /* disconnect_ssid */
NULL, /* tether_start_stop */
"null",
};
const wifi_driver_t *wifi_drivers[] = {
#ifdef HAVE_LAKKA
&wifi_connmanctl,
#endif
#ifdef HAVE_WIFI
&wifi_nmcli,
#endif
&wifi_null,
NULL,
};
static void retro_frame_null(const void *data, unsigned width,
unsigned height, size_t pitch) { }
void retro_input_poll_null(void) { }
@ -228,6 +205,7 @@ static const void *find_driver_nonempty(
return bluetooth_drivers[i];
}
}
#ifdef HAVE_WIFI
else if (string_is_equal(label, "wifi_driver"))
{
if (wifi_drivers[i])
@ -238,6 +216,7 @@ static const void *find_driver_nonempty(
return wifi_drivers[i];
}
}
#endif
return NULL;
}
@ -580,8 +559,10 @@ void drivers_init(
if (flags & DRIVER_BLUETOOTH_MASK)
bluetooth_driver_ctl(RARCH_BLUETOOTH_CTL_INIT, NULL);
#ifdef HAVE_WIFI
if ((flags & DRIVER_WIFI_MASK))
wifi_driver_ctl(RARCH_WIFI_CTL_INIT, NULL);
#endif
if (flags & DRIVER_LOCATION_MASK)
{
@ -729,8 +710,10 @@ void driver_uninit(int flags)
if ((flags & DRIVER_BLUETOOTH_MASK))
bluetooth_driver_ctl(RARCH_BLUETOOTH_CTL_DEINIT, NULL);
#ifdef HAVE_WIFI
if ((flags & DRIVER_WIFI_MASK))
wifi_driver_ctl(RARCH_WIFI_CTL_DEINIT, NULL);
#endif
if (flags & DRIVER_LED)
led_driver_free();
@ -841,7 +824,9 @@ void retroarch_deinit_drivers(struct retro_callbacks *cbs)
camera_st->data = NULL;
bluetooth_driver_ctl(RARCH_BLUETOOTH_CTL_DESTROY, NULL);
#ifdef HAVE_WIFI
wifi_driver_ctl(RARCH_WIFI_CTL_DESTROY, NULL);
#endif
cbs->frame_cb = retro_frame_null;
cbs->poll_cb = retro_input_poll_null;

View file

@ -1266,8 +1266,15 @@ BLUETOOTH
/*============================================================
WIFI
============================================================ */
#ifdef HAVE_WIFI
#include "../network/wifi_driver.c"
#ifdef HAVE_LAKKA
#include "../wifi/drivers/connmanctl.c"
#include "../network/drivers_wifi/connmanctl.c"
#endif
#include "../tasks/task_wifi.c"
#endif
/*============================================================
@ -1312,7 +1319,6 @@ NETPLAY
#include "../tasks/task_netplay_lan_scan.c"
#include "../tasks/task_netplay_nat_traversal.c"
#include "../tasks/task_bluetooth.c"
#include "../tasks/task_wifi.c"
#include "../tasks/task_netplay_find_content.c"
#include "../tasks/task_pl_thumbnail_download.c"
#endif

View file

@ -43,7 +43,6 @@
#include "../../paths.h"
#include "../../verbosity.h"
#include "../../bluetooth/bluetooth_driver.h"
#include "../../wifi/wifi_driver.h"
#include "../../playlist.h"
#include "../../manual_content_scan.h"
#include "../misc/cpufreq/cpufreq.h"
@ -51,6 +50,7 @@
#ifdef HAVE_NETWORKING
#include "../../network/netplay/netplay.h"
#include "../../network/wifi_driver.h"
#endif
#ifdef HAVE_CHEEVOS
@ -982,6 +982,7 @@ static void menu_action_setting_disp_set_label_bluetooth_is_connected(
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BT_CONNECTED), len);
}
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
static void menu_action_setting_disp_set_label_wifi_is_online(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
@ -996,6 +997,7 @@ static void menu_action_setting_disp_set_label_wifi_is_online(
if (driver_wifi_ssid_is_online(i))
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE), len);
}
#endif
static void menu_action_setting_disp_set_label_menu_disk_index(
file_list_t* list,
@ -1769,8 +1771,10 @@ static int menu_cbs_init_bind_get_string_representation_compare_label(
menu_action_setting_disp_set_label_bluetooth_is_connected);
break;
case MENU_ENUM_LABEL_CONNECT_WIFI:
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_wifi_is_online);
#endif
break;
case MENU_ENUM_LABEL_CHEAT_NUM_PASSES:
#ifdef HAVE_CHEATS

View file

@ -38,7 +38,6 @@
#include "../../config.def.h"
#include "../../config.def.keybinds.h"
#include "../../wifi/wifi_driver.h"
#include "../../driver.h"
#include "../menu_driver.h"
@ -83,7 +82,9 @@
#ifdef HAVE_NETWORKING
#include "../../network/netplay/netplay.h"
#include "../../wifi/wifi_driver.h"
#ifdef HAVE_WIFI
#include "../../network/wifi_driver.h"
#endif
#endif
#ifdef __WINRT__
@ -2900,6 +2901,7 @@ static int action_ok_bluetooth(const char *path, const char *label,
}
#ifdef HAVE_NETWORKING
#ifdef HAVE_WIFI
static void menu_input_wifi_cb(void *userdata, const char *passphrase)
{
unsigned idx = menu_input_dialog_get_kb_idx();
@ -2915,6 +2917,35 @@ static void menu_input_wifi_cb(void *userdata, const char *passphrase)
menu_input_dialog_end();
}
static int action_ok_wifi(const char *path, const char *label_setting,
unsigned type, size_t idx, size_t entry_idx)
{
wifi_network_scan_t* scan = driver_wifi_get_ssids();
if (idx >= RBUF_LEN(scan->net_list))
return -1;
if (scan->net_list[idx].saved_password)
{
/* No need to ask for a password, should be stored */
task_push_wifi_connect(NULL, &scan->net_list[idx]);
return 0;
}
else
{
/* Show password input dialog */
menu_input_ctx_line_t line;
line.label = "Passphrase";
line.label_setting = label_setting;
line.type = type;
line.idx = (unsigned)idx;
line.cb = menu_input_wifi_cb;
if (!menu_input_dialog_start(&line))
return -1;
return 0;
}
}
#endif
#endif
static void menu_input_st_string_cb_rename_entry(void *userdata,
@ -3234,35 +3265,6 @@ static int action_ok_shader_preset_remove_game(const char *path,
}
#endif
#ifdef HAVE_NETWORKING
static int action_ok_wifi(const char *path, const char *label_setting,
unsigned type, size_t idx, size_t entry_idx)
{
wifi_network_scan_t* scan = driver_wifi_get_ssids();
if (idx >= RBUF_LEN(scan->net_list))
return -1;
if (scan->net_list[idx].saved_password)
{
/* No need to ask for a password, should be stored */
task_push_wifi_connect(NULL, &scan->net_list[idx]);
return 0;
}
else
{
/* Show password input dialog */
menu_input_ctx_line_t line;
line.label = "Passphrase";
line.label_setting = label_setting;
line.type = type;
line.idx = (unsigned)idx;
line.cb = menu_input_wifi_cb;
if (!menu_input_dialog_start(&line))
return -1;
return 0;
}
}
#endif
static int action_ok_video_filter_remove(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
@ -5551,9 +5553,11 @@ DEFAULT_ACTION_OK_FUNC(action_ok_subsystem_list, ACTION_OK_DL_SUBSYSTEM_SETTINGS
DEFAULT_ACTION_OK_FUNC(action_ok_database_manager_list, ACTION_OK_DL_DATABASE_MANAGER_LIST)
DEFAULT_ACTION_OK_FUNC(action_ok_bluetooth_list, ACTION_OK_DL_BLUETOOTH_SETTINGS_LIST)
#ifdef HAVE_NETWORKING
#ifdef HAVE_WIFI
DEFAULT_ACTION_OK_FUNC(action_ok_wifi_list, ACTION_OK_DL_WIFI_SETTINGS_LIST)
DEFAULT_ACTION_OK_FUNC(action_ok_wifi_networks_list, ACTION_OK_DL_WIFI_NETWORKS_LIST)
#endif
#endif
DEFAULT_ACTION_OK_FUNC(action_ok_cursor_manager_list, ACTION_OK_DL_CURSOR_MANAGER_LIST)
DEFAULT_ACTION_OK_FUNC(action_ok_compressed_archive_push, ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH)
DEFAULT_ACTION_OK_FUNC(action_ok_compressed_archive_push_detect_core, ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH_DETECT_CORE)
@ -5701,6 +5705,7 @@ static int action_ok_open_picker(const char *path,
}
#ifdef HAVE_NETWORKING
#ifdef HAVE_WIFI
static void wifi_menu_refresh_callback(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
@ -5716,6 +5721,7 @@ static int action_ok_wifi_disconnect(const char *path,
task_push_wifi_disconnect(wifi_menu_refresh_callback);
return true;
}
#endif
static int action_ok_netplay_connect_room(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
@ -7967,9 +7973,11 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
{MENU_ENUM_LABEL_UPDATER_SETTINGS, action_ok_updater_list},
{MENU_ENUM_LABEL_BLUETOOTH_SETTINGS, action_ok_bluetooth_list},
#ifdef HAVE_NETWORKING
#ifdef HAVE_WIFI
{MENU_ENUM_LABEL_WIFI_SETTINGS, action_ok_wifi_list},
{MENU_ENUM_LABEL_WIFI_NETWORK_SCAN, action_ok_wifi_networks_list},
{MENU_ENUM_LABEL_WIFI_DISCONNECT, action_ok_wifi_disconnect},
#endif
{MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, action_ok_netplay_connect_room},
#endif
{MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS, action_ok_network_hosting_list},
@ -8444,7 +8452,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
break;
case MENU_WIFI:
#ifdef HAVE_NETWORKING
#ifdef HAVE_WIFI
BIND_ACTION_OK(cbs, action_ok_wifi);
#endif
#endif
break;
case MENU_NETPLAY_LAN_SCAN:

View file

@ -111,7 +111,9 @@
#include "../performance_counters.h"
#include "../core_info.h"
#include "../bluetooth/bluetooth_driver.h"
#include "../wifi/wifi_driver.h"
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
#include "../network/wifi_driver.h"
#endif
#include "../tasks/task_content.h"
#include "../tasks/tasks_internal.h"
#include "../dynamic.h"
@ -4947,7 +4949,7 @@ static void bluetooth_scan_callback(retro_task_t *task,
}
#endif
#ifdef HAVE_NETWORKING
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
static void wifi_scan_callback(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
@ -5854,6 +5856,7 @@ unsigned menu_displaylist_build_list(
#endif
break;
case DISPLAYLIST_WIFI_SETTINGS_LIST:
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
{
bool wifi_enabled = settings->bools.wifi_enabled;
bool connected = driver_wifi_connection_info(NULL);
@ -5888,9 +5891,10 @@ unsigned menu_displaylist_build_list(
count++;
}
}
#endif
break;
case DISPLAYLIST_WIFI_NETWORKS_LIST:
#ifdef HAVE_NETWORKING
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
if (!string_is_equal(settings->arrays.wifi_driver, "null"))
{
wifi_network_scan_t *scan = driver_wifi_get_ssids();

View file

@ -82,7 +82,6 @@
#include "../list_special.h"
#include "../audio/audio_driver.h"
#include "../bluetooth/bluetooth_driver.h"
#include "../wifi/wifi_driver.h"
#include "../midi_driver.h"
#include "../location_driver.h"
#include "../record/record_driver.h"
@ -106,6 +105,9 @@
#ifdef HAVE_NETWORKING
#include "../network/netplay/netplay.h"
#ifdef HAVE_WIFI
#include "../network/wifi_driver.h"
#endif
#endif
#ifdef HAVE_VIDEO_LAYOUT
@ -8155,10 +8157,12 @@ static void general_write_handler(rarch_setting_t *setting)
break;
case MENU_ENUM_LABEL_WIFI_ENABLED:
#ifdef HAVE_NETWORKING
#ifdef HAVE_WIFI
if (*setting->value.target.boolean)
task_push_wifi_enable(NULL);
else
task_push_wifi_disable(NULL);
#endif
#endif
break;
case MENU_ENUM_LABEL_CORE_INFO_CACHE_ENABLE:
@ -8426,11 +8430,13 @@ static void bluetooth_enable_toggle_change_handler(rarch_setting_t *setting)
*setting->value.target.boolean);
}
#ifdef HAVE_WIFI
static void localap_enable_toggle_change_handler(rarch_setting_t *setting)
{
driver_wifi_tether_start_stop(*setting->value.target.boolean,
LAKKA_LOCALAP_PATH);
}
#endif
static void timezone_change_handler(rarch_setting_t *setting)
{
@ -9715,7 +9721,7 @@ static bool setting_append_list(
break;
case SETTINGS_LIST_DRIVERS:
{
unsigned i;
unsigned i, j = 0;
struct string_options_entry string_options_entries[12];
START_GROUP(list, list_info, &group_info, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS), parent_group);
@ -9726,89 +9732,113 @@ static bool setting_append_list(
START_SUB_GROUP(list, list_info, "State", &group_info,
&subgroup_info, parent_group);
string_options_entries[0].target = settings->arrays.input_driver;
string_options_entries[0].len = sizeof(settings->arrays.input_driver);
string_options_entries[0].name_enum_idx = MENU_ENUM_LABEL_INPUT_DRIVER;
string_options_entries[0].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_INPUT_DRIVER;
string_options_entries[0].default_value = config_get_default_input();
string_options_entries[0].values = config_get_input_driver_options();
string_options_entries[j].target = settings->arrays.input_driver;
string_options_entries[j].len = sizeof(settings->arrays.input_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_INPUT_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_INPUT_DRIVER;
string_options_entries[j].default_value = config_get_default_input();
string_options_entries[j].values = config_get_input_driver_options();
string_options_entries[1].target = settings->arrays.input_joypad_driver;
string_options_entries[1].len = sizeof(settings->arrays.input_joypad_driver);
string_options_entries[1].name_enum_idx = MENU_ENUM_LABEL_JOYPAD_DRIVER;
string_options_entries[1].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_JOYPAD_DRIVER;
string_options_entries[1].default_value = config_get_default_joypad();
string_options_entries[1].values = config_get_joypad_driver_options();
j++;
string_options_entries[2].target = settings->arrays.video_driver;
string_options_entries[2].len = sizeof(settings->arrays.video_driver);
string_options_entries[2].name_enum_idx = MENU_ENUM_LABEL_VIDEO_DRIVER;
string_options_entries[2].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER;
string_options_entries[2].default_value = config_get_default_video();
string_options_entries[2].values = config_get_video_driver_options();
string_options_entries[j].target = settings->arrays.input_joypad_driver;
string_options_entries[j].len = sizeof(settings->arrays.input_joypad_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_JOYPAD_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_JOYPAD_DRIVER;
string_options_entries[j].default_value = config_get_default_joypad();
string_options_entries[j].values = config_get_joypad_driver_options();
string_options_entries[3].target = settings->arrays.audio_driver;
string_options_entries[3].len = sizeof(settings->arrays.audio_driver);
string_options_entries[3].name_enum_idx = MENU_ENUM_LABEL_AUDIO_DRIVER;
string_options_entries[3].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_AUDIO_DRIVER;
string_options_entries[3].default_value = config_get_default_audio();
string_options_entries[3].values = config_get_audio_driver_options();
j++;
string_options_entries[4].target = settings->arrays.audio_resampler;
string_options_entries[4].len = sizeof(settings->arrays.audio_resampler);
string_options_entries[4].name_enum_idx = MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER;
string_options_entries[4].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_DRIVER;
string_options_entries[4].default_value = config_get_default_audio_resampler();
string_options_entries[4].values = config_get_audio_resampler_driver_options();
string_options_entries[j].target = settings->arrays.video_driver;
string_options_entries[j].len = sizeof(settings->arrays.video_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_VIDEO_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER;
string_options_entries[j].default_value = config_get_default_video();
string_options_entries[j].values = config_get_video_driver_options();
string_options_entries[5].target = settings->arrays.camera_driver;
string_options_entries[5].len = sizeof(settings->arrays.camera_driver);
string_options_entries[5].name_enum_idx = MENU_ENUM_LABEL_CAMERA_DRIVER;
string_options_entries[5].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_CAMERA_DRIVER;
string_options_entries[5].default_value = config_get_default_camera();
string_options_entries[5].values = config_get_camera_driver_options();
j++;
string_options_entries[6].target = settings->arrays.bluetooth_driver;
string_options_entries[6].len = sizeof(settings->arrays.bluetooth_driver);
string_options_entries[6].name_enum_idx = MENU_ENUM_LABEL_BLUETOOTH_DRIVER;
string_options_entries[6].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_BLUETOOTH_DRIVER;
string_options_entries[6].default_value = config_get_default_bluetooth();
string_options_entries[6].values = config_get_bluetooth_driver_options();
string_options_entries[j].target = settings->arrays.audio_driver;
string_options_entries[j].len = sizeof(settings->arrays.audio_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_AUDIO_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_AUDIO_DRIVER;
string_options_entries[j].default_value = config_get_default_audio();
string_options_entries[j].values = config_get_audio_driver_options();
string_options_entries[7].target = settings->arrays.wifi_driver;
string_options_entries[7].len = sizeof(settings->arrays.wifi_driver);
string_options_entries[7].name_enum_idx = MENU_ENUM_LABEL_WIFI_DRIVER;
string_options_entries[7].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_WIFI_DRIVER;
string_options_entries[7].default_value = config_get_default_wifi();
string_options_entries[7].values = config_get_wifi_driver_options();
j++;
string_options_entries[8].target = settings->arrays.location_driver;
string_options_entries[8].len = sizeof(settings->arrays.location_driver);
string_options_entries[8].name_enum_idx = MENU_ENUM_LABEL_LOCATION_DRIVER;
string_options_entries[8].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER;
string_options_entries[8].default_value = config_get_default_location();
string_options_entries[8].values = config_get_location_driver_options();
string_options_entries[j].target = settings->arrays.audio_resampler;
string_options_entries[j].len = sizeof(settings->arrays.audio_resampler);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_DRIVER;
string_options_entries[j].default_value = config_get_default_audio_resampler();
string_options_entries[j].values = config_get_audio_resampler_driver_options();
string_options_entries[9].target = settings->arrays.menu_driver;
string_options_entries[9].len = sizeof(settings->arrays.menu_driver);
string_options_entries[9].name_enum_idx = MENU_ENUM_LABEL_MENU_DRIVER;
string_options_entries[9].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_MENU_DRIVER;
string_options_entries[9].default_value = config_get_default_menu();
string_options_entries[9].values = config_get_menu_driver_options();
j++;
string_options_entries[10].target = settings->arrays.record_driver;
string_options_entries[10].len = sizeof(settings->arrays.record_driver);
string_options_entries[10].name_enum_idx = MENU_ENUM_LABEL_RECORD_DRIVER;
string_options_entries[10].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_RECORD_DRIVER;
string_options_entries[10].default_value = config_get_default_record();
string_options_entries[10].values = config_get_record_driver_options();
string_options_entries[j].target = settings->arrays.camera_driver;
string_options_entries[j].len = sizeof(settings->arrays.camera_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_CAMERA_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_CAMERA_DRIVER;
string_options_entries[j].default_value = config_get_default_camera();
string_options_entries[j].values = config_get_camera_driver_options();
string_options_entries[11].target = settings->arrays.midi_driver;
string_options_entries[11].len = sizeof(settings->arrays.midi_driver);
string_options_entries[11].name_enum_idx = MENU_ENUM_LABEL_MIDI_DRIVER;
string_options_entries[11].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_MIDI_DRIVER;
string_options_entries[11].default_value = config_get_default_midi();
string_options_entries[11].values = config_get_midi_driver_options();
j++;
string_options_entries[j].target = settings->arrays.bluetooth_driver;
string_options_entries[j].len = sizeof(settings->arrays.bluetooth_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_BLUETOOTH_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_BLUETOOTH_DRIVER;
string_options_entries[j].default_value = config_get_default_bluetooth();
string_options_entries[j].values = config_get_bluetooth_driver_options();
j++;
#ifdef HAVE_WIFI
string_options_entries[j].target = settings->arrays.wifi_driver;
string_options_entries[j].len = sizeof(settings->arrays.wifi_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_WIFI_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_WIFI_DRIVER;
string_options_entries[j].default_value = config_get_default_wifi();
string_options_entries[j].values = config_get_wifi_driver_options();
j++;
#endif
string_options_entries[j].target = settings->arrays.location_driver;
string_options_entries[j].len = sizeof(settings->arrays.location_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_LOCATION_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER;
string_options_entries[j].default_value = config_get_default_location();
string_options_entries[j].values = config_get_location_driver_options();
j++;
string_options_entries[j].target = settings->arrays.menu_driver;
string_options_entries[j].len = sizeof(settings->arrays.menu_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_MENU_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_MENU_DRIVER;
string_options_entries[j].default_value = config_get_default_menu();
string_options_entries[j].values = config_get_menu_driver_options();
j++;
string_options_entries[j].target = settings->arrays.record_driver;
string_options_entries[j].len = sizeof(settings->arrays.record_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_RECORD_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_RECORD_DRIVER;
string_options_entries[j].default_value = config_get_default_record();
string_options_entries[j].values = config_get_record_driver_options();
j++;
string_options_entries[j].target = settings->arrays.midi_driver;
string_options_entries[j].len = sizeof(settings->arrays.midi_driver);
string_options_entries[j].name_enum_idx = MENU_ENUM_LABEL_MIDI_DRIVER;
string_options_entries[j].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_MIDI_DRIVER;
string_options_entries[j].default_value = config_get_default_midi();
string_options_entries[j].values = config_get_midi_driver_options();
for (i = 0; i < ARRAY_SIZE(string_options_entries); i++)
{
@ -19525,6 +19555,7 @@ static bool setting_append_list(
SD_FLAG_NONE);
(*list)[list_info->index - 1].change_handler = bluetooth_enable_toggle_change_handler;
#ifdef HAVE_WIFI
CONFIG_BOOL(
list, list_info,
&settings->bools.localap_enable,
@ -19540,6 +19571,7 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
(*list)[list_info->index - 1].change_handler = localap_enable_toggle_change_handler;
#endif
CONFIG_STRING_OPTIONS(
list, list_info,

View file

@ -65,10 +65,11 @@ static void connmanctl_stop(void *data)
(void)data;
}
static void connmanctl_refresh_services(connman_t *connman) {
static void connmanctl_refresh_services(connman_t *connman)
{
char line[512];
FILE *serv_file = popen("connmanctl services", "r");
if (connman->scan.net_list)
RBUF_FREE(connman->scan.net_list);
@ -295,11 +296,12 @@ static bool connmanctl_connection_info(void *data, wifi_network_info_t *netinfo)
return false;
}
static bool connmanctl_disconnect_ssid(void *data, const wifi_network_info_t* netinfo)
static bool connmanctl_disconnect_ssid(void *data,
const wifi_network_info_t* netinfo)
{
connman_t *connman = (connman_t*)data;
/* TODO:Check whether this network is actually connected */
/* TODO/FIXME: Check whether this network is actually connected */
snprintf(connman->command, sizeof(connman->command),
"connmanctl disconnect %s 2>&1",
@ -321,12 +323,12 @@ static bool connmanctl_connect_ssid(
char settings_dir[PATH_MAX_LENGTH] = {0};
char settings_path[PATH_MAX_LENGTH] = {0};
char netid[160] = {0};
FILE *settings_file = NULL;
connman_t *connman = (connman_t*)data;
settings_t *settings = config_get_ptr();
static struct string_list* list = NULL;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = connman->connmanctl_widgets_supported;
bool widgets_active =
connman->connmanctl_widgets_supported;
#endif
strlcat(netid, netinfo->netid, sizeof(netid));
strlcat(settings_dir, LAKKA_CONNMAN_DIR, sizeof(settings_dir));
@ -339,7 +341,7 @@ static bool connmanctl_connect_ssid(
if (!netinfo->saved_password)
{
settings_file = fopen(settings_path, "w");
FILE *settings_file = fopen(settings_path, "w");
if (!settings_file)
return false;
fprintf(settings_file, "[%s]\n", netid);
@ -362,14 +364,12 @@ static bool connmanctl_connect_ssid(
else
{
/* No need for pass, config should be there already, verify it */
settings_file = fopen(settings_path, "r");
if (!settings_file)
if (!path_is_valid(settings_path))
{
/* Usually a mismatch between connman state and config, reload */
system("systemctl restart connman.service");
return false;
}
fclose(settings_file);
}
if (connmanctl_tether_status(connman))

View file

@ -52,24 +52,22 @@ static void nmcli_free(void *data)
static bool nmcli_start(void *data)
{
(void)data;
return true;
}
static void nmcli_stop(void *data)
{
(void)data;
}
static void nmcli_stop(void *data) { }
static bool nmcli_enable(void* data, bool enabled)
{
// semantics here are broken: nmcli_enable(..., false) is called
// on startup which is probably not what we want.
/* semantics here are broken: nmcli_enable(..., false) is called
* on startup which is probably not what we want. */
// if (enabled)
// pclose(popen("nmcli radio wifi on", "r"));
// else
// pclose(popen("nmcli radio wifi off", "r"));
#if 0
if (enabled)
pclose(popen("nmcli radio wifi on", "r"));
else
pclose(popen("nmcli radio wifi off", "r"));
#endif
return true;
}
@ -78,12 +76,12 @@ static bool nmcli_connection_info(void *data, wifi_network_info_t *netinfo)
{
FILE *cmd_file = NULL;
char line[512];
(void)data;
if (!netinfo)
return false;
cmd_file = popen("nmcli -f NAME c show --active | tail -n+2", "r");
if (fgets(line, sizeof(line), cmd_file))
{
strlcpy(netinfo->ssid, line, sizeof(netinfo->ssid));
@ -96,9 +94,9 @@ static bool nmcli_connection_info(void *data, wifi_network_info_t *netinfo)
static void nmcli_scan(void *data)
{
char line[512];
nmcli_t *nmcli = (nmcli_t*)data;
FILE *cmd_file = NULL;
char line[512];
nmcli->scan.scan_time = time(NULL);
@ -144,7 +142,8 @@ static bool nmcli_ssid_is_online(void *data, unsigned idx)
return nmcli->scan.net_list[idx].connected;
}
static bool nmcli_connect_ssid(void *data, const wifi_network_info_t *netinfo)
static bool nmcli_connect_ssid(void *data,
const wifi_network_info_t *netinfo)
{
nmcli_t *nmcli = (nmcli_t*)data;
char cmd[256];
@ -153,11 +152,10 @@ static bool nmcli_connect_ssid(void *data, const wifi_network_info_t *netinfo)
if (!nmcli || !netinfo)
return false;
snprintf(cmd, sizeof(cmd), "nmcli dev wifi connect \"%s\" password \"%s\" 2>&1",
snprintf(cmd, sizeof(cmd),
"nmcli dev wifi connect \"%s\" password \"%s\" 2>&1",
netinfo->ssid, netinfo->passphrase);
ret = pclose(popen(cmd, "r"));
if (ret == 0)
if ((ret = pclose(popen(cmd, "r"))) == 0)
{
for (i = 0; i < RBUF_LEN(nmcli->scan.net_list); i++)
{
@ -169,23 +167,17 @@ static bool nmcli_connect_ssid(void *data, const wifi_network_info_t *netinfo)
return true;
}
static bool nmcli_disconnect_ssid(void *data, const wifi_network_info_t *netinfo)
static bool nmcli_disconnect_ssid(void *data,
const wifi_network_info_t *netinfo)
{
char cmd[256];
(void)data;
snprintf(cmd, sizeof(cmd), "nmcli c down \"%s\"", netinfo->ssid);
pclose(popen(cmd, "r"));
return true;
}
static void nmcli_tether_start_stop(void* data, bool start, char* configfile)
{
(void)data;
(void)start;
(void)configfile;
}
static void nmcli_tether_start_stop(void *a, bool b, char *c) { }
wifi_driver_t wifi_nmcli = {
nmcli_init,

245
network/wifi_driver.c Normal file
View file

@ -0,0 +1,245 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2021 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#include "../driver.h"
#include "../list_special.h"
#include "../retroarch.h"
#include "../runloop.h"
#include "../verbosity.h"
#include "wifi_driver.h"
wifi_driver_t wifi_null = {
NULL, /* init */
NULL, /* free */
NULL, /* start */
NULL, /* stop */
NULL, /* enable */
NULL, /* connection_info */
NULL, /* scan */
NULL, /* get_ssids */
NULL, /* ssid_is_online */
NULL, /* connect_ssid */
NULL, /* disconnect_ssid */
NULL, /* tether_start_stop */
"null",
};
const wifi_driver_t *wifi_drivers[] = {
#ifdef HAVE_LAKKA
&wifi_connmanctl,
#endif
#ifdef HAVE_WIFI
&wifi_nmcli,
#endif
&wifi_null,
NULL,
};
static wifi_driver_state_t wifi_driver_st = {0}; /* double alignment */
wifi_driver_state_t *wifi_state_get_ptr(void)
{
return &wifi_driver_st;
}
/**
* config_get_wifi_driver_options:
*
* Get an enumerated list of all wifi driver names,
* separated by '|'.
*
* Returns: string listing of all wifi driver names,
* separated by '|'.
**/
const char* config_get_wifi_driver_options(void)
{
return char_list_new_special(STRING_LIST_WIFI_DRIVERS, NULL);
}
void driver_wifi_scan(void)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
if (wifi_st && wifi_st->drv)
wifi_st->drv->scan(wifi_st->data);
}
bool driver_wifi_enable(bool enabled)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
if (wifi_st && wifi_st->drv)
return wifi_st->drv->enable(wifi_st->data, enabled);
return false;
}
bool driver_wifi_connection_info(wifi_network_info_t *netinfo)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
if (wifi_st && wifi_st->drv)
return wifi_st->drv->connection_info(wifi_st->data, netinfo);
return false;
}
wifi_network_scan_t* driver_wifi_get_ssids(void)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
if (wifi_st && wifi_st->drv)
return wifi_st->drv->get_ssids(wifi_st->data);
return NULL;
}
bool driver_wifi_ssid_is_online(unsigned i)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
if (wifi_st && wifi_st->drv)
return wifi_st->drv->ssid_is_online(wifi_st->data, i);
return false;
}
bool driver_wifi_connect_ssid(const wifi_network_info_t* net)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
if (wifi_st && wifi_st->drv)
return wifi_st->drv->connect_ssid(wifi_st->data, net);
return false;
}
bool driver_wifi_disconnect_ssid(const wifi_network_info_t* net)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
if (wifi_st && wifi_st->drv)
return wifi_st->drv->disconnect_ssid(wifi_st->data, net);
return false;
}
void driver_wifi_tether_start_stop(bool start, char* configfile)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
if (wifi_st && wifi_st->drv)
wifi_st->drv->tether_start_stop(wifi_st->data, start, configfile);
}
bool wifi_driver_ctl(enum rarch_wifi_ctl_state state, void *data)
{
wifi_driver_state_t *wifi_st = &wifi_driver_st;
settings_t *settings = config_get_ptr();
switch (state)
{
case RARCH_WIFI_CTL_DESTROY:
wifi_st->active = false;
wifi_st->drv = NULL;
wifi_st->data = NULL;
break;
case RARCH_WIFI_CTL_SET_ACTIVE:
wifi_st->active = true;
break;
case RARCH_WIFI_CTL_FIND_DRIVER:
{
const char *prefix = "wifi driver";
int i = (int)driver_find_index(
"wifi_driver",
settings->arrays.wifi_driver);
if (i >= 0)
wifi_st->drv = (const wifi_driver_t*)wifi_drivers[i];
else
{
if (verbosity_is_enabled())
{
unsigned d;
RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix,
settings->arrays.wifi_driver);
RARCH_LOG_OUTPUT("Available %ss are:\n", prefix);
for (d = 0; wifi_drivers[d]; d++)
RARCH_LOG_OUTPUT("\t%s\n", wifi_drivers[d]->ident);
RARCH_WARN("Going to default to first %s...\n", prefix);
}
wifi_st->drv = (const wifi_driver_t*)wifi_drivers[0];
if (!wifi_st->drv)
retroarch_fail(1, "find_wifi_driver()");
}
}
break;
case RARCH_WIFI_CTL_UNSET_ACTIVE:
wifi_st->active = false;
break;
case RARCH_WIFI_CTL_IS_ACTIVE:
return wifi_st->active;
case RARCH_WIFI_CTL_DEINIT:
if (wifi_st->data && wifi_st->drv)
{
if (wifi_st->drv->free)
wifi_st->drv->free(wifi_st->data);
}
wifi_st->data = NULL;
break;
case RARCH_WIFI_CTL_STOP:
if ( wifi_st->drv
&& wifi_st->drv->stop
&& wifi_st->data)
wifi_st->drv->stop(wifi_st->data);
break;
case RARCH_WIFI_CTL_START:
if ( wifi_st->drv
&& wifi_st->data
&& wifi_st->drv->start)
{
bool wifi_allow = settings->bools.wifi_allow;
if (wifi_allow)
return wifi_st->drv->start(wifi_st->data);
}
return false;
case RARCH_WIFI_CTL_INIT:
/* Resource leaks will follow if wifi is initialized twice. */
if (wifi_st->data)
return false;
wifi_driver_ctl(RARCH_WIFI_CTL_FIND_DRIVER, NULL);
if (wifi_st->drv && wifi_st->drv->init)
{
wifi_st->data = wifi_st->drv->init();
if (wifi_st->data)
{
wifi_st->drv->enable(wifi_st->data,
settings->bools.wifi_enabled);
}
else
{
RARCH_ERR("Failed to initialize wifi driver. Will continue without wifi.\n");
wifi_driver_ctl(RARCH_WIFI_CTL_UNSET_ACTIVE, NULL);
}
}
break;
default:
break;
}
return false;
}

View file

@ -48,7 +48,7 @@ typedef struct wifi_network_info
bool connected;
bool saved_password;
char netid[160]; /* Do not use, internal */
/* TODO Add signal strength & other info */
/* TODO/FIXME - Add signal strength & other info */
} wifi_network_info_t;
typedef struct wifi_network_scan
@ -78,6 +78,13 @@ typedef struct wifi_driver
const char *ident;
} wifi_driver_t;
typedef struct
{
const wifi_driver_t *drv;
void *data;
bool active;
} wifi_driver_state_t;
extern wifi_driver_t wifi_connmanctl;
extern wifi_driver_t wifi_nmcli;

View file

@ -181,6 +181,9 @@
#ifdef HAVE_NETWORKING
#include "network/netplay/netplay.h"
#include "network/netplay/netplay_private.h"
#ifdef HAVE_WIFI
#include "network/wifi_driver.h"
#endif
#endif
#ifdef HAVE_THREADS
@ -211,7 +214,6 @@
#include "gfx/video_crt_switch.h"
#endif
#include "bluetooth/bluetooth_driver.h"
#include "wifi/wifi_driver.h"
#include "misc/cpufreq/cpufreq.h"
#include "led/led_driver.h"
#include "midi_driver.h"
@ -438,8 +440,6 @@ struct rarch_state
const bluetooth_driver_t *bluetooth_driver;
void *bluetooth_data;
const wifi_driver_t *wifi_driver;
void *wifi_data;
char *connect_host; /* Netplay hostname passed from CLI */
struct retro_perf_counter *perf_counters_rarch[MAX_COUNTERS];
@ -486,7 +486,6 @@ struct rarch_state
bool rarch_block_config_read;
#endif
bool bluetooth_driver_active;
bool wifi_driver_active;
bool main_ui_companion_is_on_foreground;
};
@ -10066,176 +10065,6 @@ bool bluetooth_driver_ctl(enum rarch_bluetooth_ctl_state state, void *data)
return false;
}
/* WIFI DRIVER */
/**
* config_get_wifi_driver_options:
*
* Get an enumerated list of all wifi driver names,
* separated by '|'.
*
* Returns: string listing of all wifi driver names,
* separated by '|'.
**/
const char* config_get_wifi_driver_options(void)
{
return char_list_new_special(STRING_LIST_WIFI_DRIVERS, NULL);
}
void driver_wifi_scan(void)
{
struct rarch_state *p_rarch = &rarch_st;
p_rarch->wifi_driver->scan(p_rarch->wifi_data);
}
bool driver_wifi_enable(bool enabled)
{
struct rarch_state *p_rarch = &rarch_st;
return p_rarch->wifi_driver->enable(p_rarch->wifi_data, enabled);
}
bool driver_wifi_connection_info(wifi_network_info_t *netinfo)
{
struct rarch_state *p_rarch = &rarch_st;
return p_rarch->wifi_driver->connection_info(p_rarch->wifi_data, netinfo);
}
wifi_network_scan_t* driver_wifi_get_ssids(void)
{
struct rarch_state *p_rarch = &rarch_st;
return p_rarch->wifi_driver->get_ssids(p_rarch->wifi_data);
}
bool driver_wifi_ssid_is_online(unsigned i)
{
struct rarch_state *p_rarch = &rarch_st;
return p_rarch->wifi_driver->ssid_is_online(p_rarch->wifi_data, i);
}
bool driver_wifi_connect_ssid(const wifi_network_info_t* net)
{
struct rarch_state *p_rarch = &rarch_st;
return p_rarch->wifi_driver->connect_ssid(p_rarch->wifi_data, net);
}
bool driver_wifi_disconnect_ssid(const wifi_network_info_t* net)
{
struct rarch_state *p_rarch = &rarch_st;
return p_rarch->wifi_driver->disconnect_ssid(p_rarch->wifi_data, net);
}
void driver_wifi_tether_start_stop(bool start, char* configfile)
{
struct rarch_state *p_rarch = &rarch_st;
p_rarch->wifi_driver->tether_start_stop(p_rarch->wifi_data, start, configfile);
}
bool wifi_driver_ctl(enum rarch_wifi_ctl_state state, void *data)
{
struct rarch_state *p_rarch = &rarch_st;
settings_t *settings = config_get_ptr();
switch (state)
{
case RARCH_WIFI_CTL_DESTROY:
p_rarch->wifi_driver_active = false;
p_rarch->wifi_driver = NULL;
p_rarch->wifi_data = NULL;
break;
case RARCH_WIFI_CTL_SET_ACTIVE:
p_rarch->wifi_driver_active = true;
break;
case RARCH_WIFI_CTL_FIND_DRIVER:
{
const char *prefix = "wifi driver";
int i = (int)driver_find_index(
"wifi_driver",
settings->arrays.wifi_driver);
if (i >= 0)
p_rarch->wifi_driver = (const wifi_driver_t*)wifi_drivers[i];
else
{
if (verbosity_is_enabled())
{
unsigned d;
RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix,
settings->arrays.wifi_driver);
RARCH_LOG_OUTPUT("Available %ss are:\n", prefix);
for (d = 0; wifi_drivers[d]; d++)
RARCH_LOG_OUTPUT("\t%s\n", wifi_drivers[d]->ident);
RARCH_WARN("Going to default to first %s...\n", prefix);
}
p_rarch->wifi_driver = (const wifi_driver_t*)wifi_drivers[0];
if (!p_rarch->wifi_driver)
retroarch_fail(1, "find_wifi_driver()");
}
}
break;
case RARCH_WIFI_CTL_UNSET_ACTIVE:
p_rarch->wifi_driver_active = false;
break;
case RARCH_WIFI_CTL_IS_ACTIVE:
return p_rarch->wifi_driver_active;
case RARCH_WIFI_CTL_DEINIT:
if (p_rarch->wifi_data && p_rarch->wifi_driver)
{
if (p_rarch->wifi_driver->free)
p_rarch->wifi_driver->free(p_rarch->wifi_data);
}
p_rarch->wifi_data = NULL;
break;
case RARCH_WIFI_CTL_STOP:
if ( p_rarch->wifi_driver
&& p_rarch->wifi_driver->stop
&& p_rarch->wifi_data)
p_rarch->wifi_driver->stop(p_rarch->wifi_data);
break;
case RARCH_WIFI_CTL_START:
if ( p_rarch->wifi_driver
&& p_rarch->wifi_data
&& p_rarch->wifi_driver->start)
{
bool wifi_allow = settings->bools.wifi_allow;
if (wifi_allow)
return p_rarch->wifi_driver->start(p_rarch->wifi_data);
}
return false;
case RARCH_WIFI_CTL_INIT:
/* Resource leaks will follow if wifi is initialized twice. */
if (p_rarch->wifi_data)
return false;
wifi_driver_ctl(RARCH_WIFI_CTL_FIND_DRIVER, NULL);
if (p_rarch->wifi_driver && p_rarch->wifi_driver->init)
{
p_rarch->wifi_data = p_rarch->wifi_driver->init();
if (p_rarch->wifi_data)
{
p_rarch->wifi_driver->enable(p_rarch->wifi_data,
settings->bools.wifi_enabled);
}
else
{
RARCH_ERR("Failed to initialize wifi driver. Will continue without wifi.\n");
wifi_driver_ctl(RARCH_WIFI_CTL_UNSET_ACTIVE, NULL);
}
}
break;
default:
break;
}
return false;
}
/* UI COMPANION */
void ui_companion_set_foreground(unsigned enable)
@ -12505,7 +12334,9 @@ bool retroarch_main_init(int argc, char *argv[])
retroarch_fail(1, "find_camera_driver()");
bluetooth_driver_ctl(RARCH_BLUETOOTH_CTL_FIND_DRIVER, NULL);
#ifdef HAVE_WIFI
wifi_driver_ctl(RARCH_WIFI_CTL_FIND_DRIVER, NULL);
#endif
location_driver_find_driver(settings,
"location driver", verbosity_enabled);
#ifdef HAVE_MENU

View file

@ -23,8 +23,8 @@
#include "tasks_internal.h"
#include "../msg_hash.h"
#include "../network/wifi_driver.h"
#include "../verbosity.h"
#include "../wifi/wifi_driver.h"
#define FUNC_PUSH_TASK(funcname, handlerfunc, message) \
bool funcname(retro_task_callback_t cb) \