libdrm: add udev support.
This patch allows you to --enable-udev, and will avoid having libdrm make device nodes. If you are using udev, you should really --enable-udev your libdrm.main
parent
0da66c27fa
commit
9101a0205c
|
@ -34,6 +34,9 @@ AC_SYS_LARGEFILE
|
||||||
|
|
||||||
pkgconfigdir=${libdir}/pkgconfig
|
pkgconfigdir=${libdir}/pkgconfig
|
||||||
AC_SUBST(pkgconfigdir)
|
AC_SUBST(pkgconfigdir)
|
||||||
|
AC_ARG_ENABLE(udev, AS_HELP_STRING([--enable-udev],
|
||||||
|
[Enable support for using udev instead of mknod (default: disabled)]),
|
||||||
|
[UDEV=$enableval], [UDEV=no])
|
||||||
|
|
||||||
|
|
||||||
dnl ===========================================================================
|
dnl ===========================================================================
|
||||||
|
@ -101,6 +104,10 @@ AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [
|
||||||
AC_MSG_CHECKING([which warning flags were supported])])
|
AC_MSG_CHECKING([which warning flags were supported])])
|
||||||
WARN_CFLAGS="$libdrm_cv_warn_cflags"
|
WARN_CFLAGS="$libdrm_cv_warn_cflags"
|
||||||
|
|
||||||
|
if test "x$UDEV" = xyes; then
|
||||||
|
AC_DEFINE(UDEV, 1, [Have UDEV support])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST(WARN_CFLAGS)
|
AC_SUBST(WARN_CFLAGS)
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
Makefile
|
||||||
|
|
|
@ -297,6 +297,7 @@ static int drmOpenDevice(long dev, int minor)
|
||||||
group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
|
group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(UDEV)
|
||||||
if (stat(DRM_DIR_NAME, &st)) {
|
if (stat(DRM_DIR_NAME, &st)) {
|
||||||
if (!isroot)
|
if (!isroot)
|
||||||
return DRM_ERR_NOT_ROOT;
|
return DRM_ERR_NOT_ROOT;
|
||||||
|
@ -317,6 +318,30 @@ static int drmOpenDevice(long dev, int minor)
|
||||||
chown(buf, user, group);
|
chown(buf, user, group);
|
||||||
chmod(buf, devmode);
|
chmod(buf, devmode);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/* if we modprobed then wait for udev */
|
||||||
|
{
|
||||||
|
int udev_count = 0;
|
||||||
|
wait_for_udev:
|
||||||
|
if (stat(DRM_DIR_NAME, &st)) {
|
||||||
|
usleep(20);
|
||||||
|
udev_count++;
|
||||||
|
|
||||||
|
if (udev_count == 50)
|
||||||
|
return -1;
|
||||||
|
goto wait_for_udev;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stat(buf, &st)) {
|
||||||
|
usleep(20);
|
||||||
|
udev_count++;
|
||||||
|
|
||||||
|
if (udev_count == 50)
|
||||||
|
return -1;
|
||||||
|
goto wait_for_udev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fd = open(buf, O_RDWR, 0);
|
fd = open(buf, O_RDWR, 0);
|
||||||
drmMsg("drmOpenDevice: open result is %d, (%s)\n",
|
drmMsg("drmOpenDevice: open result is %d, (%s)\n",
|
||||||
|
|
Loading…
Reference in New Issue