aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c42
1 files changed, 3 insertions, 39 deletions
diff --git a/sway/main.c b/sway/main.c
index 0c219fb3..0611e80b 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -12,6 +12,7 @@
12#include <sys/un.h> 12#include <sys/un.h>
13#include <unistd.h> 13#include <unistd.h>
14#include <wlr/util/log.h> 14#include <wlr/util/log.h>
15#include <wlr/version.h>
15#include "sway/commands.h" 16#include "sway/commands.h"
16#include "sway/config.h" 17#include "sway/config.h"
17#include "sway/server.h" 18#include "sway/server.h"
@@ -46,43 +47,6 @@ void sig_handler(int signal) {
46 sway_terminate(EXIT_SUCCESS); 47 sway_terminate(EXIT_SUCCESS);
47} 48}
48 49
49void detect_raspi(void) {
50 bool raspi = false;
51 FILE *f = fopen("/sys/firmware/devicetree/base/model", "r");
52 if (!f) {
53 return;
54 }
55 char *line = NULL;
56 size_t line_size = 0;
57 while (getline(&line, &line_size, f) != -1) {
58 if (strstr(line, "Raspberry Pi")) {
59 raspi = true;
60 break;
61 }
62 }
63 fclose(f);
64 FILE *g = fopen("/proc/modules", "r");
65 if (!g) {
66 free(line);
67 return;
68 }
69 bool vc4 = false;
70 while (getline(&line, &line_size, g) != -1) {
71 if (strstr(line, "vc4")) {
72 vc4 = true;
73 break;
74 }
75 }
76 free(line);
77 fclose(g);
78 if (!vc4 && raspi) {
79 fprintf(stderr, "\x1B[1;31mWarning: You have a "
80 "Raspberry Pi, but the vc4 Module is "
81 "not loaded! Set 'dtoverlay=vc4-kms-v3d'"
82 "in /boot/config.txt and reboot.\x1B[0m\n");
83 }
84}
85
86void detect_proprietary(int allow_unsupported_gpu) { 50void detect_proprietary(int allow_unsupported_gpu) {
87 FILE *f = fopen("/proc/modules", "r"); 51 FILE *f = fopen("/proc/modules", "r");
88 if (!f) { 52 if (!f) {
@@ -245,7 +209,7 @@ static void handle_wlr_log(enum wlr_log_importance importance,
245int main(int argc, char **argv) { 209int main(int argc, char **argv) {
246 static int verbose = 0, debug = 0, validate = 0, allow_unsupported_gpu = 0; 210 static int verbose = 0, debug = 0, validate = 0, allow_unsupported_gpu = 0;
247 211
248 static struct option long_options[] = { 212 static const struct option long_options[] = {
249 {"help", no_argument, NULL, 'h'}, 213 {"help", no_argument, NULL, 'h'},
250 {"config", required_argument, NULL, 'c'}, 214 {"config", required_argument, NULL, 'c'},
251 {"validate", no_argument, NULL, 'C'}, 215 {"validate", no_argument, NULL, 'C'},
@@ -344,11 +308,11 @@ int main(int argc, char **argv) {
344 } 308 }
345 309
346 sway_log(SWAY_INFO, "Sway version " SWAY_VERSION); 310 sway_log(SWAY_INFO, "Sway version " SWAY_VERSION);
311 sway_log(SWAY_INFO, "wlroots version " WLR_VERSION_STR);
347 log_kernel(); 312 log_kernel();
348 log_distro(); 313 log_distro();
349 log_env(); 314 log_env();
350 detect_proprietary(allow_unsupported_gpu); 315 detect_proprietary(allow_unsupported_gpu);
351 detect_raspi();
352 316
353 if (optind < argc) { // Behave as IPC client 317 if (optind < argc) { // Behave as IPC client
354 if (optind != 1) { 318 if (optind != 1) {