summaryrefslogtreecommitdiff
path: root/Userland/Utilities/edid-dump.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-05-21 19:38:50 +0300
committerLinus Groh <mail@linusgroh.de>2022-05-27 22:27:44 +0100
commit58b46d9e37469dc4497867b2424cf8f23dde4db4 (patch)
tree92a58902968186cd7c9cee3d3e668ef6ab96972e /Userland/Utilities/edid-dump.cpp
parent606cfc4d48bf936e2ab03449c1dbd7f40fcd9e35 (diff)
downloadserenity-58b46d9e37469dc4497867b2424cf8f23dde4db4.zip
Utilities: Add edid-dump program to dump EDID from Display connectors
Diffstat (limited to 'Userland/Utilities/edid-dump.cpp')
-rw-r--r--Userland/Utilities/edid-dump.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/Userland/Utilities/edid-dump.cpp b/Userland/Utilities/edid-dump.cpp
new file mode 100644
index 0000000000..2ac465b249
--- /dev/null
+++ b/Userland/Utilities/edid-dump.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/String.h>
+#include <AK/StringUtils.h>
+#include <LibCore/ArgsParser.h>
+#include <LibCore/System.h>
+#include <LibEDID/EDID.h>
+#include <LibMain/Main.h>
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+ErrorOr<int> serenity_main(Main::Arguments arguments)
+{
+ TRY(Core::System::pledge("stdio rpath wpath"));
+
+ StringView display_connector_file_name;
+ Core::ArgsParser args;
+ args.add_positional_argument(display_connector_file_name, "Display Connector Device Path", "display connector file name", Core::ArgsParser::Required::Yes);
+
+ args.parse(arguments);
+
+ auto edid = TRY(EDID::Parser::from_framebuffer_device(display_connector_file_name, 0));
+
+ out("{}", StringView { edid.bytes() });
+ return 0;
+}