mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 10:32:33 +01:00
core: Make Kernel D-Bus setup optional
This commit is contained in:
parent
ebeeb143cb
commit
70bc082d41
21
src/main.c
21
src/main.c
@ -52,11 +52,13 @@ static void usage(void)
|
|||||||
printf("\tiwd [options]\n");
|
printf("\tiwd [options]\n");
|
||||||
printf("Options:\n"
|
printf("Options:\n"
|
||||||
"\t-S, --ssid <ssid> SSID of network\n"
|
"\t-S, --ssid <ssid> SSID of network\n"
|
||||||
|
"\t-K, --kdbus Setup Kernel D-Bus\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' },
|
{ "ssid", required_argument, NULL, 'S' },
|
||||||
|
{ "kdbus", no_argument, NULL, 'K' },
|
||||||
{ "version", no_argument, NULL, 'v' },
|
{ "version", no_argument, NULL, 'v' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ }
|
{ }
|
||||||
@ -64,9 +66,9 @@ static const struct option main_options[] = {
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
bool enable_kdbus = false;
|
||||||
struct l_signal *signal;
|
struct l_signal *signal;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
char *bus_name;
|
|
||||||
int exit_status;
|
int exit_status;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -80,6 +82,9 @@ int main(int argc, char *argv[])
|
|||||||
case 'S':
|
case 'S':
|
||||||
wiphy_set_ssid(optarg);
|
wiphy_set_ssid(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'K':
|
||||||
|
enable_kdbus = true;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("%s\n", VERSION);
|
printf("%s\n", VERSION);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@ -107,6 +112,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
l_info("Wireless daemon version %s", VERSION);
|
l_info("Wireless daemon version %s", VERSION);
|
||||||
|
|
||||||
|
if (enable_kdbus) {
|
||||||
|
char *bus_name;
|
||||||
|
bool result;
|
||||||
|
|
||||||
if (!kdbus_create_bus()) {
|
if (!kdbus_create_bus()) {
|
||||||
exit_status = EXIT_FAILURE;
|
exit_status = EXIT_FAILURE;
|
||||||
goto done;
|
goto done;
|
||||||
@ -120,10 +129,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
l_debug("Bus location: %s", bus_name);
|
l_debug("Bus location: %s", bus_name);
|
||||||
|
|
||||||
if (!kdbus_open_bus(bus_name, "net.connman.iwd", "iwd")) {
|
result = kdbus_open_bus(bus_name, "net.connman.iwd", "iwd");
|
||||||
|
|
||||||
|
l_free(bus_name);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
exit_status = EXIT_FAILURE;
|
exit_status = EXIT_FAILURE;
|
||||||
goto destroy;
|
goto destroy;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!netdev_init()) {
|
if (!netdev_init()) {
|
||||||
exit_status = EXIT_FAILURE;
|
exit_status = EXIT_FAILURE;
|
||||||
@ -144,8 +158,7 @@ int main(int argc, char *argv[])
|
|||||||
exit_status = EXIT_SUCCESS;
|
exit_status = EXIT_SUCCESS;
|
||||||
|
|
||||||
destroy:
|
destroy:
|
||||||
l_free(bus_name);
|
if (enable_kdbus)
|
||||||
|
|
||||||
kdbus_destroy_bus();
|
kdbus_destroy_bus();
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
Loading…
Reference in New Issue
Block a user