summaryrefslogtreecommitdiff
path: root/udev.h
blob: 23f8f5b5af5858634db749c96aa74dbd18b13432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef __PVRINPUT_UDEV_H
#define __PVRINPUT_UDEV_H

#include <libudev.h>

#include <vdr/tools.h>

class cUdevListEntry {
private:
  struct udev_list_entry *listEntry;
public:
  cUdevListEntry(struct udev_list_entry *ListEntry);
  virtual ~cUdevListEntry(void);
  
  cUdevListEntry *GetNext(void) const;
  const char *GetName(void) const;
  const char *GetValue(void) const;
  };

class cUdevDevice : public cListObject {
private:
  struct udev_device *device;
  bool doUnref;
public:
  cUdevDevice(udev_device *Device, bool DoUnref = true);
  virtual ~cUdevDevice(void);
  virtual int Compare(const cListObject &ListObject) const;

  const char  *GetAction(void) const;
  cUdevListEntry *GetDevlinksList(void) const;
  const char  *GetDevnode(void) const;
  const char  *GetDevpath(void) const;
  cUdevDevice *GetParent(void) const;
  const char  *GetPropertyValue(const char *Key) const;
  const char  *GetSubsystem(void) const;
  const char  *GetSysname(void) const;
  const char  *GetSyspath(void) const;
  };

class cUdev {
private:
  static struct udev *udev;
public:
  static struct udev *Init(void);
  static void Free(void);
  static cUdevDevice *GetDeviceFromDevName(const char *DevName);
  static cUdevDevice *GetDeviceFromSysPath(const char *SysPath);
  static cList<cUdevDevice> *EnumDevices(const char *Subsystem, const char *Property, const char *Value);
  };

#endif // __PVRINPUT_UDEV_H