mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-16 23:40:43 +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");
|
"Usage:\n");
|
||||||
printf("\tiwd [options]\n");
|
printf("\tiwd [options]\n");
|
||||||
printf("Options:\n"
|
printf("Options:\n"
|
||||||
|
"\t-S, --ssid <ssid> SSID of network\n"
|
||||||
"\t-h, --help Show help options\n");
|
"\t-h, --help Show help options\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct option main_options[] = {
|
static const struct option main_options[] = {
|
||||||
|
{ "ssid", required_argument, NULL, 'S' },
|
||||||
{ "version", no_argument, NULL, 'v' },
|
{ "version", no_argument, NULL, 'v' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ }
|
{ }
|
||||||
@ -70,11 +72,14 @@ int main(int argc, char *argv[])
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
opt = getopt_long(argc, argv, "vh", main_options, NULL);
|
opt = getopt_long(argc, argv, "S:vh", main_options, NULL);
|
||||||
if (opt < 0)
|
if (opt < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
case 'S':
|
||||||
|
wiphy_set_ssid(optarg);
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("%s\n", VERSION);
|
printf("%s\n", VERSION);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include "linux/nl80211.h"
|
#include "linux/nl80211.h"
|
||||||
#include "src/wiphy.h"
|
#include "src/wiphy.h"
|
||||||
|
|
||||||
|
static const char *network_ssid = NULL;
|
||||||
|
|
||||||
static struct l_genl *genl = NULL;
|
static struct l_genl *genl = NULL;
|
||||||
static struct l_genl_family *nl80211 = 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));
|
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);
|
bool wiphy_exit(void);
|
||||||
|
|
||||||
void wiphy_notify_dellink(uint32_t index);
|
void wiphy_notify_dellink(uint32_t index);
|
||||||
|
|
||||||
|
void wiphy_set_ssid(const char *ssid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user