FreeBSD Bugzilla – Attachment 75422 Details for
Bug 108949
[PATCH]: x11/kdebase3 [kioslave/media] media ejecting, various HAL backend problems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
kdebase3.diff
kdebase3.diff (text/plain), 13.31 KB, created by
Maxim Samsonov
on 2007-02-08 23:10:22 UTC
(
hide
)
Description:
kdebase3.diff
Filename:
MIME Type:
Creator:
Maxim Samsonov
Created:
2007-02-08 23:10:22 UTC
Size:
13.31 KB
patch
obsolete
>diff -ubdBrN kdebase3.orig/Makefile kdebase3/Makefile >--- kdebase3.orig/Makefile Mon Jan 8 13:35:52 2007 >+++ kdebase3/Makefile Thu Feb 8 23:51:24 2007 >@@ -71,7 +71,8 @@ > .endif > > .if defined(WITH_HAL) && ${OSVERSION} > 500035 >-EXTRA_PATCHES= ${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.cpp >+EXTRA_PATCHES= ${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.cpp \ >+ ${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.h > LIB_DEPENDS+= dbus-qt-1.1:${PORTSDIR}/devel/dbus-qt3 \ > hal.1:${PORTSDIR}/sysutils/hal > PLIST_SUB+= MEDIA="" >diff -ubdBrN kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp >--- kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp Wed Dec 20 23:42:54 2006 >+++ kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp Thu Feb 8 23:38:29 2007 >@@ -1,14 +1,43 @@ >---- kioslave/media/mediamanager/halbackend.cpp.orig Sun Oct 1 19:31:54 2006 >-+++ kioslave/media/mediamanager/halbackend.cpp Wed Dec 20 20:22:28 2006 >-@@ -17,7 +17,6 @@ >+--- kioslave/media/mediamanager/halbackend.cpp.orig Sun Oct 1 21:31:54 2006 >++++ kioslave/media/mediamanager/halbackend.cpp Tue Feb 6 02:14:55 2007 >+@@ -17,9 +17,13 @@ > */ > > #include "halbackend.h" > -#include "linuxcdpolling.h" > > #include <stdlib.h> >++#ifdef Q_OS_FREEBSD >++#include <sys/param.h> >++#include <sys/ucred.h> >++#include <sys/mount.h> >++#endif > >-@@ -242,11 +241,11 @@ >+ #include <qfile.h> >+ #include <klocale.h> >+@@ -66,6 +70,10 @@ >+ /* Close HAL connection */ >+ if (m_halContext) >+ { >++#ifdef Q_OS_FREEBSD >++ m_pollTimer.stop(); >++ m_pollMediaList.clear(); >++#endif >+ const QPtrList<Medium> medlist = m_mediaList.list(); >+ QPtrListIterator<Medium> it (medlist); >+ for ( const Medium *current_medium = it.current(); current_medium; current_medium = ++it) >+@@ -185,6 +193,10 @@ >+ >+ libhal_free_string_array( halDeviceList ); >+ >++#ifdef Q_OS_FREEBSD >++ connect(&m_pollTimer, SIGNAL(timeout()), >++ this, SLOT(pollMediaList())); >++#endif >+ return true; >+ } >+ >+@@ -242,11 +254,11 @@ > Medium* medium = new Medium(udi, ""); > > QMap<QString,QString> options = MediaManagerUtils::splitOptions(mountoptions(udi)); >@@ -22,7 +51,44 @@ > } > setVolumeProperties(medium); > m_mediaList.addMedium(medium, allowNotification); >-@@ -326,7 +325,7 @@ >+@@ -264,6 +276,11 @@ >+ Medium* medium = new Medium(udi, ""); >+ setFloppyProperties(medium); >+ m_mediaList.addMedium(medium, allowNotification); >++#ifdef Q_OS_FREEBSD >++ m_pollTimer.stop(); >++ m_pollMediaList.append(medium); >++ m_pollTimer.start(250); >++#endif >+ return; >+ } >+ >+@@ -285,12 +302,23 @@ >+ >+ void HALBackend::RemoveDevice(const char *udi) >+ { >++#ifdef Q_OS_FREEBSD >++ m_pollMediaList.remove(m_mediaList.findById(udi)); >++ if (m_pollMediaList.isEmpty()) >++ m_pollTimer.stop(); >++#endif >+ m_mediaList.removeMedium(udi, true); >+ } >+ >+ void HALBackend::ModifyDevice(const char *udi, const char* key) >+ { >+- Q_UNUSED(key); >++ if ( >++ !( strcmp(key, "info.hal_mount.created_mount_point") >++ && strcmp(key, "info.hal_mount.mounted_by_uid") >++ && strcmp(key, "volume.mount_point") >++ && strcmp(key, "volume.is_mounted_read_only"))) >++ return; >++ >+ const char* mediumUdi = findMediumUdiFromUdi(udi); >+ if (!mediumUdi) >+ return; >+@@ -326,7 +354,7 @@ > } > > const char* mediumUdi = findMediumUdiFromUdi(udi); >@@ -31,7 +97,7 @@ > if (!mediumUdi) > return; > >-@@ -384,7 +383,7 @@ >+@@ -384,7 +412,7 @@ > { > Medium m( *cmedium ); > if ( setFstabProperties( &m ) ) { >@@ -40,7 +106,15 @@ > m_mediaList.changeMediumState(m, false); > } > return; >-@@ -469,28 +468,23 @@ >+@@ -399,6 +427,7 @@ >+ setFloppyProperties(m); >+ if (libhal_device_query_capability(m_halContext, mediumUdi, "camera", NULL)) >+ setCameraProperties(m); >++ m->setHalMounted(libhal_device_get_property_string(m_halContext, mediumUdi, "info.hal_mount.created_mount_point", NULL)); >+ >+ m_mediaList.changeMediumState(*m, false); >+ >+@@ -469,28 +498,23 @@ > else > mimeType = "media/dvd" + MOUNT_SUFFIX; > >@@ -80,7 +154,7 @@ > } > else > { >-@@ -575,7 +569,7 @@ >+@@ -575,7 +599,7 @@ > } > } > >@@ -89,7 +163,7 @@ > QString fstype = medium->fsType(); > if ( fstype.isNull() ) > fstype = "auto"; >-@@ -762,7 +756,7 @@ >+@@ -762,7 +786,7 @@ > if (t.endsWith("=")) > t = t.left(t.length() - 1); > valids[t] = true; >@@ -98,7 +172,17 @@ > } > libhal_free_string_array(array); > QStringList result; >-@@ -887,7 +881,7 @@ >+@@ -882,12 +906,17 @@ >+ result << "journaling=ordered"; >+ } >+ >++ if (valids.contains("-C")) >++ { >++ result << QString("charset=%1").arg(KGlobal::locale()->encoding()); >++ } >++ >+ return result; >+ } > > bool HALBackend::setMountoptions(const QString &name, const QStringList &options ) > { >@@ -107,7 +191,7 @@ > > KConfig config("mediamanagerrc"); > config.setGroup(name); >-@@ -927,7 +921,7 @@ >+@@ -927,7 +956,7 @@ > if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", udi, > "org.freedesktop.Hal.Device.Volume", > "Mount"))) { >@@ -116,7 +200,7 @@ > return i18n("Internal Error"); > } > >-@@ -935,7 +929,7 @@ >+@@ -935,7 +964,7 @@ > DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &poptions, noptions, > DBUS_TYPE_INVALID)) > { >@@ -125,7 +209,7 @@ > dbus_message_unref (dmesg); > return i18n("Internal Error"); > } >-@@ -963,7 +957,7 @@ >+@@ -963,7 +992,7 @@ > return qerror; > } > >@@ -134,7 +218,7 @@ > > dbus_message_unref (dmesg); > dbus_message_unref (reply); >-@@ -974,7 +968,7 @@ >+@@ -974,15 +1003,33 @@ > > void HALBackend::slotResult(KIO::Job *job) > { >@@ -143,7 +227,34 @@ > if (job->error()) > { > KMessageBox::error(0, job->errorText()); >-@@ -992,7 +986,7 @@ >+ } >+- ResetProperties( mount_jobs[job].latin1() ); >+ mount_jobs.remove(job); >+ } >+ >++#ifdef Q_OS_FREEBSD >++void HALBackend::pollMediaList() >++{ >++ struct statfs *mntBuf; >++ int mntNum = getmntinfo(&mntBuf, MNT_NOWAIT); >++ QPtrList<Medium>::iterator it = m_pollMediaList.begin(); >++ QPtrList<Medium>::iterator end = m_pollMediaList.end(); >++ for (; it!=end; ++it) >++ { >++ bool mounted = false; >++ const char *dev = (*it)->deviceNode().ascii(); >++ for (int n = mntNum-1; n >= 0 && !mounted; n--) >++ mounted = !strcmp(dev, mntBuf[n].f_mntfromname); >++ if ((*it)->isMounted() != mounted) >++ ResetProperties((*it)->id().latin1()); >++ } >++} >++#endif >++ >+ QString HALBackend::isInFstab(const Medium *medium) >+ { >+ KMountPoint::List fstab = KMountPoint::possibleMountPoints(KMountPoint::NeedMountOptions|KMountPoint::NeedRealDeviceName); >+@@ -992,11 +1039,13 @@ > > for (; it!=end; ++it) > { >@@ -151,8 +262,14 @@ > + kdDebug(1219) << "isInFstab -" << medium->deviceNode() << "- -" << (*it)->realDeviceName() << "- -" << (*it)->mountedFrom() << endl; > if ((*it)->mountedFrom() == medium->deviceNode() || ( !medium->deviceNode().isEmpty() && (*it)->realDeviceName() == medium->deviceNode() ) ) > { >++#ifndef Q_OS_FREEBSD > QStringList opts = (*it)->mountOptions(); >-@@ -1012,7 +1006,7 @@ >+ if (opts.contains("user") || opts.contains("users")) >++#endif >+ return (*it)->mountPoint(); >+ } >+ } >+@@ -1012,7 +1061,7 @@ > QString mountPoint = isInFstab(medium); > if (!mountPoint.isNull()) > { >@@ -161,7 +278,7 @@ > KIO::Job *job = KIO::mount( false, 0, medium->deviceNode(), mountPoint ); > connect(job, SIGNAL( result (KIO::Job *)), > SLOT( slotResult( KIO::Job *))); >-@@ -1023,7 +1017,7 @@ >+@@ -1023,7 +1072,7 @@ > > QStringList soptions; > >@@ -170,7 +287,7 @@ > > QMap<QString,QString> valids = MediaManagerUtils::splitOptions(mountoptions(medium->id())); > if (valids["flush"] == "true") >-@@ -1036,10 +1030,10 @@ >+@@ -1036,10 +1085,10 @@ > > if (valids["ro"] == "true") > soptions << "ro"; >@@ -183,7 +300,29 @@ > if (valids["quiet"] == "true") > soptions << "quiet"; > >-@@ -1121,7 +1115,7 @@ >+@@ -1069,6 +1118,11 @@ >+ soptions << QString("data=ordered"); >+ } >+ >++ if (valids.contains("charset")) >++ { >++ soptions << QString("-C=%1").arg(valids["charset"]); >++ } >++ >+ const char **options = new const char*[soptions.size() + 1]; >+ uint noptions = 0; >+ for (QStringList::ConstIterator it = soptions.begin(); it != soptions.end(); ++it, ++noptions) >+@@ -1081,9 +1135,6 @@ >+ return qerror; >+ } >+ >+- medium->setHalMounted(true); >+- ResetProperties(medium->id().latin1()); >+- >+ return QString(); >+ } >+ >+@@ -1121,7 +1172,7 @@ > QString mountPoint = isInFstab(medium); > if (!mountPoint.isNull()) > { >@@ -192,7 +331,7 @@ > KIO::Job *job = KIO::unmount( medium->mountPoint(), false ); > connect(job, SIGNAL( result (KIO::Job *)), > SLOT( slotResult( KIO::Job *))); >-@@ -1134,7 +1128,7 @@ >+@@ -1134,7 +1185,7 @@ > const char *options[2]; > > const char *udi = medium->id().latin1(); >@@ -201,7 +340,7 @@ > > dbus_error_init(&error); > DBusConnection *dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); >-@@ -1147,7 +1141,7 @@ >+@@ -1147,7 +1198,7 @@ > if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", udi, > "org.freedesktop.Hal.Device.Volume", > "Unmount"))) { >@@ -210,7 +349,7 @@ > return i18n("Internal Error"); > } > >-@@ -1157,7 +1151,7 @@ >+@@ -1157,7 +1208,7 @@ > if (!dbus_message_append_args (dmesg, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, 0, > DBUS_TYPE_INVALID)) > { >@@ -219,7 +358,7 @@ > dbus_message_unref (dmesg); > return i18n("Internal Error"); > } >-@@ -1165,7 +1159,7 @@ >+@@ -1165,7 +1216,7 @@ > dbus_error_init (&error); > if (!(reply = dbus_connection_send_with_reply_and_block (dbus_connection, dmesg, -1, &error))) > { >@@ -228,7 +367,7 @@ > QString qerror = error.message; > if (!strcmp(error.name, "org.freedesktop.Hal.Device.Volume.Busy")) { > qerror = QString("<qt>") + i18n("Device is Busy:"); >-@@ -1201,7 +1195,7 @@ >+@@ -1201,13 +1252,10 @@ > return qerror; > } > >@@ -237,3 +376,9 @@ > > dbus_message_unref (dmesg); > dbus_message_unref (reply); >+- >+- medium->setHalMounted(false); >+- ResetProperties(udi); >+ >+ return QString(); >+ } >diff -ubdBrN kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.h kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.h >--- kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.h Thu Jan 1 03:00:00 1970 >+++ kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.h Thu Feb 8 23:38:41 2007 >@@ -0,0 +1,33 @@ >+--- kioslave/media/mediamanager/halbackend.h.orig Sun Jan 28 23:58:13 2007 >++++ kioslave/media/mediamanager/halbackend.h Thu Feb 1 02:51:48 2007 >+@@ -34,6 +34,9 @@ >+ #include <qobject.h> >+ #include <qstringlist.h> >+ #include <qstring.h> >++#ifdef Q_OS_FREEBSD >++#include <qtimer.h> >++#endif >+ >+ #include <config.h> >+ >+@@ -154,6 +157,9 @@ >+ >+ private slots: >+ void slotResult(KIO::Job *job); >++#ifdef Q_OS_FREEBSD >++ void pollMediaList(); >++#endif >+ >+ /* Hal call-backs -- from gvm*/ >+ public: >+@@ -217,6 +223,10 @@ >+ DBusConnection *dbus_connection; >+ >+ QMap<KIO::Job *, QString> mount_jobs; >++#ifdef Q_OS_FREEBSD >++ QTimer m_pollTimer; >++ QPtrList<Medium> m_pollMediaList; >++#endif >+ }; >+ >+ #endif /* _HALBACKEND_H_ */ >diff -ubdBrN kdebase3.orig/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp kdebase3/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp >--- kdebase3.orig/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp Thu Jan 1 03:00:00 1970 >+++ kdebase3/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp Thu Feb 8 23:43:59 2007 >@@ -0,0 +1,32 @@ >+--- kioslave/media/mounthelper/kio_media_mounthelper.cpp.orig Sat Jan 27 01:58:24 2007 >++++ kioslave/media/mounthelper/kio_media_mounthelper.cpp Sat Jan 27 02:35:28 2007 >+@@ -77,7 +77,9 @@ >+ m_isCdrom = medium.mimeType().find("dvd")!=-1 >+ || medium.mimeType().find("cd")!=-1; >+ >+- if (args->isSet("u")) >++ bool do_eject = args->isSet("s") || args->isSet("e"); >++ >++ if (args->isSet("u") || do_eject) >+ { >+ DCOPRef mediamanager("kded", "mediamanager"); >+ DCOPReply reply = mediamanager.call( "unmount", medium.id()); >+@@ -85,13 +87,14 @@ >+ reply.get(m_errorStr); >+ kdDebug() << "medium unmount " << m_errorStr << endl; >+ if (m_errorStr.isNull()) >++ { >++ if( do_eject ) >++ invokeEject(device, true); >++ else >+ ::exit(0); >++ } >+ else >+ error(); >+- } >+- else if (args->isSet("s") || args->isSet("e")) >+- { >+- invokeEject(device, true); >+ } >+ else >+ {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 108949
: 75422