diff options
-rw-r--r-- | dynamicdevice.c | 10 | ||||
-rw-r--r-- | dynamite.c | 1 | ||||
-rw-r--r-- | udev.c | 9 | ||||
-rw-r--r-- | udev.h | 1 |
4 files changed, 18 insertions, 3 deletions
diff --git a/dynamicdevice.c b/dynamicdevice.c index e506f23..fb27887 100644 --- a/dynamicdevice.c +++ b/dynamicdevice.c @@ -181,12 +181,16 @@ cString cDynamicDevice::AttachDevicePattern(const char *Pattern) { if (!Pattern) return "invalid pattern"; + cStringList paths; cString reply; glob_t result; if (glob(Pattern, GLOB_MARK, 0, &result) == 0) { - for (uint i = 0; i < result.gl_pathc; i++) { - cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcAttach, result.gl_pathv[i]); - reply = cString::sprintf("%squeued %s for attaching\n", (i == 0) ? "" : *reply, result.gl_pathv[i]); + for (uint g = 0; g < result.gl_pathc; g++) + paths.Append(strdup(result.gl_pathv[g])); + paths.Sort(false); + for (int i = 0; i < paths.Size(); i++) { + cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcAttach, paths[i]); + reply = cString::sprintf("%squeued %s for attaching\n", (i == 0) ? "" : *reply, paths[i]); } } globfree(&result); @@ -290,6 +290,7 @@ bool cPluginDynamite::Initialize(void) // look for all dvb devices cList<cUdevDevice> *devices = cUdev::EnumDevices("dvb", "DVB_DEVICE_TYPE", "frontend"); if (devices != NULL) { + devices->Sort(); int dummy = 0; for (cUdevDevice *d = devices->First(); d; d = devices->Next(d)) { const char *devpath = d->GetDevnode(); @@ -50,6 +50,15 @@ cUdevDevice::~cUdevDevice(void) udev_device_unref(device); } +int cUdevDevice::Compare(const cListObject &ListObject) const +{ + const char *n1 = GetDevnode(); + const char *n2 = ((cUdevDevice*)&ListObject)->GetDevnode(); + if ((n1 != NULL) && (n2 != NULL)) + return strcmp(n1, n2); + return 0; +} + const char *cUdevDevice::GetAction(void) const { if (device == NULL) @@ -24,6 +24,7 @@ private: 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; |