void CompositorLauncher::start() { // Try to detect mode and hardware detectHardware(); detectMode(); if (m_mode == UnknownMode) { qWarning() << "No mode detected, please manually specify one!"; QCoreApplication::quit(); return; } // Detect whether we have libinput detectLibInput(); // Start the process startProcess("greenisland", compositorArgs(), compositorEnv()); // Set environment so that applications will inherit it setupEnvironment(); }
/* * Main function. */ int main(int argc, char **argv) { uFlags = 0; progname = argv[0]; while (--argc > 0 && **(++argv) == '-') { while (*(++(*argv))) { switch (**argv) { case 'a': uFlags = (SYSNAME | NODENAME | RELEASE | ARCH | VERSION | MACHINE); break; case 'm': uFlags |= MACHINE; break; case 'n': uFlags |= NODENAME; break; case 'p': uFlags |= ARCH; break; case 'r': uFlags |= RELEASE; break; case 's': uFlags |= SYSNAME; break; case 'v': uFlags |= VERSION; break; default: usage(); } } } if (uFlags == 0) uFlags = SYSNAME; detectOpSysVersion(); detectHardware(); print_element(SYSNAME, sysname); print_element(NODENAME, nodename); print_element(RELEASE, release); print_element(VERSION, version); print_element(MACHINE, machine); print_element(ARCH, processor); exit(EXIT_SUCCESS); }
// // Return a polite response. // Called directly from webOS, and returns directly to webOS. // bool start_adhoc_method(LSHandle* lshandle, LSMessage *message, void *ctx) { log("start_adhoc_method"); LSError lserror; LSErrorInit(&lserror); // Local buffer to store the reply char reply[MAXLINLEN]; // Extract the id argument from the message json_t *object = json_parse_document(LSMessageGetPayload(message)); json_t *ssid = json_find_first_label(object, "ssid"); json_t *preferedDNS = json_find_first_label(object, "preferedDNS"); json_t *alternateDNS = json_find_first_label(object, "alternateDNS"); log("ssid: %s, preferedDNS: %s, alternateDNS: %s", ssid->child->text, preferedDNS->child->text, alternateDNS->child->text); if (!ssid || (ssid->child->type != JSON_STRING) || !preferedDNS || (preferedDNS->child->type != JSON_STRING) || !alternateDNS || (alternateDNS->child->type != JSON_STRING)) { if (!LSMessageReply(lshandle, message, "{\"returnValue\": false, \"errorCode\": -1, \"errorText\": \"Invalid or missing parameters\"}", &lserror)) { LSErrorPrint(&lserror, stderr); LSErrorFree(&lserror); return false; } } stopPalmWifiService(); detectHardware(); restartNetworkCard(); if(configureWifiInterface(ssid->child->text) == true) { const char* address = getDhcpAddress(); // If we got an IP address then update the DNS if(address != NULL) { // If the user passed in both dns options blank, then we'll use the obtained IP address for dns forwarding if(strlen(preferedDNS->child->text) == 0 && strlen(alternateDNS->child->text) == 0) { updateDns(address); } else { if(strlen(preferedDNS->child->text) > 0) { updateDns(preferedDNS->child->text); } if(strlen(alternateDNS->child->text) > 0) { updateDns(alternateDNS->child->text); } } sprintf(reply, "{\"returnValue\": true, \"address\": \"%s\"}", address); } else { // We didn't managed to get an IP address from the Ad-Hoc access point, so retart the Palm Wi-Fi Service startPalmWifiService(); sprintf(reply, "{\"returnValue\": false, \"errorCode\": -1, \"errorText\": \"Unable to obtain IP address\"}"); } } else { // We didn't managed to configure the network interface startPalmWifiService(); sprintf(reply, "{\"returnValue\": false, \"errorCode\": -1, \"errorText\": \"Error configuring network interface\"}"); } log(reply); if (!LSMessageReply(lshandle, message, reply, &lserror)) { LSErrorPrint(&lserror, stderr); LSErrorFree(&lserror); return false; } return true; }