Index: head/x11/kde4-workspace/Makefile =================================================================== --- head/x11/kde4-workspace/Makefile (revision 434822) +++ head/x11/kde4-workspace/Makefile (revision 434823) @@ -1,138 +1,138 @@ # $FreeBSD$ PORTNAME= kde-workspace PORTVERSION= ${KDE4_WORKSPACE_VERSION} -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= x11 kde MASTER_SITES= KDE/${KDE4_APPLICATIONS_BRANCH}/applications/${KDE4_APPLICATIONS_VERSION}/src DIST_SUBDIR= KDE/${PORTVERSION} MAINTAINER= kde@FreeBSD.org COMMENT= KDE Plasma Desktop LIB_DEPENDS= libdbus-1.so:devel/dbus \ libck-connector.so:sysutils/consolekit \ libpci.so:devel/libpci \ libhal.so:sysutils/hal \ libqalculate.so:math/libqalculate \ libprison.so:graphics/prison \ libboost_thread.so:devel/boost-libs \ libdbusmenu-qt.so:devel/libdbusmenu-qt \ libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 \ libpng.so:graphics/png \ libxcb-render-util.so:x11/xcb-util-renderutil \ libxcb-image.so:x11/xcb-util-image \ libxcb-keysyms.so:x11/xcb-util-keysyms BUILD_DEPENDS= xrdb:x11/xrdb RUN_DEPENDS= ${KDE_PREFIX}/env/xdg-env.sh:misc/kde4-xdg-env \ ${LOCALBASE}/share/icons/hicolor/index.theme:misc/hicolor-icon-theme \ xprop:x11/xprop \ xsetroot:x11/xsetroot \ xmessage:x11/xmessage \ xrdb:x11/xrdb \ mkfontdir:x11-fonts/mkfontdir \ xset:x11/xset \ setxkbmap:x11/setxkbmap \ ${KDE_PREFIX}/bin/ksysguardd:sysutils/ksysguardd \ ${KDE_PREFIX}/lib/kde4/libexec/polkit-kde-authentication-agent-1:sysutils/polkit-kde \ ${KDE_PREFIX}/lib/kde4/libexec/polkitkde1helper:sysutils/kcm-polkit-kde \ ${LOCALBASE}/etc/pam.d/kde:security/pam_kde \ ${KDE_PREFIX}/share/apps/ksplash/Themes/Default/Theme.rc:x11-themes/kde4-base-artwork USES= cmake:outsource compiler:c++11-lib gettext gmake jpeg kde:4 \ pkgconfig shebangfix tar:xz USE_GL= glu USE_GNOME= glib20 USE_KDE= kactivities kdelibs nepomuk-core oxygen-icons4 \ pimlibs akonadi automoc4 ontologies qimageblitz soprano strigi USE_QT4= corelib dbus declarative designer_build gui network \ opengl phonon qtestlib script sql webkit xml \ moc_build qmake_build rcc_build uic_build USE_XORG= kbproto x11 xau xcomposite xcursor xdamage xdmcp xfixes \ xft xi xinerama xkbfile xrandr xrender xres xscrnsaver xtst SHEBANG_FILES= kwin/clients/oxygen/data/update_oxygen.pl USE_LDCONFIG= yes CMAKE_ARGS= -DCMAKE_REQUIRED_FLAGS:STRING="-L${LOCALBASE}/lib" \ -DBUILD_python:BOOL=OFF \ -DBUILD_ruby:BOOL=OFF \ -DWITH_Xmms:BOOL=OFF \ -DWITH_UDev:BOOL=OFF SUB_FILES= pkg-message USE_RC_SUBR= kdm4 USERS= kdm GROUPS= kdm OPTIONS_DEFINE= GLES GPS KACTIVITY UPOWER WALLPAPERS OPTIONS_GROUP= PHONON PLASMA OPTIONS_GROUP_PHONON= GSTREAMER VLC OPTIONS_GROUP_PLASMA= PYTHON RUBY OPTIONS_DEFAULT= GLES GPS KACTIVITY UPOWER VLC WALLPAPERS OPTIONS_SUB= yes # GPS GLES GLES_DESC= OpenGL ES 2.0 support in kwin and kinfocenter GLES_USE= GL=egl,glesv2 GLES_CMAKE_OFF= -DWITH_OpenGLES=off GPS_DESC= GPS geolocation via gpsd GPS_LIB_DEPENDS= libgps.so:astro/gpsd GPS_CMAKE_ON= -DWITH_libgps:BOOL=ON GPS_CMAKE_OFF= -DWITH_libgps:BOOL=OFF GSTREAMER_DESC= Multimedia via Phonon-GStreamer GSTREAMER_USE= QT4=phonon-gst_run KACTIVITY_DESC= Activity Manager daemon KACTIVITY_RUN_DEPENDS= ${KDE_PREFIX}/bin/kactivitymanagerd:x11/kactivitymanagerd PYTHON_DESC= Python plasmoids support PYTHON_RUN_DEPENDS= ${KDE_PREFIX}/share/apps/plasma_scriptengine_python/plasma_importer.py:x11/plasma-scriptengine-python RUBY_DESC= Ruby plasmoids support RUBY_RUN_DEPENDS= ${KDE_PREFIX}/share/apps/plasma_scriptengine_ruby/applet.rb:x11/plasma-scriptengine-ruby UPOWER_DESC= Power management via UPower UPOWER_RUN_DEPENDS= ${LOCALBASE}/libexec/upowerd:sysutils/upower VLC_DESC= Multimedia via Phonon-VLC VLC_RUN_DEPENDS= ${KDE_PREFIX}/lib/kde4/plugins/phonon_backend/phonon_vlc.so:multimedia/phonon-vlc WALLPAPERS_DESC= Install official KDE wallpapers WALLPAPERS_RUN_DEPENDS= ${KDE_PREFIX}/share/wallpapers/Horos/metadata.desktop:x11-themes/kde4-wallpapers \ ${KDE_PREFIX}/share/wallpapers/stripes-freebsd-blue/metadata.desktop:x11-themes/kde4-wallpapers-freebsd .if !exists(/usr/lib/libutempter.so) LIB_DEPENDS+= libutempter.so:sysutils/libutempter .endif post-patch: @${REINPLACE_CMD} -e 's,/usr/local,${LOCALBASE},g' \ ${PATCH_WRKSRC}/startkde.cmake \ ${PATCH_WRKSRC}/kcontrol/kfontinst/lib/KfiConstants.h \ ${PATCH_WRKSRC}/kcontrol/kfontinst/kio/KioFonts.cpp \ ${PATCH_WRKSRC}/kcontrol/keyboard/x11_helper.cpp \ ${PATCH_WRKSRC}/kdm/backend/client.c \ ${PATCH_WRKSRC}/kdm/kfrontend/genkdmconf.c \ ${PATCH_WRKSRC}/CMakeLists.txt pre-configure: ${REINPLACE_CMD} -e '/ksysguardd/ d' \ ${PATCH_WRKSRC}/ksysguard/CMakeLists.txt \ ${PATCH_WRKSRC}/ksysguard/example/CMakeLists.txt ${REINPLACE_CMD} -e '/PolicyKit/ d' \ ${PATCH_WRKSRC}/doc/CMakeLists.txt post-install: ${LN} -sf ${PREFIX}/bin/startkde ${STAGEDIR}${PREFIX}/bin/startkde4 post-install-GSTREAMER-on: @${HEAD} -1 ${PKGMESSAGE} >> ${PKGMESSAGE} post-install-GSTREAMER-off: @${CAT} ${FILESDIR}/pkg-message.gstreamer >> ${PKGMESSAGE} @${HEAD} -1 ${PKGMESSAGE} >> ${PKGMESSAGE} .include Index: head/x11/kde4-workspace/files/patch-CMakeLists.txt =================================================================== --- head/x11/kde4-workspace/files/patch-CMakeLists.txt (revision 434822) +++ head/x11/kde4-workspace/files/patch-CMakeLists.txt (revision 434823) @@ -1,11 +1,11 @@ ---- ./CMakeLists.txt.orig 2011-07-19 23:37:36.000000000 +0200 -+++ ./CMakeLists.txt 2011-08-09 20:45:40.975563521 +0200 -@@ -90,7 +90,7 @@ +--- CMakeLists.txt.orig 2015-06-26 03:17:21 UTC ++++ CMakeLists.txt +@@ -198,7 +198,7 @@ if(NOT WIN32) configure_file(config-unix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-unix.h ) configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h ) if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr") - set(EXPORT_XCURSOR_PATH "XCURSOR_PATH=${CMAKE_INSTALL_PREFIX}/share/icons:$XCURSOR_PATH\":~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons\"; export XCURSOR_PATH") + set(EXPORT_XCURSOR_PATH "XCURSOR_PATH=${CMAKE_INSTALL_PREFIX}/share/icons:$XCURSOR_PATH\":~/.icons:/usr/local/share/icons:/usr/local/share/pixmaps:/usr/local/lib/X11/icons\"; export XCURSOR_PATH") endif(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr") configure_file(startkde.cmake ${CMAKE_CURRENT_BINARY_DIR}/startkde @ONLY) endif(NOT WIN32) Index: head/x11/kde4-workspace/files/patch-ConfigureChecks.cmake =================================================================== --- head/x11/kde4-workspace/files/patch-ConfigureChecks.cmake (revision 434822) +++ head/x11/kde4-workspace/files/patch-ConfigureChecks.cmake (revision 434823) @@ -1,20 +1,20 @@ ---- ./ConfigureChecks.cmake.orig 2009-11-21 12:44:36.000000000 +0300 -+++ ./ConfigureChecks.cmake 2010-01-27 00:04:40.445046695 +0300 -@@ -16,16 +16,7 @@ +--- ConfigureChecks.cmake.orig 2015-06-26 03:17:21 UTC ++++ ConfigureChecks.cmake +@@ -21,16 +21,7 @@ if (PAM_FOUND) endmacro(define_pam_service) macro(install_pam_service APP) - string(TOUPPER KDE4_${APP}_PAM_SERVICE cvar) - install(CODE " - set(DESTDIR_VALUE \"\$ENV{DESTDIR}\") - if (NOT DESTDIR_VALUE) - exec_program(\"${KDEBASE_WORKSPACE_SOURCE_DIR}/mkpamserv\" ARGS ${${cvar}} RETURN_VALUE ret) - if (NOT ret) - exec_program(\"${KDEBASE_WORKSPACE_SOURCE_DIR}/mkpamserv\" ARGS -P ${${cvar}}-np) - endif (NOT ret) - endif (NOT DESTDIR_VALUE) - ") + message("Ignore installing pam service, FreeBSD has it already.") endmacro(install_pam_service) define_pam_service(KDM) Index: head/x11/kde4-workspace/files/patch-kdm-kfrontend-CMakeLists.txt =================================================================== --- head/x11/kde4-workspace/files/patch-kdm-kfrontend-CMakeLists.txt (revision 434822) +++ head/x11/kde4-workspace/files/patch-kdm-kfrontend-CMakeLists.txt (revision 434823) @@ -1,12 +1,12 @@ ---- ./kdm/kfrontend/CMakeLists.txt.orig 2008-07-30 17:02:54.000000000 +0300 -+++ ./kdm/kfrontend/CMakeLists.txt 2008-07-30 17:03:26.000000000 +0300 -@@ -113,6 +113,6 @@ +--- kdm/kfrontend/CMakeLists.txt.orig 2015-06-26 03:17:21 UTC ++++ kdm/kfrontend/CMakeLists.txt +@@ -111,6 +111,6 @@ install(TARGETS kdmctl ${INSTALL_TARGETS # use 'GENKDMCONF_FLAGS=... make install' to add flags to the config generation (try genkdmconf -h) -install(CODE " -exec_program(\"${CMAKE_CURRENT_BINARY_DIR}/genkdmconf\" ARGS --in \\\"\\\$DESTDIR${CONFIG_INSTALL_DIR}/kdm\\\" --no-in-notice --face-src \\\"${CMAKE_CURRENT_SOURCE_DIR}/pics\\\" \\\$GENKDMCONF_FLAGS) -") +#install(CODE " +#exec_program(\"${CMAKE_CURRENT_BINARY_DIR}/genkdmconf\" ARGS --in \\\"\\\$DESTDIR${CONFIG_INSTALL_DIR}/kdm\\\" --no-in-notice --face-src \\\"${CMAKE_CURRENT_SOURCE_DIR}/pics\\\" \\\$GENKDMCONF_FLAGS) +#") Index: head/x11/kde4-workspace/files/patch-kdm__backend__client.c =================================================================== --- head/x11/kde4-workspace/files/patch-kdm__backend__client.c (revision 434822) +++ head/x11/kde4-workspace/files/patch-kdm__backend__client.c (revision 434823) @@ -1,35 +1,35 @@ ---- kdm/backend/client.c.orig 2014-11-06 23:36:58.000000000 +0100 -+++ kdm/backend/client.c 2015-03-09 13:20:24.870430799 +0100 -@@ -1322,6 +1322,9 @@ +--- kdm/backend/client.c.orig 2015-06-26 03:17:21 UTC ++++ kdm/backend/client.c +@@ -1322,6 +1322,9 @@ startClient(volatile int *pid) char ckDeviceBuf[20] = ""; const char *ckDevice = ckDeviceBuf; dbus_bool_t isLocal; +# ifdef BSD + FILE *proc; +# endif #endif char *failsafeArgv[2]; char *buf, *buf2; -@@ -1353,6 +1356,13 @@ +@@ -1353,6 +1356,13 @@ startClient(volatile int *pid) # ifdef HAVE_VTS if (td->serverVT > 0) sprintf(ckDeviceBuf, "/dev/tty%d", td->serverVT); +# elif defined(BSD) + if ((proc = popen( "/usr/local/libexec/ck-get-x11-display-device", "r" ))) { + fscanf( proc, "%s", ckDeviceBuf ); + pclose(proc); + if (strcmp( ckDeviceBuf, "usage" ) == 0 || strcmp( ckDeviceBuf, "ERROR:" ) == 0) + ckDeviceBuf[0] = '\0'; + } # endif isLocal = ((td->displayType & d_location) == dLocal); # ifdef XDMCP -@@ -1532,7 +1542,7 @@ +@@ -1532,7 +1542,7 @@ startClient(volatile int *pid) environ = pam_env; # endif removeCreds = True; /* set it first - i don't trust PAM's rollback */ - pretc = pam_setcred(pamh, 0); + pretc = pam_setcred(pamh, PAM_ESTABLISH_CRED); reInitErrorLog(); # ifndef HAVE_PAM_GETENVLIST pam_env = environ; Index: head/x11/kde4-workspace/files/patch-kinfocenter =================================================================== --- head/x11/kde4-workspace/files/patch-kinfocenter (revision 434822) +++ head/x11/kde4-workspace/files/patch-kinfocenter (revision 434823) @@ -1,375 +1,375 @@ Clean up info_fbsd.cpp. Use libpci for pci access if possible - on FreeBSD it requires root privileges (rw access to /dev/pci), therefore leave old method as a fallback. Improve GetInfo_ReadfromPipe function to use Qt types, pass program name and its parameters as separate arguments. ---- /dev/null +--- cmake/modules/FindBSDDevinfo.cmake.orig 2016-12-13 11:26:31 UTC +++ cmake/modules/FindBSDDevinfo.cmake @@ -0,0 +1,15 @@ +# Find FreeBSD devinfo library +# Once done this will define +# +# BSDDEVINFO_FOUND - system has devinfo +# BSDDEVINFO_INCLUDE_DIR - devinfo include directory +# BSDDEVINFO_LIBRARY - devinfo library + +find_path(BSDDEVINFO_INCLUDE_DIR devinfo.h) + +find_library(BSDDEVINFO_LIBRARY NAMES devinfo) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BSDDEVINFO DEFAULT_MSG BSDDEVINFO_LIBRARY BSDDEVINFO_INCLUDE_DIR) + +mark_as_advanced(BSDDEVINFO_INCLUDE_DIR BSDDEVINFO_LIBRARY) ---- kinfocenter/Modules/base/CMakeLists.txt +--- kinfocenter/Modules/base/CMakeLists.txt.orig 2015-06-26 03:17:21 UTC +++ kinfocenter/Modules/base/CMakeLists.txt @@ -1,6 +1,7 @@ # TODO: HAVE_LIBDEVINFO_H (for Solaris 7 and later) # to be set if both -ldevinfo and libdevinfo.h exist -check_include_files(devinfo.h HAVE_DEVINFO_H) # info_fbsd.cpp +macro_optional_find_package(BSDDevinfo) # info_fbsd.cpp +macro_bool_to_01(BSDDEVINFO_FOUND HAVE_DEVINFO_H) configure_file (../base/config-infocenter.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-infocenter.h ) ---- kinfocenter/Modules/base/info_fbsd.cpp.orig 2014-11-06 22:36:58.000000000 +0000 -+++ kinfocenter/Modules/base/info_fbsd.cpp 2015-02-20 22:40:53.380666149 +0000 +--- kinfocenter/Modules/base/info_fbsd.cpp.orig 2015-06-26 03:17:21 UTC ++++ kinfocenter/Modules/base/info_fbsd.cpp @@ -15,8 +15,6 @@ */ #include "config-infocenter.h" // HAVE_DEVINFO_H -#include -#include #ifdef HAVE_DEVINFO_H extern "C" { -@@ -24,13 +22,16 @@ +@@ -24,13 +22,16 @@ extern "C" { } #endif -#include +#ifdef HAVE_PCIUTILS +#include "kpci.h" +#endif -#include #include - +#include #include +#include + void ProcessChildren(QString name); #ifdef HAVE_DEVINFO_H -@@ -44,13 +45,12 @@ +@@ -44,13 +45,12 @@ extern "C" { bool GetInfo_IRQ(QTreeWidget* tree) { #ifdef HAVE_DEVINFO_H - /* systat lists the interrupts assigned to devices as well as how many were - generated. Parsing its output however is about as fun as a sandpaper - enema. The best idea would probably be to rip out the guts of systat. - Too bad it's not very well commented */ - /* Oh neat, current now has a neat little utility called devinfo */ if (devinfo_init()) - return false; + return false; + + QStringList headers; + headers << i18n("IRQ") << i18n("Used By"); + tree->setHeaderLabels(headers); devinfo_foreach_rman(print_irq, tree); return true; #else -@@ -60,9 +60,13 @@ +@@ -60,9 +60,13 @@ bool GetInfo_IRQ(QTreeWidget* tree) { bool GetInfo_DMA(QTreeWidget* tree) { #ifdef HAVE_DEVINFO_H - /* Oh neat, current now has a neat little utility called devinfo */ if (devinfo_init()) - return false; + return false; + + QStringList headers; + headers << i18n("DMA-Channel") << i18n("Used By"); + tree->setHeaderLabels(headers); + devinfo_foreach_rman(print_dma, tree); return true; #else -@@ -72,9 +76,12 @@ +@@ -72,9 +76,12 @@ bool GetInfo_DMA(QTreeWidget* tree) { bool GetInfo_IO_Ports(QTreeWidget* tree) { #ifdef HAVE_DEVINFO_H - /* Oh neat, current now has a neat little utility called devinfo */ if (devinfo_init()) - return false; + return false; + + QStringList headers; + headers << i18n("I/O-Range") << i18n("Used By"); + tree->setHeaderLabels(headers); devinfo_foreach_rman(print_ioports, tree); return true; #else -@@ -83,50 +90,28 @@ +@@ -83,50 +90,28 @@ bool GetInfo_IO_Ports(QTreeWidget* tree) } bool GetInfo_SCSI(QTreeWidget* tree) { - FILE *pipe; - QTextStream *t; - QString s; - if (!QFileInfo(QLatin1String("/sbin/camcontrol")).exists()) { - s = i18n("SCSI subsystem could not be queried: /sbin/camcontrol could not be found"); - QStringList list; +- QStringList list; - list << s; -+ list << i18n("SCSI subsystem could not be queried: /sbin/camcontrol could not be found"); - new QTreeWidgetItem(tree, list); +- new QTreeWidgetItem(tree, list); - } else if ((pipe = popen("/sbin/camcontrol devlist 2>&1", "r")) == NULL) { - s = i18n("SCSI subsystem could not be queried: /sbin/camcontrol could not be executed"); -- QStringList list; + QStringList list; - list << s; -- new QTreeWidgetItem(tree, list); ++ list << i18n("SCSI subsystem could not be queried: /sbin/camcontrol could not be found"); + new QTreeWidgetItem(tree, list); - } else { - - /* This prints out a list of all the scsi devies, perhaps eventually we could - parse it as opposed to schlepping it into a listbox */ - - t = new QTextStream(pipe, QIODevice::ReadOnly); - - while (true) { - s = t->readLine(); - if (s.isEmpty() ) - break; - QStringList list; - list << s; - new QTreeWidgetItem(tree, list); - } - - delete t; - pclose(pipe); } + if (GetInfo_ReadfromPipe(tree, "/sbin/camcontrol", QStringList() << "devlist", true)) + return true; - if (!tree->topLevelItemCount()) - return false; - - return true; + return false; } bool GetInfo_PCI(QTreeWidget* tree) { - FILE *pipe; - QString s, cmd; - QTreeWidgetItem *olditem= NULL; +#ifdef HAVE_PCIUTILS +// libpci exits immediately if /dev/pci can't be open in rw mode + QFile pcidev("/dev/pci"); + if (pcidev.open(QIODevice::ReadWrite)) { + pcidev.close(); + if ( GetInfo_PCIUtils(tree)) { + return true; + } + } +#endif //HAVE_PCIUTILS const QStringList headers(i18nc("@title:column Column name for PCI information", "Information")); tree->setHeaderLabels(headers); -@@ -136,40 +121,11 @@ +@@ -136,40 +121,11 @@ bool GetInfo_PCI(QTreeWidget* tree) { list << i18n("Could not find any programs with which to query your system's PCI information"); new QTreeWidgetItem(tree, list); return true; - } else { - cmd = "/usr/sbin/pciconf -l -v 2>&1"; -- } + } - - // TODO: GetInfo_ReadfromPipe should be improved so that we could pass the program name and its - // arguments to it and remove most of the code below. - if ((pipe = popen(cmd.toLatin1(), "r")) == NULL) { - QStringList list; - list << i18n("PCI subsystem could not be queried: %1 could not be executed", cmd); - olditem = new QTreeWidgetItem(olditem, list); - } else { - /* This prints out a list of all the pci devies, perhaps eventually we could - parse it as opposed to schlepping it into a listbox */ - QTextStream outputStream(pipe, QIODevice::ReadOnly); - - while (!outputStream.atEnd()) { - s = outputStream.readLine(); - if (s.isEmpty() ) - break; - const QStringList list(s); - new QTreeWidgetItem(tree, list); - } - - pclose(pipe); - } +- } - - if (!tree->topLevelItemCount()) { - QString str = i18n("The PCI subsystem could not be queried, this may need root privileges."); - olditem = new QTreeWidgetItem(tree, olditem); - olditem->setText(0, str); + if (GetInfo_ReadfromPipe(tree, "/usr/sbin/pciconf", QStringList() << "-l" << "-v", true)) return true; - } - return true; + return false; } bool GetInfo_XServer_and_Video(QTreeWidget* tree) { -@@ -179,12 +135,7 @@ +@@ -179,12 +135,7 @@ bool GetInfo_XServer_and_Video(QTreeWidg #ifdef HAVE_DEVINFO_H int print_irq(struct devinfo_rman *rman, void *arg) { - QTreeWidget* tree = (QTreeWidget *)arg; if (strcmp(rman->dm_desc, "Interrupt request lines")==0) { - - QStringList list; - list << rman->dm_desc; - new QTreeWidgetItem(tree, list); devinfo_foreach_rman_resource(rman, print_resource, arg); } return 0; -@@ -192,11 +143,7 @@ +@@ -192,11 +143,7 @@ int print_irq(struct devinfo_rman *rman, int print_dma(struct devinfo_rman *rman, void *arg) { - QTreeWidget* tree = (QTreeWidget *)arg; if (strcmp(rman->dm_desc, "DMA request lines")==0) { - QStringList list; - list << rman->dm_desc; - new QTreeWidgetItem(tree, list); devinfo_foreach_rman_resource(rman, print_resource, arg); } return(0); -@@ -230,29 +177,25 @@ +@@ -230,29 +177,25 @@ int print_resource(struct devinfo_res *r int hexmode; QTreeWidget* tree = (QTreeWidget*) arg; + tree->setFont(KGlobalSettings::fixedFont()); + QStringList list; - QString s, tmp; + QString s; + QTextStream result(&s); rman = devinfo_handle_to_rman(res->dr_rman); hexmode = (rman->dm_size > 100) || (rman->dm_size == 0); - tmp.sprintf(hexmode ? "0x%lx" : "%lu", res->dr_start); - s += tmp; - if (res->dr_size > 1) { - tmp.sprintf(hexmode ? "-0x%lx" : "-%lu", - res->dr_start + res->dr_size - 1); - s += tmp; - } + if (hexmode) + result << showbase << hex; + result << res->dr_start; + if (res->dr_size > 1) + result << "-" << res->dr_start + res->dr_size - 1; + list << s; dev = devinfo_handle_to_device(res->dr_device); - if ((dev != NULL) && (dev->dd_name[0] != 0)) { - tmp.sprintf(" (%s)", dev->dd_name); - } else { - tmp.sprintf(" ----"); - } - s += tmp; + if ((dev != NULL) && (dev->dd_name[0] != 0)) + list << QString(dev->dd_name); - QStringList list; - list << s; new QTreeWidgetItem(tree, list); return 0; ---- kinfocenter/Modules/info/CMakeLists.txt -+++ kinfocenter/Modules/info/CMakeLists.txt -@@ -13,6 +13,9 @@ set(kcm_info_PART_SRCS main.cpp info.cpp ../base/os_current.cpp ) - kde4_add_plugin(kcm_info ${kcm_info_PART_SRCS}) - - target_link_libraries(kcm_info ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_X11_LIB}) -+if(BSDDEVINFO_FOUND) -+ target_link_libraries(kcm_info ${BSDDEVINFO_LIBRARY}) -+endif(BSDDEVINFO_FOUND) - - install(TARGETS kcm_info DESTINATION ${PLUGIN_INSTALL_DIR} ) - ---- kinfocenter/Modules/base/info_hpux.cpp +--- kinfocenter/Modules/base/info_hpux.cpp.orig 2015-06-26 03:17:21 UTC +++ kinfocenter/Modules/base/info_hpux.cpp -@@ -30,6 +30,7 @@ along with this program. If not, see . +@@ -30,6 +30,7 @@ along with this program. If not, see #include #include +#include #include # define INFO_PCI "" // Please, who know it ???? @@ -178,14 +179,14 @@ bool GetInfo_PCI(QTreeWidget* tree) { } bool GetInfo_IO_Ports(QListView *lBox) { - if (GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_1, false)) + if (GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_1, QStringList(), false)) return true; else - return GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_2, false); + return GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_2, QStringList(), false); } bool GetInfo_SCSI(QListView *lBox) { - return GetInfo_ReadfromPipe(lBox, INFO_DEVICES, false); + return GetInfo_ReadfromPipe(lBox, INFO_DEVICES, QStringList(), false); } /* Parts taken from fsusage.c from the Midnight Commander (mc) ---- kinfocenter/Modules/base/info_linux.cpp +--- kinfocenter/Modules/base/info_linux.cpp.orig 2015-06-26 03:17:21 UTC +++ kinfocenter/Modules/base/info_linux.cpp -@@ -33,6 +33,7 @@ along with this program. If not, see . +@@ -33,6 +33,7 @@ along with this program. If not, see #include #include +#include #include #include @@ -140,9 +141,12 @@ bool GetInfo_PCI(QTreeWidget* tree) { tree->setSortingEnabled(false); /* try to get the output of the lspci package first */ - if ((num = GetInfo_ReadfromPipe(tree, "lspci -v", true)) || (num = GetInfo_ReadfromPipe(tree, "/sbin/lspci -v", true)) || (num = GetInfo_ReadfromPipe(tree, "/usr/sbin/lspci -v", true)) || (num = GetInfo_ReadfromPipe(tree, "/usr/local/sbin/lspci -v", true)) || (num = GetInfo_ReadfromPipe(tree, - "/usr/bin/lspci -v", true))) - return num; + QStringList lspci; + lspci << "lspci" << "/sbin/lspci" << "/usr/sbin/lspci" << "/usr/local/sbin/lspci" << "/usr/bin/lspci"; + QString p; + foreach(p, lspci) + if (num = GetInfo_ReadfromPipe(tree, p, QStringList() << "-v", true)) + return num; /* if lspci failed, read the contents of /proc/pci */ return GetInfo_ReadfromFile(tree, INFO_PCI, 0); ---- kinfocenter/Modules/base/os_base.h +--- kinfocenter/Modules/base/os_base.h.orig 2015-06-26 03:17:21 UTC +++ kinfocenter/Modules/base/os_base.h -@@ -320,12 +320,12 @@ static bool GetInfo_XServer_Generic(QTreeWidget *lBox) { +@@ -330,12 +330,12 @@ static bool GetInfo_XServer_Generic(QTre } /* Helper-function to read output from an external program */ -static int GetInfo_ReadfromPipe(QTreeWidget* tree, const char *FileName, bool WithEmptyLines = true) { +static int GetInfo_ReadfromPipe(QTreeWidget* tree, const QString &program, const QStringList &arguments, bool WithEmptyLines = true) { QProcess proc; QTreeWidgetItem* olditem= NULL; QString s; - proc.start(FileName, QIODevice::ReadOnly); + proc.start(program, arguments, QIODevice::ReadOnly); if (!proc.waitForFinished()) { // Process hanged or did not start return 0; +--- kinfocenter/Modules/info/CMakeLists.txt.orig 2015-06-26 03:17:21 UTC ++++ kinfocenter/Modules/info/CMakeLists.txt +@@ -13,6 +13,9 @@ set(kcm_info_PART_SRCS main.cpp info.cpp + kde4_add_plugin(kcm_info ${kcm_info_PART_SRCS}) + + target_link_libraries(kcm_info ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_X11_LIB}) ++if(BSDDEVINFO_FOUND) ++ target_link_libraries(kcm_info ${BSDDEVINFO_LIBRARY}) ++endif(BSDDEVINFO_FOUND) + + install(TARGETS kcm_info DESTINATION ${PLUGIN_INSTALL_DIR} ) + Index: head/x11/kde4-workspace/files/patch-kinfocenter_Modules_pci_kpci.cpp =================================================================== --- head/x11/kde4-workspace/files/patch-kinfocenter_Modules_pci_kpci.cpp (nonexistent) +++ head/x11/kde4-workspace/files/patch-kinfocenter_Modules_pci_kpci.cpp (revision 434823) @@ -0,0 +1,56 @@ +* Obey user's unit preferences when displaying PCI info. +* Use correct units, someone forgot about terabytes +* +--- kinfocenter/Modules/pci/kpci.cpp.orig 2015-06-26 03:17:21 UTC ++++ kinfocenter/Modules/pci/kpci.cpp +@@ -22,6 +22,8 @@ extern "C" { + #include + #include + #include ++#include ++#include + + static const QString& getNameById(const id2name *const table, int id) { + for (int i=0;; i++) { +@@ -238,31 +240,35 @@ static QTreeWidgetItem* addBist(QTreeWid + }//addBist + + static QTreeWidgetItem* addSize(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciaddr_t size) { ++ static bool realUnits = (KGlobal::locale()->binaryUnitDialect() == KLocale::JEDECBinaryDialect); + if (size<0x400) { + after=create(parent, i18n("Size"), QString("%1 B").arg(static_cast(size))); + }//if + else if (size<0x100000) { +- after=create(parent, i18n("Size"), QString("%1 kiB").arg(static_cast(size/0x400))); ++ after=create(parent, i18n("Size"), QString(realUnits ? "%1 KB" : "%1 KiB").arg(static_cast(size/0x400))); + }//elif + else if (size<0x40000000) { +- after=create(parent, i18n("Size"), QString("%1 MiB").arg(static_cast(size/0x100000))); ++ after=create(parent, i18n("Size"), QString(realUnits ? "%1 MB" : "%1 MiB").arg(static_cast(size/0x100000))); + }//elif + + #ifdef HAVE_PCIADDR_T64 + + else if (size<0x10000000000LL) { +- after=create(parent, i18n("Size"),QString("%1 GiB").arg(static_cast(size/0x40000000))); ++ after=create(parent, i18n("Size"),QString(realUnits ? "%1 GB" : "%1 GiB").arg(static_cast(size/0x40000000))); + }//elif + else if (size<0x4000000000000LL) { +- after=create(parent, i18n("Size"),QString("%1 PiB").arg(static_cast(size/0x10000000000LL))); ++ after=create(parent, i18n("Size"),QString(realUnits ? "%1 TB" : "%1 TiB").arg(static_cast(size/0x10000000000LL))); + }//elif + else if (size<0x1000000000000000LL) { +- after=create(parent, i18n("Size"),QString("%1 EiB").arg(static_cast(size/0x4000000000000LL))); ++ after=create(parent, i18n("Size"),QString(realUnits ? "%1 PB" : "%1 PiB").arg(static_cast(size/0x4000000000000LL))); + }//elif ++ else { ++ after=create(parent, i18n("Size"),QString(realUnits ? "%1 EB" : "%1 EiB").arg(static_cast(size/0x1000000000000000LL))); ++ }//else + + #else //HAVE_PCIADDR_T64 + else { +- after=create(parent, i18n("Size"), QString("%1 GiB").arg(static_cast(size/0x40000000))); ++ after=create(parent, i18n("Size"), QString(realUnits ? "%1 GB" : "%1 GiB").arg(static_cast(size/0x40000000))); + }//else + + #endif //HAVE_PCIADDR_T64 Property changes on: head/x11/kde4-workspace/files/patch-kinfocenter_Modules_pci_kpci.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/x11/kde4-workspace/files/patch-ksysguard_gui_SensorDisplayLib_FancyPlotter.cpp =================================================================== --- head/x11/kde4-workspace/files/patch-ksysguard_gui_SensorDisplayLib_FancyPlotter.cpp (nonexistent) +++ head/x11/kde4-workspace/files/patch-ksysguard_gui_SensorDisplayLib_FancyPlotter.cpp (revision 434823) @@ -0,0 +1,306 @@ +* Fix the unit handling in KSysGuard's Plotter to respect user's unit preferences +* +* Improve the handling of labels so the display is nicer when horizontally constrained +* +* Use reasonable units for the Plotter's tooltip (used to be unscaled) +* +* Allow a stored description for sensors to override the label +* +--- ksysguard/gui/SensorDisplayLib/FancyPlotter.cpp.orig 2015-06-26 03:17:21 UTC ++++ ksysguard/gui/SensorDisplayLib/FancyPlotter.cpp +@@ -48,6 +48,7 @@ class SensorToAdd { + QRegExp name; + QString hostname; + QString type; ++ QString description; + QList colors; + QString summationName; + }; +@@ -58,13 +59,15 @@ class FancyPlotterLabel : public QLabel + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + longHeadingWidth = 0; + shortHeadingWidth = 0; ++ minHeadingWidth = 0; + textMargin = 0; + setLayoutDirection(Qt::LeftToRight); //We do this because we organise the strings ourselves.. is this going to muck it up though for RTL languages? + } + ~FancyPlotterLabel() { + } + void setLabel(const QString &name, const QColor &color) { +- labelName = name; ++ labelLongName = name; ++ labelShortName = name.split(QChar(' ')).first(); + + if(indicatorSymbol.isNull()) { + if(fontMetrics().inFont(QChar(0x25CF))) +@@ -73,7 +76,6 @@ class FancyPlotterLabel : public QLabel + indicatorSymbol = '#'; + } + changeLabel(color); +- + } + void setValueText(const QString &value) { + //value can have multiple strings, separated with the 0x9c character +@@ -87,63 +89,72 @@ class FancyPlotterLabel : public QLabel + if(valueText.isEmpty()) { + if(longHeadingWidth < width()) + setText(longHeadingText); +- else ++ else if(shortHeadingWidth < width()) + setText(shortHeadingText); ++ else ++ setText(minHeadingText); + return; + } +- QString value = valueText.first(); + +- int textWidth = fm.boundingRect(value).width(); +- if(textWidth + longHeadingWidth < width()) +- setBothText(longHeadingText, value); +- else if(textWidth + shortHeadingWidth < width()) +- setBothText(shortHeadingText, value); +- else { +- int valueTextCount = valueText.count(); +- int i; +- for(i = 1; i < valueTextCount; ++i) { +- textWidth = fm.boundingRect(valueText.at(i)).width(); +- if(textWidth + shortHeadingWidth <= width()) { +- break; +- } ++ int i, textWidth, valueTextCount = valueText.count(); ++ for(i = 0; i < valueTextCount; ++i) { ++ textWidth = fm.boundingRect(valueText.at(i)).width(); ++ if(textWidth + longHeadingWidth <= width()) { ++ setBothText(longHeadingText, valueText.at(i)); ++ return; + } +- if(i < valueTextCount) ++ if(textWidth + shortHeadingWidth <= width()) { + setBothText(shortHeadingText, valueText.at(i)); +- else +- setText(noHeadingText + valueText.last()); //This just sets the color of the text ++ return; ++ } + } ++ for(i = 0; i < valueTextCount; ++i) { ++ textWidth = fm.boundingRect(valueText.at(i)).width(); ++ if(textWidth + minHeadingWidth <= width()) { ++ setBothText(minHeadingText, valueText.at(i)); ++ return; ++ } ++ } ++ setBothText(noHeadingText, valueText.last()); //This just sets the color of the text + } + void changeLabel(const QColor &_color) { + color = _color; + +- if ( kapp->layoutDirection() == Qt::RightToLeft ) +- longHeadingText = QString(": ") + labelName + " " + indicatorSymbol + ""; +- else +- longHeadingText = QString("" + indicatorSymbol + " " + labelName + " :"; +- shortHeadingText = QString("" + indicatorSymbol + ""; ++ if ( kapp->layoutDirection() == Qt::RightToLeft ) { ++ longHeadingText = QString(" : ") + labelLongName + " " + indicatorSymbol + ""; ++ shortHeadingText = QString(" :") + labelShortName + " " + indicatorSymbol + ""; ++ } else { ++ longHeadingText = QString("" + indicatorSymbol + " " + labelLongName + " : "; ++ shortHeadingText = QString("" + indicatorSymbol + " " + labelShortName + ": "; ++ } ++ minHeadingText = QString("" + indicatorSymbol + " "; + noHeadingText = QString(""; + +- textMargin = fontMetrics().width('x') + margin()*2 + frameWidth()*2; +- longHeadingWidth = fontMetrics().boundingRect(labelName + " :" + indicatorSymbol + " x").width() + textMargin; +- shortHeadingWidth = fontMetrics().boundingRect(indicatorSymbol).width() + textMargin; +- setMinimumWidth(shortHeadingWidth); ++ textMargin = margin()*2 + frameWidth()*2; ++ longHeadingWidth = fontMetrics().boundingRect(labelLongName + " : " + indicatorSymbol + " x").width() + textMargin; ++ shortHeadingWidth = fontMetrics().boundingRect(labelShortName + ": " + indicatorSymbol + " x").width() + textMargin; ++ minHeadingWidth = fontMetrics().boundingRect(indicatorSymbol + " x").width() + textMargin; ++ setMinimumWidth(minHeadingWidth); + update(); + } + private: + void setBothText(const QString &heading, const QString & value) { + if(QApplication::layoutDirection() == Qt::LeftToRight) +- setText(heading + ' ' + value); ++ setText(heading + value); + else +- setText("" + value + ' ' + heading); ++ setText("" + value + heading); + } + int textMargin; + QString longHeadingText; + QString shortHeadingText; ++ QString minHeadingText; + QString noHeadingText; + int longHeadingWidth; + int shortHeadingWidth; ++ int minHeadingWidth; + QList valueText; +- QString labelName; ++ QString labelLongName; ++ QString labelShortName; + QColor color; + static QChar indicatorSymbol; + }; +@@ -162,6 +173,7 @@ FancyPlotter::FancyPlotter( QWidget* par + mUseManualRange = false; + mNumAnswers = 0; + mLabelsWidget = NULL; ++ mRealUnits = (KGlobal::locale()->binaryUnitDialect() == KLocale::JEDECBinaryDialect); + + //The unicode character 0x25CF is a big filled in circle. We would prefer to use this in the tooltip. + //However it's maybe possible that the font used to draw the tooltip won't have it. So we fall back to a +@@ -510,10 +522,17 @@ void FancyPlotter::setTooltip() + + if(sensor->isOk()) { + lastValue = KGlobal::locale()->formatNumber( sensor->lastValue, (sensor->isInteger)?0:-1 ); +- if (sensor->unit() == "%") ++ if (sensor->unit() == "%") { + lastValue = i18nc("units", "%1%", lastValue); +- else if( !sensor->unit().isEmpty() ) +- lastValue = i18nc("units", QString(QString("%1 ") + sensor->unit()).toUtf8(), lastValue); ++ } else if( !sensor->unit().isEmpty() ) { ++ qreal scale = (mPlotter->scaleDownBy() == 1) ? 1 : (sensor->lastValue / mPlotter->scaleDownBy() < 0.1) ? (mPlotter->scaleDownBy() / 1024) : mPlotter->scaleDownBy(); ++ if(scale > 1) { ++ QString unit = (scale == 1024) ? (sensor->unit()).replace("K","M") : (scale == 1024*1024) ? (sensor->unit()).replace("K","G") : (sensor->unit()).replace("K","T"); ++ lastValue = i18nc("units", QString(QString("%1 ") + unit).toUtf8(), KGlobal::locale()->formatNumber( sensor->lastValue / scale )); ++ } else { ++ lastValue = i18nc("units", QString(QString("%1 ") + sensor->unit()).toUtf8(), lastValue); ++ } ++ } + } else { + lastValue = i18n("Error"); + } +@@ -615,33 +634,33 @@ void FancyPlotter::plotterAxisScaleChang + disconnect(mPlotter, SIGNAL(axisScaleChanged()), this, SLOT(plotterAxisScaleChanged())); + KLocalizedString unit; + double value = mPlotter->currentMaximumRangeValue(); +- if(mUnit == "KiB") { +- if(value >= 1024*1024*1024*0.7) { //If it's over 0.7TiB, then set the scale to terabytes ++ if(mUnit == "KB" || mUnit == "KiB") { ++ if(value >= 1024*1024*1024) { + mPlotter->setScaleDownBy(1024*1024*1024); +- unit = ki18nc("units", "%1 TiB"); // the unit - terabytes +- } else if(value >= 1024*1024*0.7) { //If it's over 0.7GiB, then set the scale to gigabytes ++ unit = ki18nc("units", mRealUnits ? "%1 TB" : "%1 TiB"); // the unit - terabytes ++ } else if(value >= 1024*1024) { + mPlotter->setScaleDownBy(1024*1024); +- unit = ki18nc("units", "%1 GiB"); // the unit - gigabytes ++ unit = ki18nc("units", mRealUnits ? "%1 GB" : "%1 GiB"); // the unit - gigabytes + } else if(value > 1024) { + mPlotter->setScaleDownBy(1024); +- unit = ki18nc("units", "%1 MiB"); // the unit - megabytes ++ unit = ki18nc("units", mRealUnits ? "%1 MB" : "%1 MiB"); // the unit - megabytes + } else { + mPlotter->setScaleDownBy(1); +- unit = ki18nc("units", "%1 KiB"); // the unit - kilobytes ++ unit = ki18nc("units", mRealUnits ? "%1 KB" : "%1 KiB"); // the unit - kilobytes + } +- } else if(mUnit == "KiB/s") { +- if(value >= 1024*1024*1024*0.7) { //If it's over 0.7TiB, then set the scale to terabytes ++ } else if(mUnit == "KB/s" || mUnit == "KiB/s") { ++ if(value >= 1024*1024*1024) { + mPlotter->setScaleDownBy(1024*1024*1024); +- unit = ki18nc("units", "%1 TiB/s"); // the unit - terabytes per second +- } else if(value >= 1024*1024*0.7) { //If it's over 0.7GiB, then set the scale to gigabytes ++ unit = ki18nc("units", mRealUnits ? "%1 TB/s" : "%1 TiB/s"); // the unit - terabytes per second ++ } else if(value >= 1024*1024) { + mPlotter->setScaleDownBy(1024*1024); +- unit = ki18nc("units", "%1 GiB/s"); // the unit - gigabytes per second ++ unit = ki18nc("units", mRealUnits ? "%1 GB/s" : "%1 GiB/s"); // the unit - gigabytes per second + } else if(value > 1024) { + mPlotter->setScaleDownBy(1024); +- unit = ki18nc("units", "%1 MiB/s"); // the unit - megabytes per second ++ unit = ki18nc("units", mRealUnits ? "%1 MB/s" : "%1 MiB/s"); // the unit - megabytes per second + } else { + mPlotter->setScaleDownBy(1); +- unit = ki18nc("units", "%1 KiB/s"); // the unit - kilobytes per second ++ unit = ki18nc("units", mRealUnits ? "%1 KB/s" : "%1 KiB/s"); // the unit - kilobytes per second + } + } else if(mUnit == "%") { + mPlotter->setScaleDownBy(1); +@@ -694,9 +713,9 @@ void FancyPlotter::answerReceived( int i + KSGRD::SensorFloatInfo info( answer ); + QString unit = info.unit(); + if(unit.toUpper() == "KB" || unit.toUpper() == "KIB") +- unit = "KiB"; ++ unit = mRealUnits ? "KB" : "KiB"; + if(unit.toUpper() == "KB/S" || unit.toUpper() == "KIB/S") +- unit = "KiB/s"; ++ unit = mRealUnits ? "KB/s" : "KiB/s"; + + if(id == 100) //if we are the first sensor, just use that sensors units as the global unit + mUnit = unit; +@@ -714,7 +733,8 @@ void FancyPlotter::answerReceived( int i + sensor->maxValue = info.max(); + sensor->minValue = info.min(); + sensor->setUnit( unit ); +- sensor->setDescription( info.name() ); ++ if(sensor->description().isEmpty()) ++ sensor->setDescription( info.name() ); + + QString summationName = sensor->summationName; + int beamId = sensor->beamId; +@@ -723,7 +743,7 @@ void FancyPlotter::answerReceived( int i + Q_ASSERT(beamId < mLabelLayout->count()); + + if(summationName.isEmpty()) +- static_cast((static_cast(mLabelLayout->itemAt(beamId)))->widget())->setLabel(info.name(), mPlotter->beamColor(beamId)); ++ static_cast((static_cast(mLabelLayout->itemAt(beamId)))->widget())->setLabel(sensor->description(), mPlotter->beamColor(beamId)); + + } else if( id == 200) { + /* FIXME This doesn't check the host! */ +@@ -743,8 +763,8 @@ void FancyPlotter::answerReceived( int i + else if(KSGRD::Style->numSensorColors() != 0) + color = KSGRD::Style->sensorColor( beamId % KSGRD::Style->numSensorColors()); + addSensor( sensor->hostname, sensorName, +- (sensor->type.isEmpty()) ? "float" : sensor->type +- , "", color, sensor->name.pattern(), beamId, sensor->summationName); ++ (sensor->type.isEmpty()) ? "float" : sensor->type, ++ sensor->description, color, sensor->name.pattern(), beamId, sensor->summationName); + } + } + } +@@ -823,7 +843,7 @@ bool FancyPlotter::restoreSettings( QDom + } else + addSensor( el.attribute( "hostName" ), el.attribute( "sensorName" ), + ( el.attribute( "sensorType" ).isEmpty() ? "float" : +- el.attribute( "sensorType" ) ), "", restoreColor( el, "color", ++ el.attribute( "sensorType" ) ), el.attribute( "description" ), restoreColor( el, "color", + KSGRD::Style->sensorColor( i ) ), QString(), mBeams, el.attribute("summationName") ); + } + +@@ -873,16 +893,18 @@ bool FancyPlotter::saveSettings( QDomDoc + } else { + QDomElement beam = doc.createElement( "beam" ); + element.appendChild( beam ); ++ beam.setAttribute( "sensorType", sensor->type() ); + beam.setAttribute( "hostName", sensor->hostName() ); +- if(regExpName.isEmpty()) ++ if(regExpName.isEmpty()) { + beam.setAttribute( "sensorName", sensor->name() ); +- else { ++ if(sensor->hasDescription) ++ beam.setAttribute( "description", sensor->description() ); ++ } else { + beam.setAttribute( "regexpSensorName", sensor->regExpName() ); + hash[regExpName] = beam; ++ if(!sensor->summationName.isEmpty()) ++ beam.setAttribute( "summationName", sensor->summationName); + } +- if(!sensor->summationName.isEmpty()) +- beam.setAttribute( "summationName", sensor->summationName); +- beam.setAttribute( "sensorType", sensor->type() ); + saveColor( beam, "color", mPlotter->beamColor( beamId ) ); + } + } +@@ -918,6 +940,7 @@ FPSensorProperties::FPSensorProperties( + minValue = 0; + lastValue = 0; + isInteger = (type == "integer"); ++ hasDescription = !description.isEmpty(); + } + + FPSensorProperties::~FPSensorProperties() Property changes on: head/x11/kde4-workspace/files/patch-ksysguard_gui_SensorDisplayLib_FancyPlotter.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/x11/kde4-workspace/files/patch-ksysguard_gui_SensorDisplayLib_FancyPlotter.h =================================================================== --- head/x11/kde4-workspace/files/patch-ksysguard_gui_SensorDisplayLib_FancyPlotter.h (nonexistent) +++ head/x11/kde4-workspace/files/patch-ksysguard_gui_SensorDisplayLib_FancyPlotter.h (revision 434823) @@ -0,0 +1,29 @@ +* Add a couple variables for the additional functionality in FancyPlotter.cpp +* +--- ksysguard/gui/SensorDisplayLib/FancyPlotter.h.orig 2015-06-26 03:17:21 UTC ++++ ksysguard/gui/SensorDisplayLib/FancyPlotter.h +@@ -52,6 +52,7 @@ class FPSensorProperties : public KSGRD: + double minValue; + double lastValue; + bool isInteger; ++ bool hasDescription; + + private: + QColor mColor; +@@ -104,7 +105,7 @@ class FancyPlotter : public KSGRD::Senso + private: + void sendDataToPlotter(); + uint mBeams; +- ++ + int mNumAnswers; + /** When we talk to the sensor, it tells us a range. Record the max here. equals 0 until we have an answer from it */ + double mSensorReportedMax; +@@ -131,6 +132,7 @@ class FancyPlotter : public KSGRD::Senso + QLabel *mHeading; + + QString mUnit; ++ bool mRealUnits; + + QList mSensorsToAdd; + QBoxLayout *mLabelLayout; Property changes on: head/x11/kde4-workspace/files/patch-ksysguard_gui_SensorDisplayLib_FancyPlotter.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/x11/kde4-workspace/files/patch-ksysguard_gui_SystemLoad2.sgrd =================================================================== --- head/x11/kde4-workspace/files/patch-ksysguard_gui_SystemLoad2.sgrd (nonexistent) +++ head/x11/kde4-workspace/files/patch-ksysguard_gui_SystemLoad2.sgrd (revision 434823) @@ -0,0 +1,24 @@ +* Provide a detailed view of Memory and Swap Used instead of the simplistic and +* misleading view that showed only application use (kernel use was neglected) +* +--- ksysguard/gui/SystemLoad2.sgrd.orig 2015-06-26 03:17:21 UTC ++++ ksysguard/gui/SystemLoad2.sgrd +@@ -3,11 +3,14 @@ + + + +- ++ + +- +- +- ++ ++ ++ ++ ++ ++ + + + Property changes on: head/x11/kde4-workspace/files/patch-ksysguard_gui_SystemLoad2.sgrd ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/x11/kde4-workspace/files/patch-ksysguard_gui_ksysguard.cpp =================================================================== --- head/x11/kde4-workspace/files/patch-ksysguard_gui_ksysguard.cpp (nonexistent) +++ head/x11/kde4-workspace/files/patch-ksysguard_gui_ksysguard.cpp (revision 434823) @@ -0,0 +1,73 @@ +* More detailed Memory stats in the KSysGuard's Status Bar +* +* Make the the Status Bar elements reasonably proportional in size +* +--- ksysguard/gui/ksysguard.cpp.orig 2015-06-26 03:17:21 UTC ++++ ksysguard/gui/ksysguard.cpp +@@ -93,19 +93,21 @@ TopLevel::TopLevel() + /* Create the status bar. It displays some information about the + * number of processes and the memory consumption of the local + * host. */ +- const int STATUSBAR_STRETCH=1; +- + sbProcessCount = new QLabel(); +- statusBar()->addWidget( sbProcessCount, STATUSBAR_STRETCH ); ++ sbProcessCount->setAlignment( Qt::AlignHCenter ); ++ statusBar()->addWidget( sbProcessCount, 3 ); // 1 long label + 1 value = 3 + + sbCpuStat = new QLabel(); +- statusBar()->addWidget( sbCpuStat, STATUSBAR_STRETCH ); ++ sbCpuStat->setAlignment( Qt::AlignHCenter ); ++ statusBar()->addWidget( sbCpuStat, 2 ); // 1 short label + 1 value = 2 + + sbMemTotal = new QLabel(); +- statusBar()->addWidget( sbMemTotal, STATUSBAR_STRETCH ); ++ sbMemTotal->setAlignment( Qt::AlignHCenter ); ++ statusBar()->addWidget( sbMemTotal, 5 ); // 1 label + 4 values = 5 + + sbSwapTotal = new QLabel(); +- statusBar()->addWidget( sbSwapTotal, STATUSBAR_STRETCH ); ++ sbSwapTotal->setAlignment( Qt::AlignHCenter ); ++ statusBar()->addWidget( sbSwapTotal, 3 ); // 1 label + 2 values = 3 + + statusBar()->hide(); + +@@ -453,11 +455,7 @@ void TopLevel::answerReceived( int id, c + + case 4: + mUsedApplication = answer.toLongLong(); +- //Use a multi-length string +- s = i18nc( "Arguments are formatted byte sizes (used/total)", "Memory: %1 / %2" "\xc2\x9c" "Mem: %1 / %2" "\xc2\x9c" "Mem: %1" "\xc2\x9c" "%1", +- KGlobal::locale()->formatByteSize( mUsedApplication*1024), +- KGlobal::locale()->formatByteSize( (mFree+mUsedTotal)*1024 ) ); +- sbMemTotal->setText( s ); ++ setMemInfo( mUsedApplication, mUsedTotal, mFree, unit ); + break; + + case 5: +@@ -477,6 +475,17 @@ void TopLevel::answerReceived( int id, c + } + } + ++void TopLevel::setMemInfo(qlonglong usedapps, qlonglong usedtotal, qlonglong free, const QString & ) ++{ ++ QString msg; ++ msg = i18nc( "Arguments are formatted byte sizes (used/total)", "Memory: (K %4 + U %3) %1 / %2" "\xc2\x9c" "Memory: (U %3) %1 / %2" "\xc2\x9c" "Memory: %1 / %2" "\xc2\x9c" "Mem: %1 / %2" "\xc2\x9c" "Mem: %1" "\xc2\x9c" "%1", ++ KGlobal::locale()->formatByteSize( usedtotal*1024 ), ++ KGlobal::locale()->formatByteSize( (free+usedtotal)*1024 ), ++ KGlobal::locale()->formatByteSize( usedapps*1024 ), ++ KGlobal::locale()->formatByteSize( (usedtotal-usedapps)*1024 ) ); ++ sbMemTotal->setText( msg ); ++} ++ + void TopLevel::setSwapInfo( qlonglong used, qlonglong free, const QString & ) + { + QString msg; +@@ -487,7 +496,6 @@ void TopLevel::setSwapInfo( qlonglong us + KGlobal::locale()->formatByteSize( used*1024 ), + KGlobal::locale()->formatByteSize( (free+used)*1024) ); + } +- + sbSwapTotal->setText( msg ); + } + Property changes on: head/x11/kde4-workspace/files/patch-ksysguard_gui_ksysguard.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/x11/kde4-workspace/files/patch-ksysguard_gui_ksysguard.h =================================================================== --- head/x11/kde4-workspace/files/patch-ksysguard_gui_ksysguard.h (nonexistent) +++ head/x11/kde4-workspace/files/patch-ksysguard_gui_ksysguard.h (revision 434823) @@ -0,0 +1,12 @@ +* Add the detailed setMemInfo used in ksysguard.cpp +* +--- ksysguard/gui/ksysguard.h.orig 2015-06-26 03:17:21 UTC ++++ ksysguard/gui/ksysguard.h +@@ -77,6 +77,7 @@ class TopLevel : public KXmlGuiWindow, p + void configureCurrentSheet(); + + private: ++ void setMemInfo( qlonglong, qlonglong, qlonglong, const QString& ); + void setSwapInfo( qlonglong, qlonglong, const QString& ); + void changeEvent( QEvent * event ); + void retranslateUi(); Property changes on: head/x11/kde4-workspace/files/patch-ksysguard_gui_ksysguard.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/x11/kde4-workspace/files/patch-kwin_opengltest_CMakeLists.txt =================================================================== --- head/x11/kde4-workspace/files/patch-kwin_opengltest_CMakeLists.txt (revision 434822) +++ head/x11/kde4-workspace/files/patch-kwin_opengltest_CMakeLists.txt (revision 434823) @@ -1,15 +1,15 @@ ---- kwin/opengltest/CMakeLists.txt.orig 2014-11-06 22:36:58 UTC +--- kwin/opengltest/CMakeLists.txt.orig 2015-06-26 03:17:21 UTC +++ kwin/opengltest/CMakeLists.txt @@ -2,9 +2,11 @@ set(kwin_opengl_test_SRCS opengltest.cpp ) +find_package(Threads) + kde4_add_executable(kwin_opengl_test ${kwin_opengl_test_SRCS}) -target_link_libraries(kwin_opengl_test ${X11_LIBRARIES} ${OPENGL_gl_LIBRARY}) +target_link_libraries(kwin_opengl_test ${X11_LIBRARIES} ${OPENGL_gl_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) install(TARGETS kwin_opengl_test DESTINATION ${LIBEXEC_INSTALL_DIR} ) Index: head/x11/kde4-workspace/files/patch-plasma_desktop_toolboxes_desktoptoolbox.cpp =================================================================== --- head/x11/kde4-workspace/files/patch-plasma_desktop_toolboxes_desktoptoolbox.cpp (nonexistent) +++ head/x11/kde4-workspace/files/patch-plasma_desktop_toolboxes_desktoptoolbox.cpp (revision 434823) @@ -0,0 +1,25 @@ +* Hide the desktop toolbox (aka "cashew") when widgets are locked +* +--- plasma/desktop/toolboxes/desktoptoolbox.cpp.orig 2015-06-26 03:17:21 UTC ++++ plasma/desktop/toolboxes/desktoptoolbox.cpp +@@ -177,6 +177,8 @@ void DesktopToolBox::init() + connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), + this, SLOT(updateTheming())); + Plasma::ToolTipManager::self()->registerWidget(this); ++ QObject::connect(m_containment, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), ++ this, SLOT(immutabilityChanged(Plasma::ImmutabilityType))); + + if (KAuthorized::authorizeKAction("logout")) { + QAction *action = new QAction(i18n("Leave..."), this); +@@ -761,6 +763,11 @@ void DesktopToolBox::toggle() + setShowing(!isShowing()); + } + ++void DesktopToolBox::immutabilityChanged(Plasma::ImmutabilityType immutability) ++{ ++ setVisible(immutability == Plasma::Mutable); ++} ++ + void DesktopToolBox::adjustBackgroundBorders() const + { + Plasma::FrameSvg *background = const_cast(m_background); Property changes on: head/x11/kde4-workspace/files/patch-plasma_desktop_toolboxes_desktoptoolbox.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/x11/kde4-workspace/files/patch-plasma_desktop_toolboxes_desktoptoolbox.h =================================================================== --- head/x11/kde4-workspace/files/patch-plasma_desktop_toolboxes_desktoptoolbox.h (nonexistent) +++ head/x11/kde4-workspace/files/patch-plasma_desktop_toolboxes_desktoptoolbox.h (revision 434823) @@ -0,0 +1,12 @@ +* Add handler for change of mutability of the desktop toolbox +* +--- plasma/desktop/toolboxes/desktoptoolbox.h.orig 2015-06-26 03:17:21 UTC ++++ plasma/desktop/toolboxes/desktoptoolbox.h +@@ -81,6 +81,7 @@ protected Q_SLOTS: + * show/hide the toolbox + */ + void toggle(); ++ void immutabilityChanged(Plasma::ImmutabilityType immutability); + + // basic desktop controls + void startLogout(); Property changes on: head/x11/kde4-workspace/files/patch-plasma_desktop_toolboxes_desktoptoolbox.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/x11/kde4-workspace/files/patch-powerdevil__daemon__backends__upower__xrandrbrightness.cpp =================================================================== --- head/x11/kde4-workspace/files/patch-powerdevil__daemon__backends__upower__xrandrbrightness.cpp (revision 434822) +++ head/x11/kde4-workspace/files/patch-powerdevil__daemon__backends__upower__xrandrbrightness.cpp (revision 434823) @@ -1,21 +1,21 @@ ---- ./powerdevil/daemon/backends/upower/xrandrbrightness.cpp.orig 2012-11-30 08:24:40.000000000 +0100 -+++ ./powerdevil/daemon/backends/upower/xrandrbrightness.cpp 2013-01-22 20:44:13.303230302 +0100 -@@ -69,6 +69,9 @@ +--- powerdevil/daemon/backends/upower/xrandrbrightness.cpp.orig 2015-06-26 03:17:21 UTC ++++ powerdevil/daemon/backends/upower/xrandrbrightness.cpp +@@ -62,6 +62,9 @@ XRandrBrightness::XRandrBrightness() qWarning("No available Randr resources"); return; } + + if (brightness() == -1) + m_resources = 0; } XRandrBrightness::~XRandrBrightness() -@@ -85,7 +88,7 @@ +@@ -89,7 +92,7 @@ bool XRandrBrightness::isSupported() con float XRandrBrightness::brightness() const { - float result = 0; + float result = -1; if (!m_resources) return result; Index: head/x11/kde4-workspace/files/patch-startkde.cmake =================================================================== --- head/x11/kde4-workspace/files/patch-startkde.cmake (revision 434822) +++ head/x11/kde4-workspace/files/patch-startkde.cmake (revision 434823) @@ -1,12 +1,12 @@ ---- startkde.cmake.orig 2009-10-07 08:37:24.000000000 +1100 -+++ startkde.cmake 2009-12-28 10:02:07.133352180 +1000 -@@ -337,7 +337,8 @@ - fi +--- startkde.cmake.orig 2015-06-26 03:17:21 UTC ++++ startkde.cmake +@@ -271,7 +271,8 @@ export XDG_DATA_DIRS + # Make sure that D-Bus is running # D-Bus autolaunch is broken if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then - eval `dbus-launch --sh-syntax --exit-with-session` + uuid="`dbus-uuidgen --get`" + eval `dbus-launch --sh-syntax --exit-with-session --autolaunch $uuid` fi - if qdbus >/dev/null 2>/dev/null; then + if $qdbus >/dev/null 2>/dev/null; then : # ok Index: head/x11/kde4-workspace/files/patch-usbview =================================================================== --- head/x11/kde4-workspace/files/patch-usbview (revision 434822) +++ head/x11/kde4-workspace/files/patch-usbview (revision 434823) @@ -1,493 +1,493 @@ Use libusb-1 to query info about usb devices on all platforms, leave old method as a fallback for Linux only. Remove *BSD specific code, it doesn't work on FreeBSD 8.x and greater. Old code probably works on NetBSD, but let it use libusb-1 as well. Use DeviceNotifier instead of polling. ---- /dev/null +--- cmake/modules/FindLibUSB1.cmake.orig 2016-12-13 11:26:31 UTC +++ cmake/modules/FindLibUSB1.cmake @@ -0,0 +1,21 @@ +# - Try to find libusb v1.0 library +# Once done this defines +# +# LIBUSB1_FOUND - system has libusb +# LIBUSB1_INCLUDE_DIR - libusb include directory +# LIBUSB1_LIBRARY - libusb library + +find_package(PkgConfig) +pkg_check_modules(PC_LIBUSB1 QUIET libusb-1.0) + +find_path(LIBUSB1_INCLUDE_DIR libusb.h + HINTS ${PC_LIBUSB1_INCLUDEDIR} ${PC_LIBUSB1_INCLUDE_DIRS}) + +# On FreeBSD libusb provides both v0.1 and v1.0 API +find_library(LIBUSB1_LIBRARY NAMES usb-1.0 usb + HINTS ${PC_LIBUSB1_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBUSB1 DEFAULT_MSG LIBUSB1_LIBRARY LIBUSB1_INCLUDE_DIR) + +mark_as_advanced(LIBUSB1_INCLUDE_DIR LIBUSB1_LIBRARY) ---- kinfocenter/Modules/usbview/CMakeLists.txt +--- kinfocenter/Modules/usbview/CMakeLists.txt.orig 2015-06-26 03:17:21 UTC +++ kinfocenter/Modules/usbview/CMakeLists.txt @@ -1,15 +1,25 @@ +macro_optional_find_package(LibUSB1) +macro_bool_to_01(LIBUSB1_FOUND HAVE_LIBUSB1) +macro_log_feature(LIBUSB1_FOUND "libusb-1" "User level access to USB devices" "http://libusb.sourceforge.net/" FALSE "" "Provides usb info support in KControl.") - +configure_file (config-kcmusb.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kcmusb.h ) ########### next target ############### +if (LIBUSB1_FOUND) + include_directories( ${LIBUSB1_INCLUDE_DIR} ) +endif (LIBUSB1_FOUND) + set(kcm_usb_PART_SRCS kcmusb.cpp usbdevices.cpp usbdb.cpp ) kde4_add_plugin(kcm_usb ${kcm_usb_PART_SRCS}) -target_link_libraries(kcm_usb ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY}) +target_link_libraries(kcm_usb ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${QT_QTGUI_LIBRARY}) +if (LIBUSB1_FOUND) + target_link_libraries(kcm_usb ${LIBUSB1_LIBRARY}) +endif (LIBUSB1_FOUND) install(TARGETS kcm_usb DESTINATION ${PLUGIN_INSTALL_DIR} ) ---- /dev/null +--- kinfocenter/Modules/usbview/config-kcmusb.h.cmake.orig 2016-12-13 11:26:31 UTC +++ kinfocenter/Modules/usbview/config-kcmusb.h.cmake @@ -0,0 +1,2 @@ +/* Defined if you have libusb */ +#cmakedefine HAVE_LIBUSB1 1 ---- kinfocenter/Modules/usbview/kcmusb.cpp +--- kinfocenter/Modules/usbview/kcmusb.cpp.orig 2015-06-26 03:17:21 UTC +++ kinfocenter/Modules/usbview/kcmusb.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -20,6 +19,7 @@ #include #include +#include #include #include -@@ -63,11 +63,8 @@ USBViewer::USBViewer(QWidget *parent, const QVariantList &) : +@@ -63,11 +63,8 @@ USBViewer::USBViewer(QWidget *parent, co _details = new QTextEdit(splitter); _details->setReadOnly(true); - QTimer *refreshTimer = new QTimer(this); - // 1 sec seems to be a good compromise between latency and polling load. - refreshTimer->start(1000); - - connect(refreshTimer, SIGNAL(timeout()), SLOT(refresh())); + connect(Solid::DeviceNotifier::instance(),SIGNAL(deviceAdded(QString)), SLOT(refresh())); + connect(Solid::DeviceNotifier::instance(),SIGNAL(deviceRemoved(const QString)), SLOT(refresh())); connect(_devices, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectionChanged(QTreeWidgetItem*))); KAboutData *about = new KAboutData(I18N_NOOP("kcmusb"), 0, ki18n("KDE USB Viewer"), -@@ -113,8 +110,12 @@ static void delete_recursive(QTreeWidgetItem *item, const QMap new_items; +#if defined(HAVE_LIBUSB1) + USBDevice::parse(); +#else if (!USBDevice::parse("/proc/bus/usb/devices")) USBDevice::parseSys("/sys/bus/usb/devices"); +#endif int level = 0; bool found = true; ---- kinfocenter/Modules/usbview/usbdevices.cpp +--- kinfocenter/Modules/usbview/usbdevices.cpp.orig 2015-06-26 03:17:21 UTC +++ kinfocenter/Modules/usbview/usbdevices.cpp @@ -27,9 +27,9 @@ #include -#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) -#include -#include +#include +#if defined(HAVE_LIBUSB1) +#include #endif QList USBDevice::_devices; @@ -48,6 +48,7 @@ USBDevice::~USBDevice() { } +#if !defined(HAVE_LIBUSB1) static QString catFile(QString fname) { char buffer[256]; QString result; -@@ -129,6 +130,7 @@ void USBDevice::parseLine(const QString& line) { +@@ -129,6 +130,7 @@ void USBDevice::parseLine(const QString& } else if (line.startsWith("P:")) sscanf(line.toLocal8Bit().data(), "P: Vendor=%x ProdID=%x Rev=%x.%x", &_vendorID, &_prodID, &_revMajor, &_revMinor); } +#endif // !defined(HAVE_LIBUSB1) USBDevice* USBDevice::find(int bus, int device) { foreach(USBDevice* usbDevice, _devices) { @@ -160,6 +162,10 @@ QString USBDevice::dump() { r += "
"; + r += i18n("", _bus); + r += i18n("", _device); + r += ""; + QString c = QString("").arg(_class); QString cname = _db->cls(_class); if (!cname.isEmpty()) @@ -175,11 +181,9 @@ QString USBDevice::dump() { if (!prname.isEmpty()) pr += ""; r += i18n("%1", pr); -#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)) r += ki18n("") .subs(_verMajor,0,16).subs(_verMinor,2,16,QChar::fromLatin1('0')) .toString(); -#endif r += ""; QString v = QString::number(_vendorID, 16); @@ -198,22 +202,15 @@ QString USBDevice::dump() { r += ""; r += i18n("", _speed); - r += i18n("", _channels); -#if (defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)) && !defined(DISABLE_USBDEVICES_FREEBSD) - if ( _power ) +#if defined(HAVE_LIBUSB1) + if ( _power != -1 ) r += i18n("", _power); else - r += i18n(""); - r += i18n("", _devnodes.at(0)); - if ( _devnodes.count() > 1 ) { - QStringList::const_iterator it = _devnodes.constBegin(); - ++it; - for (; it != _devnodes.constEnd(); ++it ) - r += ""; - } -#else + r += i18n(""); +#else // defined(HAVE_LIBUSB1) + r += i18n("", _channels); +#endif // defined(HAVE_LIBUSB1) r += i18n("", _maxPacketSize); -#endif r += ""; if (_hasBW) { @@ -228,7 +225,82 @@ QString USBDevice::dump() { return r; } -#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)) +#if defined(HAVE_LIBUSB1) + +void USBDevice::dump_usbdev_info(libusb_device *dev) { + + _bus = libusb_get_bus_number(dev); + _device = libusb_get_device_address(dev); + + switch (libusb_get_device_speed(dev)) { + case LIBUSB_SPEED_LOW: _speed = 1.5; break; + case LIBUSB_SPEED_FULL: _speed = 12; break; + case LIBUSB_SPEED_HIGH: _speed = 480; break; + case LIBUSB_SPEED_SUPER: _speed = 5000; break; + } + + struct libusb_config_descriptor *conf; + if (libusb_get_active_config_descriptor(dev, &conf) == 0) { + _power = conf->MaxPower; + libusb_free_config_descriptor(conf); + } else { + _power = -1; + } + + struct libusb_device_descriptor desc; + if (libusb_get_device_descriptor(dev, &desc) == 0) { + _verMajor = desc.bcdUSB >> 8; + _verMinor = desc.bcdUSB & 0x00FF; + _class = desc.bDeviceClass; + _sub = desc.bDeviceSubClass; + _prot = desc.bDeviceProtocol; + _maxPacketSize = desc.bMaxPacketSize0; + _configs = desc.bNumConfigurations; + _vendorID = desc.idVendor; + _prodID = desc.idProduct; + _revMajor = desc.bcdDevice >> 8; + _revMinor = desc.bcdDevice & 0x00FF; + } + + libusb_device_handle *hdev; + uchar buf[256]; + if (libusb_open(dev, &hdev) == 0) { + if (libusb_get_string_descriptor_ascii(hdev, desc.iManufacturer, buf, sizeof(buf)) > 0) + _manufacturer = (char*) buf; + if (libusb_get_string_descriptor_ascii(hdev, desc.iProduct, buf, sizeof(buf)) > 0) + _product = (char*) buf; + if (libusb_get_string_descriptor_ascii(hdev, desc.iSerialNumber, buf, sizeof(buf)) > 0) + _serial = (char*) buf; + libusb_close(hdev); + } +} + +bool USBDevice::parse() { + _devices.clear(); + + int r = libusb_init(NULL); + if (r != 0) + return false; + + libusb_device **devs; + ssize_t cnt = libusb_get_device_list(NULL, &devs); + if (cnt < 0) + return false; + + libusb_device *dev; + int i = 0; + while ((dev = devs[i++]) != NULL) { + USBDevice* device = new USBDevice(); + device->dump_usbdev_info(dev); + } + libusb_free_device_list(devs, 1); + + libusb_exit(NULL); + return true; +} + +#else // defined(HAVE_LIBUSB1) +#if defined(Q_OS_LINUX) bool USBDevice::parse(const QString &fname) { _devices.clear(); -@@ -290,146 +362,19 @@ bool USBDevice::parseSys(const QString &dname) { +@@ -290,146 +362,19 @@ bool USBDevice::parseSys(const QString & return d.count(); } -#else - -// Unused by *BSD -bool USBDevice::parseSys(const QString &fname) -{ - Q_UNUSED(fname) - - return true; -} - -# if defined(DISABLE_USBDEVICES_FREEBSD) - -/* - * FIXME: The USB subsystem has changed a lot in FreeBSD 8.0 - * Support for it must be written. - */ +#else // defined(Q_OS_LINUX) -bool USBDevice::parse(const QString &fname) -{ +bool USBDevice::parse(const QString &fname) { Q_UNUSED(fname) return true; } -# else - -/* - * FreeBSD support by Markus Brueffer - * - * Basic idea and some code fragments were taken from FreeBSD's usbdevs(8), - * originally developed for NetBSD, so this code should work with no or - * only little modification on NetBSD. - */ - -void USBDevice::collectData( int fd, int level, usb_device_info &di, int parent) -{ - // determine data for this device - _level = level; - _parent = parent; - - _bus = di.udi_bus; - _device = di.udi_addr; - _product = QLatin1String(di.udi_product); - if ( _device == 1 ) - _product += ' ' + QString::number( _bus ); - _manufacturer = QLatin1String(di.udi_vendor); - _prodID = di.udi_productNo; - _vendorID = di.udi_vendorNo; - _class = di.udi_class; - _sub = di.udi_subclass; - _prot = di.udi_protocol; - _power = di.udi_power; - _channels = di.udi_nports; - - // determine the speed -#if defined(__DragonFly__) || (defined(Q_OS_FREEBSD) && __FreeBSD_version > 490102) || defined(Q_OS_NETBSD) - switch (di.udi_speed) { - case USB_SPEED_LOW: _speed = 1.5; break; - case USB_SPEED_FULL: _speed = 12.0; break; - case USB_SPEED_HIGH: _speed = 480.0; break; - } -#else - _speed = di.udi_lowspeed ? 1.5 : 12.0; -#endif - - // Get all attached devicenodes - for ( int i = 0; i < USB_MAX_DEVNAMES; ++i ) - if ( di.udi_devnames[i][0] ) - _devnodes << di.udi_devnames[i]; - - // For compatibility, split the revision number - sscanf( di.udi_release, "%x.%x", &_revMajor, &_revMinor ); - - // Cycle through the attached devices if there are any - for ( int p = 0; p < di.udi_nports; ++p ) { - // Get data for device - struct usb_device_info di2; - - di2.udi_addr = di.udi_ports[p]; - - if ( di2.udi_addr >= USB_MAX_DEVICES ) - continue; - - if ( ioctl(fd, USB_DEVICEINFO, &di2) == -1 ) - continue; - - // Only add the device if we didn't detect it, yet - if (!find( di2.udi_bus, di2.udi_addr ) ) - { - USBDevice *device = new USBDevice(); - device->collectData( fd, level + 1, di2, di.udi_addr ); - } - } -} - -bool USBDevice::parse(const QString &fname) -{ - Q_UNUSED(fname) - - static bool showErrorMessage = true; - bool error = false; - _devices.clear(); - - QFile controller("/dev/usb0"); - int i = 1; - while ( controller.exists() ) - { - // If the devicenode exists, continue with further inspection - if ( controller.open(QIODevice::ReadOnly) ) - { - for ( int addr = 1; addr < USB_MAX_DEVICES; ++addr ) - { - struct usb_device_info di; - - di.udi_addr = addr; - if ( ioctl(controller.handle(), USB_DEVICEINFO, &di) != -1 ) - { - if (!find( di.udi_bus, di.udi_addr ) ) - { - USBDevice *device = new USBDevice(); - device->collectData( controller.handle(), 0, di, 0); - } - } - } - controller.close(); -#ifndef Q_OS_NETBSD - } else { - error = true; -#endif - } - controller.setFileName( QString::fromLocal8Bit("/dev/usb%1").arg(i++) ); - } - - if ( showErrorMessage && error ) { - showErrorMessage = false; - KMessageBox::error( 0, i18n("Could not open one or more USB controller. Make sure, you have read access to all USB controllers that should be listed here.")); - } +bool USBDevice::parseSys(const QString &dname) { + Q_UNUSED(dname) return true; } -# endif // defined(DISABLE_USBDEVICES_FREEBSD) -#endif // !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)) +#endif // defined(Q_OS_LINUX) +#endif // defined(HAVE_LIBUSB1) ---- kinfocenter/Modules/usbview/usbdevices.h +--- kinfocenter/Modules/usbview/usbdevices.h.orig 2015-06-26 03:17:21 UTC +++ kinfocenter/Modules/usbview/usbdevices.h @@ -14,18 +14,9 @@ #include #include -#if defined(__DragonFly__) -#include -#include -#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) -#include -# if defined(__FreeBSD_version) && __FreeBSD_version >= 800100 -# define DISABLE_USBDEVICES_FREEBSD -# warning "The USB subsystem has changed in 8.0. Disabling." -# else -# include -# include -# endif +#include +#if defined(HAVE_LIBUSB1) +#include #endif class USBDB; @@ -36,10 +27,12 @@ public: USBDevice(); ~USBDevice(); - +#if defined(HAVE_LIBUSB1) + void dump_usbdev_info(libusb_device *dev); +#else void parseLine(const QString &line); void parseSysDir(int bus, int parent, int level, const QString &line); - +#endif int level() const { return _level; } @@ -60,8 +53,12 @@ public: return _devices; } static USBDevice *find(int bus, int device); +#if defined(HAVE_LIBUSB1) + static bool parse(); +#else static bool parse(const QString& fname); static bool parseSys(const QString& fname); +#endif private: @@ -82,10 +79,6 @@ private: unsigned int _vendorID, _prodID, _revMajor, _revMinor; -#if (defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)) && !defined(DISABLE_USBDEVICES_FREEBSD) - void collectData( int fd, int level, usb_device_info &di, int parent ); - QStringList _devnodes; -#endif }; #endif
Bus number%1
Device address%1
%1(" + prname +")
Protocol
USB Version%1.%2
Speed%1 Mbit/s
Channels%1
Power Consumption%1 mA
Power Consumptionself powered
Attached Devicenodes%1
" + *it + "
Power Consumptionunknown
Channels%1
Max. Packet Size%1