Skip to content
Snippets Groups Projects
Commit 7cd577e6 authored by _ _'s avatar _ _
Browse files

unl0kr: select an available DRM device instead of a hard-coded one

parent 72a4220f
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@
#include <unistd.h>
#include <sys/reboot.h>
#include <sys/stat.h>
#include <sys/time.h>
......@@ -420,7 +421,23 @@ int main(int argc, char *argv[]) {
case UL_BACKENDS_BACKEND_DRM:
bbx_log(BBX_LOG_LEVEL_VERBOSE, "Using DRM backend");
disp = lv_linux_drm_create();
lv_linux_drm_set_file(disp, "/dev/dri/card0", -1);
char *format_string = "/dev/dri/card%d";
char drm_path[16] = {0};
struct stat buffer;
for (size_t i = 0; i < 9; i++) {
sprintf(drm_path, format_string, i);
if (stat(drm_path, &buffer) != 0) {
continue;
}
lv_linux_drm_set_file(disp, drm_path, -1);
break;
}
break;
#endif /* LV_USE_LINUX_DRM */
default:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment