Resolves #690123 - solid-udisks: Constant spinning of DVD drive when
selecting dolphin
This commit is contained in:
parent
e0348dd554
commit
e5e0930922
63
kdelibs-4.9.2-optdiscspin.patch
Normal file
63
kdelibs-4.9.2-optdiscspin.patch
Normal file
@ -0,0 +1,63 @@
|
||||
diff --git a/solid/solid/backends/udisks/udisksopticaldisc.cpp b/solid/solid/backends/udisks/udisksopticaldisc.cpp
|
||||
index 42272aa..8eb3588 100644
|
||||
--- a/solid/solid/backends/udisks/udisksopticaldisc.cpp
|
||||
+++ b/solid/solid/backends/udisks/udisksopticaldisc.cpp
|
||||
@@ -25,8 +25,15 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <QtCore/QFile>
|
||||
+#include <QtCore/QMap>
|
||||
+#include <QtCore/QMutexLocker>
|
||||
|
||||
#include "udisksopticaldisc.h"
|
||||
+#include "soliddefs_p.h"
|
||||
+
|
||||
+typedef QMap<QString, Solid::OpticalDisc::ContentTypes> ContentTypesCache;
|
||||
+SOLID_GLOBAL_STATIC(ContentTypesCache, cache)
|
||||
+SOLID_GLOBAL_STATIC(QMutex, cacheLock)
|
||||
|
||||
// inspired by http://cgit.freedesktop.org/hal/tree/hald/linux/probing/probe-volume.c
|
||||
static Solid::OpticalDisc::ContentType advancedDiscDetect(const QString & device_file)
|
||||
@@ -234,6 +241,16 @@ Solid::OpticalDisc::ContentTypes OpticalDisc::availableContent() const
|
||||
}
|
||||
|
||||
if (m_needsReprobe) {
|
||||
+ QMutexLocker lock(cacheLock);
|
||||
+
|
||||
+ QString deviceFile = m_device->prop("DeviceFile").toString();
|
||||
+
|
||||
+ if (cache->contains(deviceFile)) {
|
||||
+ m_cachedContent = cache->value(deviceFile);
|
||||
+ m_needsReprobe = false;
|
||||
+ return m_cachedContent;
|
||||
+ }
|
||||
+
|
||||
m_cachedContent = Solid::OpticalDisc::NoContent;
|
||||
bool hasData = m_device->prop("OpticalDiscNumTracks").toInt() > 0 &&
|
||||
m_device->prop("OpticalDiscNumTracks").toInt() > m_device->prop("OpticalDiscNumAudioTracks").toInt();
|
||||
@@ -241,12 +258,14 @@ Solid::OpticalDisc::ContentTypes OpticalDisc::availableContent() const
|
||||
|
||||
if ( hasData ) {
|
||||
m_cachedContent |= Solid::OpticalDisc::Data;
|
||||
- m_cachedContent |= advancedDiscDetect(m_device->prop("DeviceFile").toString());
|
||||
+ m_cachedContent |= advancedDiscDetect(deviceFile);
|
||||
}
|
||||
if ( hasAudio )
|
||||
m_cachedContent |= Solid::OpticalDisc::Audio;
|
||||
|
||||
m_needsReprobe = false;
|
||||
+
|
||||
+ cache->insert(deviceFile, m_cachedContent);
|
||||
}
|
||||
|
||||
return m_cachedContent;
|
||||
@@ -254,7 +273,8 @@ Solid::OpticalDisc::ContentTypes OpticalDisc::availableContent() const
|
||||
|
||||
void OpticalDisc::slotChanged()
|
||||
{
|
||||
+ QMutexLocker lock(cacheLock);
|
||||
m_needsReprobe = true;
|
||||
m_cachedContent = Solid::OpticalDisc::NoContent;
|
||||
+ cache->remove(m_device->prop("DeviceFile").toString());
|
||||
}
|
||||
-
|
@ -2017,10 +2017,10 @@ index 0000000..7cf0a72
|
||||
+#endif // UDISKS2MANAGER_H
|
||||
diff --git a/solid/solid/backends/udisks2/udisksopticaldisc.cpp b/solid/solid/backends/udisks2/udisksopticaldisc.cpp
|
||||
new file mode 100644
|
||||
index 0000000..650f0f7
|
||||
index 0000000..dc5256d
|
||||
--- /dev/null
|
||||
+++ b/solid/solid/backends/udisks2/udisksopticaldisc.cpp
|
||||
@@ -0,0 +1,277 @@
|
||||
@@ -0,0 +1,297 @@
|
||||
+/*
|
||||
+ Copyright 2010 Michael Zanetti <mzanetti@kde.org>
|
||||
+ Copyright 2010 - 2012 Lukáš Tinkl <ltinkl@redhat.com>
|
||||
@ -2048,12 +2048,19 @@ index 0000000..650f0f7
|
||||
+#include <fcntl.h>
|
||||
+
|
||||
+#include <QtCore/QFile>
|
||||
+#include <QtCore/QMap>
|
||||
+#include <QtCore/QMutexLocker>
|
||||
+#include <QtDBus/QDBusConnection>
|
||||
+
|
||||
+#include "../shared/udevqt.h"
|
||||
+
|
||||
+#include "udisks2.h"
|
||||
+#include "udisksopticaldisc.h"
|
||||
+#include "soliddefs_p.h"
|
||||
+
|
||||
+typedef QMap<QByteArray, Solid::OpticalDisc::ContentTypes> ContentTypesCache;
|
||||
+SOLID_GLOBAL_STATIC(ContentTypesCache, cache)
|
||||
+SOLID_GLOBAL_STATIC(QMutex, cacheLock)
|
||||
+
|
||||
+// inspired by http://cgit.freedesktop.org/hal/tree/hald/linux/probing/probe-volume.c
|
||||
+static Solid::OpticalDisc::ContentType advancedDiscDetect(const QByteArray & device_file)
|
||||
@ -2267,18 +2274,29 @@ index 0000000..650f0f7
|
||||
+ }
|
||||
+
|
||||
+ if (m_needsReprobe) {
|
||||
+ QMutexLocker lock(cacheLock);
|
||||
+
|
||||
+ const QByteArray deviceFile = m_device->prop("Device").toByteArray();
|
||||
+
|
||||
+ if (cache->contains(deviceFile)) {
|
||||
+ m_cachedContent = cache->value(deviceFile);
|
||||
+ m_needsReprobe = false;
|
||||
+ return m_cachedContent;
|
||||
+ }
|
||||
+
|
||||
+ m_cachedContent = Solid::OpticalDisc::NoContent;
|
||||
+ const bool hasData = m_drive->prop("OpticalNumDataTracks").toUInt() > 0;
|
||||
+ const bool hasAudio = m_drive->prop("OpticalNumAudioTracks").toUInt() > 0;
|
||||
+
|
||||
+ if ( hasData ) {
|
||||
+ m_cachedContent |= Solid::OpticalDisc::Data;
|
||||
+ m_cachedContent |= advancedDiscDetect(m_device->prop("Device").toByteArray());
|
||||
+ m_cachedContent |= advancedDiscDetect(deviceFile);
|
||||
+ }
|
||||
+ if ( hasAudio )
|
||||
+ m_cachedContent |= Solid::OpticalDisc::Audio;
|
||||
+
|
||||
+ m_needsReprobe = false;
|
||||
+ cache->insert(deviceFile, m_cachedContent);
|
||||
+ }
|
||||
+
|
||||
+ return m_cachedContent;
|
||||
@ -2289,8 +2307,10 @@ index 0000000..650f0f7
|
||||
+ Q_UNUSED(ifaceName);
|
||||
+
|
||||
+ if (changedProps.keys().contains("Media") || invalidatedProps.contains("Media")) {
|
||||
+ QMutexLocker lock(cacheLock);
|
||||
+ m_needsReprobe = true;
|
||||
+ m_cachedContent = Solid::OpticalDisc::NoContent;
|
||||
+ cache->remove(m_device->prop("Device").toByteArray());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
10
kdelibs.spec
10
kdelibs.spec
@ -25,7 +25,7 @@
|
||||
|
||||
Summary: KDE Libraries
|
||||
Version: 4.9.1
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
|
||||
Name: kdelibs
|
||||
Epoch: 6
|
||||
@ -146,6 +146,7 @@ Patch54: kdelibs-4.8.4-kjs-locale.patch
|
||||
Patch55: kdelibs-4.9.1-udisks_detatch_external_hdd.patch
|
||||
|
||||
## upstream
|
||||
Patch100: kdelibs-4.9.2-optdiscspin.patch
|
||||
|
||||
## security fix
|
||||
# Not Upstreamed? why not ? -- Rex
|
||||
@ -316,6 +317,7 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
|
||||
%patch55 -p1 -b .solid-detach-external-hdd
|
||||
|
||||
# upstream patches
|
||||
%patch100 -p1 -b .optdiscspin
|
||||
|
||||
# security fixes
|
||||
%patch200 -p1 -b .CVE-2009-2702
|
||||
@ -571,7 +573,11 @@ rm -rf %{buildroot}
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Sep 04 2012 Lukas Tinkl <ltinkl@redhat.com> - 6:4.9.1-2
|
||||
* Wed Sep 19 2012 Lukas Tinkl <ltinkl@redhat.com> - 6:4.9.1-3
|
||||
- Resolves #690123 - solid-udisks: Constant spinning of DVD drive when
|
||||
selecting dolphin
|
||||
|
||||
* Tue Sep 04 2012 Lukas Tinkl <ltinkl@redhat.com> - 6:4.9.1-2
|
||||
- rebase udisks2 backend against KDE/4.10 branch
|
||||
|
||||
* Mon Sep 03 2012 Than Ngo <than@redhat.com> - 6:4.9.1-1
|
||||
|
Loading…
Reference in New Issue
Block a user