Ticket #6137: 40_libudev.patch

File 40_libudev.patch, 2.6 KB (added by Daviey, 11 years ago)
  • configure

    a b  
    12911291    ivtv
    12921292    joystick_menu
    12931293    libfftw3
     1294    libudev
    12941295    lirc
    12951296    mheg
    12961297    opengl_video
     
    17761777enable ivtv
    17771778enable lamemp3
    17781779enable lirc
     1780enable libudev
    17791781enable mheg
    17801782enable opengl
    17811783enable opengl_vsync
     
    34223424disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
    34233425disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
    34243426
     3427# Attempt to use libudev for mediamonitor
     3428if test $target_os = linux; then
     3429    check_lib2 libudev.h udev_new -ludev || disable libudev
     3430fi
     3431
    34253432enabled ffmpeg_pthreads && enable pthreads
    34263433
    34273434# check for some common methods of building with pthread support
     
    45634570  echo "PERL_CONFIG_OPTS=$PERL_CONFIG_OPTS" >> $MYTH_CONFIG_MAK
    45644571fi
    45654572
     4573if enabled libudev; then
     4574  echo "CONFIG_LIBUDEV_LIBS=-ludev" >> $MYTH_CONFIG_MAK
     4575fi
     4576
    45664577if test x"$CCONFIG" != x"" ; then
    45674578  echo "CCONFIG=$CCONFIG" >> $MYTH_CONFIG_MAK
    45684579  echo "#define MYTH_BUILD_CONFIG \"$CCONFIG\"" >>$TMPH
  • libs/libmyth/libmyth.pro

    a b  
    7979LIBS += -L../libavcodec          -lmythavcodec-$${LIBVERSION}
    8080LIBS += -L../libavutil           -lmythavutil-$${LIBVERSION}
    8181unix:LIBS += -ldl
     82using_libudev:LIBS += $${CONFIG_LIBUDEV_LIBS}
    8283
    8384TARGETDEPS += ../libmythsamplerate/libmythsamplerate-$${MYTH_LIB_EXT}
    8485TARGETDEPS += ../libmythsoundtouch/libmythsoundtouch-$${MYTH_LIB_EXT}
  • libs/libmyth/mediamonitor-unix.cpp

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