mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 19:21:03 +00:00
Display WiFi menu title and perform a scan before calling the services
This commit is contained in:
parent
d493273bcf
commit
339de94095
@ -2312,6 +2312,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
|
||||
return "scan_directory";
|
||||
case MENU_ENUM_LABEL_ADD_CONTENT_LIST:
|
||||
return "add_content";
|
||||
case MENU_ENUM_LABEL_CONNECT_WIFI:
|
||||
return "connect_wifi";
|
||||
case MENU_ENUM_LABEL_OVERLAY_AUTOLOAD_PREFERRED:
|
||||
return "overlay_autoload_preferred";
|
||||
case MENU_ENUM_LABEL_INFORMATION:
|
||||
|
@ -275,6 +275,13 @@ static int action_get_retro_achievements_settings_list(const char *path, const c
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_get_wifi_settings_list(const char *path, const char *label,
|
||||
unsigned menu_type, char *s, size_t len)
|
||||
{
|
||||
sanitize_to_string(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_get_network_settings_list(const char *path, const char *label,
|
||||
unsigned menu_type, char *s, size_t len)
|
||||
{
|
||||
@ -950,6 +957,12 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST)))
|
||||
{
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_wifi_settings_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST)))
|
||||
{
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_updater_settings_list);
|
||||
|
@ -4681,9 +4681,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
const char *ssid = ssid_list->elems[i].data;
|
||||
menu_entries_append_enum(info->list,
|
||||
ssid,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT),
|
||||
MENU_ENUM_LABEL_LOAD_CONTENT,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_WIFI),
|
||||
MENU_ENUM_LABEL_CONNECT_WIFI,
|
||||
0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -722,6 +722,8 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_DIRECTORY_SETTINGS,
|
||||
MENU_ENUM_LABEL_PRIVACY_SETTINGS,
|
||||
|
||||
MENU_ENUM_LABEL_CONNECT_WIFI,
|
||||
|
||||
MENU_ENUM_LABEL_MENU_ENUM_LINEAR_FILTER,
|
||||
MENU_ENUM_LABEL_VALUE_MENU_ENUM_LINEAR_FILTER,
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "../wifi_driver.h"
|
||||
#include <file/file_path.h>
|
||||
#include <compat/strl.h>
|
||||
|
||||
static void *connmanctl_init(const char *device, uint64_t caps,
|
||||
unsigned width, unsigned height)
|
||||
@ -43,13 +44,18 @@ static void connmanctl_scan(struct string_list *list)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
attr.i = RARCH_FILETYPE_UNSET;
|
||||
char ssid[512];
|
||||
char line[512];
|
||||
|
||||
FILE* file = popen("connmanctl services", "r");
|
||||
while (fgets (ssid, 512, file) != NULL)
|
||||
pclose(popen("connmanctl scan wifi", "r"));
|
||||
|
||||
FILE* serv_file = popen("connmanctl services", "r");
|
||||
while (fgets (line, 512, serv_file) != NULL)
|
||||
{
|
||||
char ssid[20];
|
||||
strlcpy(ssid, line+4, sizeof(ssid));
|
||||
string_list_append(list, ssid, attr);
|
||||
|
||||
pclose(file);
|
||||
}
|
||||
pclose(serv_file);
|
||||
}
|
||||
|
||||
wifi_driver_t wifi_connmanctl = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user