diff --git a/main.c b/main.c
index 90bc8adba9e83690dfd46b62b1c62f06bff054b0..e1ea2ef2b6fd5fc04f11ef65ea4d4562d31aed81 100644
--- a/main.c
+++ b/main.c
@@ -11,24 +11,33 @@
 
 int main(int argc, char *argv[])
 {
-	bool json = false;
+	bool json = false, input = false;
 
 	int opt;
-	while ((opt = getopt(argc, argv, "j")) != -1) {
+	while ((opt = getopt(argc, argv, "ji")) != -1) {
 		switch (opt) {
 		case 'j':
 			json = true;
 			break;
+		case 'i':
+			input = true;
+			break;
 		default:
-			fprintf(stderr, "usage: drm_info [-j] [--] [path]...\n");
+			fprintf(stderr, "usage: drm_info [-j] [-i] [--] [path]...\n");
 			exit(opt == '?' ? EXIT_SUCCESS : EXIT_FAILURE);
 		}
 	}
 
-	struct json_object *obj = drm_info(&argv[optind]);
+	struct json_object *obj;
+	if (input) {
+		obj = json_object_from_fd(STDIN_FILENO);
+	} else {
+		obj = drm_info(&argv[optind]);
+	}
 	if (!obj) {
 		exit(EXIT_FAILURE);
 	}
+
 	if (json) {
 		json_object_to_fd(STDOUT_FILENO, obj,
 			JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);