Ticket #6137: mythtv-libudev.patch

File mythtv-libudev.patch, 3.0 KB (added by manuel@…, 11 years ago)

Patch to use libudev instead of udevinfo

  • mythtv/configure

    old new  
    11991199    ivtv
    12001200    joystick_menu
    12011201    libfftw3
     1202    libudev
    12021203    lirc
    12031204    mheg
    12041205    opengl_video
     
    16111612enable ivtv
    16121613enable lamemp3
    16131614enable lirc
     1615enable libudev
    16141616enable mheg
    16151617enable opengl
    16161618enable opengl_vsync
     
    30363038disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
    30373039disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
    30383040
     3041# Attempt to use libudev for mediamonitor
     3042if test $target_os = linux; then
     3043    check_lib2 libudev.h udev_new || enable libudev
     3044fi
     3045
    30393046enabled ffmpeg_pthreads && enable pthreads
    30403047
    30413048# check for some common methods of building with pthread support
     
    42234230  echo "CONFIG_OPENGL_LIBS=-lGL -lGLU" >> $MYTH_CONFIG_MAK
    42244231fi
    42254232
     4233if enabled libudev; then
     4234  echo "CONFIG_LIBUDEV_LIBS=-ludev" >> $MYTH_CONFIG_MAK
     4235fi
     4236
    42264237if test x"$CCONFIG" != x"" ; then
    42274238  echo "CCONFIG=$CCONFIG" >> $MYTH_CONFIG_MAK
    42284239  echo "#define MYTH_BUILD_CONFIG \"$CCONFIG\"" >>$TMPH
     
    42444255  echo "GCC_MINOR=$GCC_MINOR" >> $MYTH_CONFIG_MAK
    42454256fi
    42464257
     4258
    42474259echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
    42484260
    42494261cat <<EOF >> $MYTH_CONFIG_MAK
  • mythtv/libs/libmyth/libmyth.pro

    old new  
    7575LIBS += -L../libavcodec          -lmythavcodec-$${LIBVERSION}
    7676LIBS += -L../libavutil           -lmythavutil-$${LIBVERSION}
    7777unix:LIBS += -ldl
     78using_libudev:LIBS += $${CONFIG_LIBUDEV_LIBS}
    7879
    7980TARGETDEPS += ../libmythsamplerate/libmythsamplerate-$${MYTH_LIB_EXT}
    8081TARGETDEPS += ../libmythsoundtouch/libmythsoundtouch-$${MYTH_LIB_EXT}
  • mythtv/libs/libmyth/mediamonitor-unix.cpp

    old new  
    3939#include "mythhdd.h"
    4040#include "mythverbose.h"
    4141
     42// Linux headers
     43#ifdef linux
     44#if CONFIG_LIBUDEV == 1
     45extern "C" {
     46#include <libudev.h>
     47}
     48#endif
     49#endif
     50
    4251#ifndef MNTTYPE_ISO9660
    4352#ifdef linux
    4453#define MNTTYPE_ISO9660 "iso9660"
     
    219228    ret.replace(QRegExp(".*/"), "/dev/");
    220229
    221230#ifdef linux
     231#if CONFIG_LIBUDEV == 1
     232    // Use libudev to determine the name
     233    ret = "";
     234    struct udev *udev = udev_new();
     235    if (udev != NULL)
     236    {
     237        struct udev_device *device =
     238            udev_device_new_from_syspath(udev, sysfs.toAscii().constData());
     239        if (device != NULL)
     240        {
     241            const char *name = udev_device_get_devnode(device);
     242
     243            if (name != NULL)
     244                ret = tr(name);
     245
     246            udev_device_unref(device);
     247        }
     248        udev_unref(udev);
     249    }
     250#else   // CONFIG_LIBUDEV
     251    // Use udevinfo to determine the name
    222252    QProcess    *udevinfo = new QProcess();
    223253    QTextStream  stream(udevinfo);
    224254    QStringList  args;
     
    263293        return ret;
    264294
    265295    udevinfo->deleteLater();
     296#endif  // CONFIG_LIBUDEV
    266297#endif // linux
    267298
    268299    VERBOSE(VB_MEDIA, msg + "->'" + ret + "'");