aboutsummaryrefslogtreecommitdiffstats
path: root/drmtools.c
diff options
context:
space:
mode:
Diffstat (limited to 'drmtools.c')
-rw-r--r--drmtools.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drmtools.c b/drmtools.c
index 563aa3b..ebe487a 100644
--- a/drmtools.c
+++ b/drmtools.c
@@ -42,13 +42,19 @@ static void drm_cleanup_display(void)
}
}
-static int drm_init_dev(const char *dev)
+static int drm_init_dev(const char *device)
{
drmModeRes *res;
+ char dev[64];
int i, rc;
uint64_t has_dumb;
/* open device */
+ if (device) {
+ snprintf(dev, sizeof(dev), "%s", device);
+ } else {
+ snprintf(dev, sizeof(dev), DRM_DEV_NAME, DRM_DIR_NAME, 0);
+ }
fd = open(dev, O_RDWR);
if (fd < 0) {
fprintf(stderr, "drm: open %s: %s\n", dev, strerror(errno));