summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dynamicdevice.c10
-rw-r--r--dynamite.c1
-rw-r--r--udev.c9
-rw-r--r--udev.h1
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);
diff --git a/dynamite.c b/dynamite.c
index 428ea64..bcfb5c4 100644
--- a/dynamite.c
+++ b/dynamite.c
@@ -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();
diff --git a/udev.c b/udev.c
index 0c4567b..a211682 100644
--- a/udev.c
+++ b/udev.c
@@ -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)
diff --git a/udev.h b/udev.h
index 41fba5a..c062b98 100644
--- a/udev.h
+++ b/udev.h
@@ -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;