summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_debugfs.c27
-rw-r--r--lib/igt_debugfs.h1
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 937952fb..a3aca846 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -237,6 +237,33 @@ int igt_debugfs_dir(int device)
}
/**
+ * igt_debugfs_connector_dir:
+ * @device: fd of the device
+ * @conn_name: conenctor name
+ * @mode: mode bits as used by open()
+ *
+ * This opens the debugfs directory corresponding to connector on the device
+ * for use with igt_sysfs_get() and related functions.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_debugfs_connector_dir(int device, char *conn_name, int mode)
+{
+ int dir, ret;
+
+ dir = igt_debugfs_dir(device);
+ if (dir < 0)
+ return dir;
+
+ ret = openat(dir, conn_name, mode);
+
+ close(dir);
+
+ return ret;
+}
+
+/**
* igt_debugfs_open:
* @filename: name of the debugfs node to open
* @mode: mode bits as used by open()
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 58ca07f5..1233cd8f 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -35,6 +35,7 @@ const char *igt_debugfs_mount(void);
char *igt_debugfs_path(int device, char *path, int pathlen);
int igt_debugfs_dir(int device);
+int igt_debugfs_connector_dir(int device, char *conn_name, int mode);
int igt_debugfs_open(int fd, const char *filename, int mode);
void __igt_debugfs_read(int fd, const char *filename, char *buf, int size);