diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-08-14 17:33:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-14 17:33:01 -0400 |
commit | 4fc9ef480a8d6358ef3d58856d27a65a86eae2b3 (patch) | |
tree | d4bba602387399eb3d8a321c62a2bf8777eb2c69 /sway/main.c | |
parent | 1424964fcd524969671a87a20582c3cc659922b3 (diff) | |
parent | fc6c824320adb459a453aa77bd7bcdacd8e74397 (diff) |
Merge branch 'master' into locale
Diffstat (limited to 'sway/main.c')
-rw-r--r-- | sway/main.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sway/main.c b/sway/main.c index 82375e0b..6d13955c 100644 --- a/sway/main.c +++ b/sway/main.c @@ -53,6 +53,46 @@ static void wlc_log_handler(enum wlc_log_type type, const char *str) { } } +void detect_raspi() { + bool raspi = false; + FILE *f = fopen("/sys/firmware/devicetree/base/model", "r"); + if (!f) { + return; + } + char *line; + while(!feof(f)) { + if (!(line = read_line(f))) { + break; + } + if (strstr(line, "Raspberry Pi")) { + raspi = true; + } + free(line); + } + fclose(f); + FILE *g = fopen("/proc/modules", "r"); + if (!g) { + return; + } + bool vc4 = false; + while (!feof(g)) { + if (!(line = read_line(g))) { + break; + } + if (strstr(line, "vc4")) { + vc4 = true; + } + free(line); + } + fclose(g); + if (!vc4 && raspi) { + fprintf(stderr, "\x1B[1;31mWarning: You have a " + "Raspberry Pi, but the vc4 Module is " + "not loaded! Set 'dtoverlay=vc4-kms-v3d'" + "in /boot/config.txt and reboot.\x1B[0m\n"); + } +} + void detect_proprietary() { FILE *f = fopen("/proc/modules", "r"); if (!f) { @@ -366,6 +406,7 @@ int main(int argc, char **argv) { log_distro(); log_env(); detect_proprietary(); + detect_raspi(); input_devices = create_list(); |