MythTV master
mediamonitor-unix.h
Go to the documentation of this file.
1#ifndef MYTH_MEDIA_MONITOR_UNIX_H
2#define MYTH_MEDIA_MONITOR_UNIX_H
3
4#define DEFAULT_DVD "/dev/dvd"
5#define DEFAULT_CD "/dev/cdrom"
6
7#include "libmythbase/mythconfig.h"
8
9#include <QString>
10#if CONFIG_QTDBUS
11#include <QDBusObjectPath>
12#endif
13
14#include "mediamonitor.h"
15
17{
18#if CONFIG_QTDBUS
19 Q_OBJECT
20 public slots:
21 Q_NOREPLY void deviceAdded(const QDBusObjectPath& o,
22 const QMap<QString, QVariant> &interfaces);
23 Q_NOREPLY void deviceRemoved(const QDBusObjectPath& o,
24 const QStringList &interfaces);
25#endif
26
27 public:
28 MediaMonitorUnix(QObject *par, unsigned long interval, bool allowEject);
29#if !CONFIG_QTDBUS
30 void deleteLater(void) override; // MediaMonitor
31#endif
32
33 protected:
34 ~MediaMonitorUnix() override = default;
35
36#if !CONFIG_QTDBUS
37 void CheckDeviceNotifications(void) override; // MediaMonitor
38#endif
39 bool CheckFileSystemTable(void);
40 bool CheckMountable(void);
41#if !CONFIG_QTDBUS
42 static bool CheckRemovable(const QString &dev);
43 bool FindPartitions(const QString &dev, bool checkPartitions);
44#endif
45
46 bool AddDevice(MythMediaDevice* pDevice) override; // MediaMonitor
47 bool AddDevice(struct fstab* mep);
48
49#if !CONFIG_QTDBUS
50 static QString GetDeviceFile(const QString &sysfs);
51#endif
52
53 QStringList GetCDROMBlockDevices(void) override; // MediaMonitor
54
55 protected:
56 int m_fifo {-1};
57 static constexpr const char *kUDEV_FIFO { "/tmp/mythtv_media" };
58;
59};
60
61#if CONFIG_QTDBUS
62 enum MythUdisksDevice
63 {
64 UDisks2INVALID = 0,
65 UDisks2DVD = 1,
66 UDisks2HDD = 2,
67 };
68#endif
69#endif // MYTH_MEDIA_MONITOR_H
static bool CheckRemovable(const QString &dev)
Is /sys/block/dev a removable device?
bool AddDevice(MythMediaDevice *pDevice) override
CONFIG_QTDBUS.
MediaMonitorUnix(QObject *par, unsigned long interval, bool allowEject)
bool CheckMountable(void)
Search /sys/block for valid removable media devices.
bool FindPartitions(const QString &dev, bool checkPartitions)
Creates MythMedia instances for sysfs removable media devices.
QStringList GetCDROMBlockDevices(void) override
bool CheckFileSystemTable(void)
void deleteLater(void) override
void CheckDeviceNotifications(void) override
Checks the named pipe, kUDEV_FIFO, for hotplug events from the udev system.
~MediaMonitorUnix() override=default
static QString GetDeviceFile(const QString &sysfs)
Returns the device special file associated with the /sys/block node.
static constexpr const char * kUDEV_FIFO