summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangyeon Lee <cyeon.lee@samsung.com>2024-07-02 19:32:45 +0900
committerChangyeon Lee <cyeon.lee@samsung.com>2024-07-02 19:36:33 +0900
commitba89351616e7070fe84c669b8b0c63ec046de463 (patch)
tree72b690560a912185642ae4d338cf60d2a24444be
parent214c20941c629e4597f89f87dcc92aa10c56957b (diff)
downloadlibtdm-drm-ba89351616e7070fe84c669b8b0c63ec046de463.tar.gz
libtdm-drm-ba89351616e7070fe84c669b8b0c63ec046de463.tar.bz2
libtdm-drm-ba89351616e7070fe84c669b8b0c63ec046de463.zip
Check file path of the drm node
if file path of the drm node is not exsit, this patch makes to use another the drm node. Change-Id: I8346f70cf1a5534fa96396a0344f42b6e81e2f48
-rw-r--r--src/tdm_backend_drm.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tdm_backend_drm.c b/src/tdm_backend_drm.c
index ac8c091..36b809e 100644
--- a/src/tdm_backend_drm.c
+++ b/src/tdm_backend_drm.c
@@ -87,13 +87,22 @@ fail:
return 0;
}
+static int
+_tdm_drm_file_check(const char *filepath)
+{
+ if(access(filepath, F_OK) != -1)
+ return 1;
+
+ return 0;
+}
+
static struct udev_device *
_tdm_drm_find_primary_gpu(void)
{
struct udev *udev;
struct udev_enumerate *e;
struct udev_list_entry *entry;
- const char *path, *id;
+ const char *path, *id, *filename;
struct udev_device *device, *drm_device, *pci;
udev = udev_new();
@@ -129,6 +138,12 @@ _tdm_drm_find_primary_gpu(void)
continue;
}
+ filename = udev_device_get_devnode(device);
+ if (!_tdm_drm_file_check(filename)) {
+ udev_device_unref(device);
+ continue;
+ }
+
if (!_tdm_drm_is_kms(device)) {
udev_device_unref(device);
continue;