mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
core: Add command line option to provide SSID
This commit is contained in:
parent
1ab85bdbe5
commit
c13d50fab9
@ -51,10 +51,12 @@ static void usage(void)
|
||||
"Usage:\n");
|
||||
printf("\tiwd [options]\n");
|
||||
printf("Options:\n"
|
||||
"\t-S, --ssid <ssid> SSID of network\n"
|
||||
"\t-h, --help Show help options\n");
|
||||
}
|
||||
|
||||
static const struct option main_options[] = {
|
||||
{ "ssid", required_argument, NULL, 'S' },
|
||||
{ "version", no_argument, NULL, 'v' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ }
|
||||
@ -70,11 +72,14 @@ int main(int argc, char *argv[])
|
||||
for (;;) {
|
||||
int opt;
|
||||
|
||||
opt = getopt_long(argc, argv, "vh", main_options, NULL);
|
||||
opt = getopt_long(argc, argv, "S:vh", main_options, NULL);
|
||||
if (opt < 0)
|
||||
break;
|
||||
|
||||
switch (opt) {
|
||||
case 'S':
|
||||
wiphy_set_ssid(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
printf("%s\n", VERSION);
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "linux/nl80211.h"
|
||||
#include "src/wiphy.h"
|
||||
|
||||
static const char *network_ssid = NULL;
|
||||
|
||||
static struct l_genl *genl = NULL;
|
||||
static struct l_genl_family *nl80211 = NULL;
|
||||
|
||||
@ -542,3 +544,8 @@ void wiphy_notify_dellink(uint32_t index)
|
||||
|
||||
l_queue_foreach(wiphy_list, wiphy_check_dellink, L_UINT_TO_PTR(index));
|
||||
}
|
||||
|
||||
void wiphy_set_ssid(const char *ssid)
|
||||
{
|
||||
network_ssid = ssid;
|
||||
}
|
||||
|
@ -27,3 +27,5 @@ bool wiphy_init(void);
|
||||
bool wiphy_exit(void);
|
||||
|
||||
void wiphy_notify_dellink(uint32_t index);
|
||||
|
||||
void wiphy_set_ssid(const char *ssid);
|
||||
|
Loading…
Reference in New Issue
Block a user