3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

core: Make Kernel D-Bus setup optional

This commit is contained in:
Marcel Holtmann 2014-08-09 10:59:48 -07:00
parent ebeeb143cb
commit 70bc082d41

View File

@ -52,11 +52,13 @@ static void usage(void)
printf("\tiwd [options]\n");
printf("Options:\n"
"\t-S, --ssid <ssid> SSID of network\n"
"\t-K, --kdbus Setup Kernel D-Bus\n"
"\t-h, --help Show help options\n");
}
static const struct option main_options[] = {
{ "ssid", required_argument, NULL, 'S' },
{ "kdbus", no_argument, NULL, 'K' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
{ }
@ -64,9 +66,9 @@ static const struct option main_options[] = {
int main(int argc, char *argv[])
{
bool enable_kdbus = false;
struct l_signal *signal;
sigset_t mask;
char *bus_name;
int exit_status;
for (;;) {
@ -80,6 +82,9 @@ int main(int argc, char *argv[])
case 'S':
wiphy_set_ssid(optarg);
break;
case 'K':
enable_kdbus = true;
break;
case 'v':
printf("%s\n", VERSION);
return EXIT_SUCCESS;
@ -107,6 +112,10 @@ int main(int argc, char *argv[])
l_info("Wireless daemon version %s", VERSION);
if (enable_kdbus) {
char *bus_name;
bool result;
if (!kdbus_create_bus()) {
exit_status = EXIT_FAILURE;
goto done;
@ -120,10 +129,15 @@ int main(int argc, char *argv[])
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;
goto destroy;
}
}
if (!netdev_init()) {
exit_status = EXIT_FAILURE;
@ -144,8 +158,7 @@ int main(int argc, char *argv[])
exit_status = EXIT_SUCCESS;
destroy:
l_free(bus_name);
if (enable_kdbus)
kdbus_destroy_bus();
done: