NetBSD infocenter support.

This commit is contained in:
Mark Davies 2007-12-31 22:33:43 +00:00 committed by Thomas Klausner
parent 4e2f6e60c9
commit 72f7ab8a82
8 changed files with 441 additions and 2 deletions

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.7 2007/12/30 00:02:41 mwdavies Exp $
@comment $NetBSD: PLIST,v 1.8 2007/12/31 22:33:43 mwdavies Exp $
bin/genkdmconf
bin/kaccess
bin/kapplymousetheme
@ -164,6 +164,7 @@ lib/kde4/kcm_colors.so
lib/kde4/kcm_display.so
lib/kde4/kcm_energy.so
lib/kde4/kcm_fonts.so
lib/kde4/kcm_info.so
lib/kde4/kcm_input.so
lib/kde4/kcm_kdm.so
lib/kde4/kcm_keyboard.so
@ -179,11 +180,13 @@ lib/kde4/kcm_kwindesktop.so
lib/kde4/kcm_kwinoptions.so
lib/kde4/kcm_kwinrules.so
lib/kde4/kcm_launch.so
lib/kde4/kcm_nic.so
lib/kde4/kcm_randr.so
lib/kde4/kcm_screensaver.so
lib/kde4/kcm_smserver.so
lib/kde4/kcm_solid.so
lib/kde4/kcm_style.so
lib/kde4/kcm_usb.so
lib/kde4/kcm_xinerama.so
lib/kde4/kded_khotkeys.so
lib/kde4/kded_networkstatus.so
@ -521,6 +524,7 @@ share/kde/apps/kcmkeys/unix3.kksrc
share/kde/apps/kcmkeys/win3.kksrc
share/kde/apps/kcmkeys/win4.kksrc
share/kde/apps/kcmkeys/wm3.kksrc
share/kde/apps/kcmusb/usb.ids
share/kde/apps/kconf_update/convertShortcuts.pl
share/kde/apps/kconf_update/kaccel.upd
share/kde/apps/kconf_update/kcmdisplayrc.upd
@ -840,19 +844,24 @@ share/kde4/services/accessibility.desktop
share/kde4/services/bell.desktop
share/kde4/services/clock.desktop
share/kde4/services/colors.desktop
share/kde4/services/devices.desktop
share/kde4/services/desktop.desktop
share/kde4/services/dma.desktop
share/kde4/services/display.desktop
share/kde4/services/energy.desktop
share/kde4/services/fonts.desktop
share/kde4/services/installktheme.desktop
share/kde4/services/interrupts.desktop
share/kde4/services/ion-bbcukmet.desktop
share/kde4/services/ion-envcan.desktop
share/kde4/services/ion-noaa.desktop
share/kde4/services/ioports.desktop
share/kde4/services/kaccess.desktop
share/kde4/services/kcm_solid.desktop
share/kde4/services/kcmaccess.desktop
share/kde4/services/kcmlaunch.desktop
share/kde4/services/kcmsmserver.desktop
share/kde4/services/kcmusb.desktop
share/kde4/services/kded/khotkeys.desktop
share/kde4/services/kded/networkstatus.desktop
share/kde4/services/kdm.desktop
@ -909,7 +918,12 @@ share/kde4/services/kwinfocus.desktop
share/kde4/services/kwinmoving.desktop
share/kde4/services/kwinoptions.desktop
share/kde4/services/kwinrules.desktop
share/kde4/services/memory.desktop
share/kde4/services/mouse.desktop
share/kde4/services/nic.desktop
share/kde4/services/opengl.desktop
share/kde4/services/partitions.desktop
share/kde4/services/pci.desktop
share/kde4/services/plasma-animator-default.desktop
share/kde4/services/plasma-applet-analogclock.desktop
share/kde4/services/plasma-applet-devicenotifier.desktop
@ -938,8 +952,10 @@ share/kde4/services/plasma-runner-search.desktop
share/kde4/services/plasma-runner-webshortcuts.desktop
share/kde4/services/plasma-scriptengine-qscript.desktop
share/kde4/services/plasma-tasks-default.desktop
share/kde4/services/processor.desktop
share/kde4/services/randr.desktop
share/kde4/services/screensaver.desktop
share/kde4/services/scsi.desktop
share/kde4/services/settings-about-me.desktop
share/kde4/services/settings-accessibility.desktop
share/kde4/services/settings-advanced-user-settings.desktop
@ -962,8 +978,10 @@ share/kde4/services/settings-window-behaviour.desktop
share/kde4/services/solidbackends/solid_fakebluetooth.desktop
share/kde4/services/solidbackends/solid_fakenet.desktop
share/kde4/services/solidbackends/solid_hal_power.desktop
share/kde4/services/sound.desktop
share/kde4/services/style.desktop
share/kde4/services/xinerama.desktop
share/kde4/services/xserver.desktop
share/kde4/servicetypes/kwineffect.desktop
share/kde4/servicetypes/plasma-animator.desktop
share/kde4/servicetypes/plasma-applet.desktop
@ -1053,6 +1071,7 @@ share/sounds/pop.wav
@dirrm share/kde/apps/kcontroledit
@comment in kde: @dirrm share/kde/apps/kcontrol/pics
@comment in kde: @dirrm share/kde/apps/kconf_update
@dirrm share/kde/apps/kcmusb
@dirrm share/kde/apps/kcmkeys
@dirrm share/kde/apps/kcminput/pics
@dirrm share/kde/apps/kcminput

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.7 2007/12/30 00:02:41 mwdavies Exp $
$NetBSD: distinfo,v 1.8 2007/12/31 22:33:43 mwdavies Exp $
SHA1 (Daemon.README) = eb1e6af52adc02ded77af17e8953134b7e60d23b
RMD160 (Daemon.README) = 39edd92ed4314397080f32a8caff0ac3f716ecf4
@ -19,6 +19,12 @@ SHA1 (patch-ad) = a78221cb83772e82f67dfd15d8f3a7391c44f76d
SHA1 (patch-ae) = 736fc439a34298f51c9fb09200b9dc8628eabc43
SHA1 (patch-af) = 00f4fd7dff0e44af433e52d732129cee2e38e84e
SHA1 (patch-ag) = ca61c6a2c6e3ebfff12ed6a3329f0e6808f0f8e1
SHA1 (patch-am) = 15ea2b89bae74bb012d3c062c861e32e1b8d7aca
SHA1 (patch-an) = 3e8e26c0e2c5c92b54a48589938b743a874fa2fa
SHA1 (patch-ao) = 63e5e52e4919f9e5709fad4314ec6fb1485f908a
SHA1 (patch-ap) = e107ce740aac52dcdfd7cd7393a864f5fd2ada2a
SHA1 (patch-aq) = 6b93230c91e3194c942e3f4b0ec51a1430455934
SHA1 (patch-ar) = 78129fe848e3547ee8aaf914cc080048b1aa9d34
SHA1 (patch-ba) = 544134d7be9acd472bdfd7732df5f7072727cf2e
SHA1 (patch-bb) = 5f29ac6869fb504f0051ad05f1363711ae5a3eff
SHA1 (patch-bc) = bb3106c46cad23f30a93d78f8c3600afeef1d414

View file

@ -0,0 +1,22 @@
$NetBSD: patch-am,v 1.1 2007/12/31 22:33:43 mwdavies Exp $
--- kcontrol/infocenter/usbview/usbdevices.h.orig 2007-06-27 22:45:19.000000000 +1200
+++ kcontrol/infocenter/usbview/usbdevices.h
@@ -18,7 +18,7 @@
#if defined(__DragonFly__)
#include <bus/usb/usb.h>
-#elif defined(Q_OS_FREEBSD)
+#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
#include <dev/usb/usb.h>
#endif
@@ -67,7 +67,7 @@ private:
unsigned int _vendorID, _prodID, _revMajor, _revMinor;
-#ifdef Q_OS_FREEBSD
+#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
void collectData( int fd, int level, usb_device_info &di, int parent );
QStringList _devnodes;
#endif

View file

@ -0,0 +1,60 @@
$NetBSD: patch-an,v 1.1 2007/12/31 22:33:43 mwdavies Exp $
--- kcontrol/infocenter/usbview/usbdevices.cpp.orig 2007-06-27 22:45:19.000000000 +1200
+++ kcontrol/infocenter/usbview/usbdevices.cpp
@@ -29,7 +29,7 @@
#include <math.h>
-#ifdef Q_OS_FREEBSD
+#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
#include <sys/ioctl.h>
#include <sys/param.h>
#endif
@@ -199,7 +199,7 @@ QString USBDevice::dump()
if (!prname.isEmpty())
pr += "<td>(" + prname +")</td>";
r += i18n("<tr><td><i>Protocol</i></td>%1</tr>", pr);
-#ifndef Q_OS_FREEBSD
+#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD))
r += ki18n("<tr><td><i>USB Version</i></td><td>%1.%2</td></tr>")
.subs(_verMajor,0,16).subs(_verMinor,2,16,QChar::fromLatin1('0'))
.toString();
@@ -223,7 +223,7 @@ QString USBDevice::dump()
r += i18n("<tr><td><i>Speed</i></td><td>%1 Mbit/s</td></tr>", _speed);
r += i18n("<tr><td><i>Channels</i></td><td>%1</td></tr>", _channels);
-#ifdef Q_OS_FREEBSD
+#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
if ( _power )
r += i18n("<tr><td><i>Power Consumption</i></td><td>%1 mA</td></tr>", _power);
else
@@ -254,7 +254,7 @@ QString USBDevice::dump()
}
-#ifndef Q_OS_FREEBSD
+#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD))
bool USBDevice::parse(const QString &fname)
{
_devices.clear();
@@ -350,7 +350,7 @@ void USBDevice::collectData( int fd, int
_channels = di.udi_nports;
// determine the speed
-#if defined(__DragonFly__) || __FreeBSD_version > 490102
+#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;
@@ -420,8 +420,10 @@ bool USBDevice::parse(const QString &fna
}
}
controller.close();
+#ifndef Q_OS_NETBSD
} else {
error = true;
+#endif
}
controller.setName( QString::fromLocal8Bit("/dev/usb%1").arg(i++) );
}

View file

@ -0,0 +1,12 @@
$NetBSD: patch-ao,v 1.1 2007/12/31 22:33:43 mwdavies Exp $
--- kcontrol/infocenter/info/config-infocenter.h.cmake.orig 2007-06-27 22:45:19.000000000 +1200
+++ kcontrol/infocenter/info/config-infocenter.h.cmake
@@ -24,3 +24,7 @@
/* Define to 1 if you have the <Alib.h> header file. */
#cmakedefine HAVE_ALIB_H 1
+
+/* Define to 1 if you have statvfs */
+#cmakedefine HAVE_STATVFS 1
+

View file

@ -0,0 +1,28 @@
$NetBSD: patch-ap,v 1.1 2007/12/31 22:33:43 mwdavies Exp $
--- kcontrol/infocenter/info/memory_netbsd.cpp.orig 2007-11-14 12:55:23.000000000 +1300
+++ kcontrol/infocenter/info/memory_netbsd.cpp
@@ -22,7 +22,11 @@ void KMemoryWidget::fetchValues()
int mib[2];
size_t len;
#ifdef UVM
+#if __NetBSD_Version__ > 106000000
+ struct uvmexp_sysctl uvmexp;
+#else
struct uvmexp uvmexp;
+#endif
#else
struct swapent *swaplist;
int64_t nswap, rnswap, totalswap, freeswap, usedswap;
@@ -49,7 +53,11 @@ void KMemoryWidget::fetchValues()
#ifdef UVM
mib[0] = CTL_VM;
+#if __NetBSD_Version__ > 106000000
+ mib[1] = VM_UVMEXP2;
+#else
mib[1] = VM_UVMEXP;
+#endif
len = sizeof(uvmexp);
if ( sysctl(mib, 2, &uvmexp, &len, NULL, 0) < 0 ) {
Memory_Info[FREE_MEM] = NO_MEMORY_INFO;

View file

@ -0,0 +1,275 @@
$NetBSD: patch-aq,v 1.1 2007/12/31 22:33:43 mwdavies Exp $
--- kcontrol/infocenter/info/info_netbsd.cpp.orig 2006-10-26 15:11:57.000000000 +1300
+++ kcontrol/infocenter/info/info_netbsd.cpp
@@ -39,7 +39,7 @@
#include <QFile>
#include <QFontMetrics>
-#include <qstrlist.h>
+#include <Q3StrList>
#include <QTextStream>
#include <kdebug.h>
@@ -52,7 +52,7 @@ typedef struct
const char *title;
} hw_info_mib_list_t;
-bool GetInfo_CPU(QListView *lBox)
+bool GetInfo_CPU(Q3ListView *lBox)
{
static hw_info_mib_list_t hw_info_mib_list[]= {
{ 1, HW_MODEL, "Model" },
@@ -92,7 +92,7 @@ bool GetInfo_CPU(QListView *lBox)
sysctl(mib,2,&num,&len,NULL,0);
value = QString::number(num);
}
- new QListViewItem(lBox, hw_info_mib->title, value);
+ new Q3ListViewItem(lBox, hw_info_mib->title, value);
}
return true;
@@ -100,8 +100,8 @@ bool GetInfo_CPU(QListView *lBox)
// this is used to find out which devices are currently
// on system
-static bool GetDmesgInfo(QListView *lBox, const char *filter,
- void func(QListView *, QString s))
+static bool GetDmesgInfo(Q3ListView *lBox, const char *filter,
+ void func(Q3ListView *, QString s))
{
QFile *dmesg = new QFile("/var/run/dmesg.boot");
bool usepipe = false;
@@ -121,9 +121,8 @@ static bool GetDmesgInfo(QListView *lBox
usepipe = true;
t = new QTextStream(pipe, QIODevice::ReadOnly);
}
-
- QListViewItem *olditem = NULL;
- while(!(s = t->readLine().toLocal8Bit()).isEmpty()) {
+ Q3ListViewItem *olditem = NULL;
+ while(!(s = t->readLine().toLocal8Bit()).isNull()) {
if (!seencpu) {
if (s.contains("cpu"))
seencpu = true;
@@ -134,13 +133,11 @@ static bool GetDmesgInfo(QListView *lBox
s.contains("WARNING: old BSD partition ID!"))
break;
- if (!filter
- || (filter[0] == '^' && s.find(&filter[1]) == 0)
- || (filter[0] != '^' && s.contains(filter))) {
+ if (!filter || s.contains(QRegExp(filter))) {
if (func)
func(lBox, s);
else
- olditem = new QListViewItem(lBox, olditem, s);
+ olditem = new Q3ListViewItem(lBox, olditem, s);
found = true;
}
}
@@ -158,75 +155,74 @@ static bool GetDmesgInfo(QListView *lBox
void
-AddIRQLine(QListView *lBox, QString s)
+AddIRQLine(Q3ListView *lBox, QString s)
{
- int pos, irqnum;
+ int irqnum;
+ QString s2;
char numstr[3];
+ bool ok;
- pos = s.find(" irq ");
- irqnum = (pos < 0) ? 0 : atoi(&s.toAscii()[pos+5]);
- if (irqnum)
+ s2 = s.mid(s.indexOf(QRegExp("[ (]irq "))+5);
+ irqnum = s2.remove(QRegExp("[^0-9].*")).toInt(&ok);
+ if (ok)
snprintf(numstr, 3, "%02d", irqnum);
else {
// this should never happen
strcpy(numstr, "??");
}
- new QListViewItem(lBox, numstr, s);
+ new Q3ListViewItem(lBox, numstr, s);
}
-bool GetInfo_IRQ (QListView *lBox)
+bool GetInfo_IRQ (Q3ListView *lBox)
{
lBox->addColumn(i18n("IRQ"));
lBox->addColumn(i18n("Device"));
lBox->setSorting(0);
lBox->setShowSortIndicator(false);
- (void) GetDmesgInfo(lBox, " irq ", AddIRQLine);
+ (void) GetDmesgInfo(lBox, "[ (]irq ", AddIRQLine);
return true;
}
-bool GetInfo_DMA (QListView *)
+bool GetInfo_DMA (Q3ListView *)
{
return false;
}
-bool GetInfo_PCI (QListView *lbox)
+bool GetInfo_PCI (Q3ListView *lbox)
{
if (!GetDmesgInfo(lbox, "at pci", NULL))
- new QListViewItem(lbox, i18n("No PCI devices found."));
+ new Q3ListViewItem(lbox, i18n("No PCI devices found."));
return true;
}
-bool GetInfo_IO_Ports (QListView *lbox)
+bool GetInfo_IO_Ports (Q3ListView *lbox)
{
if (!GetDmesgInfo(lbox, "port 0x", NULL))
- new QListViewItem(lbox, i18n("No I/O port devices found."));
+ new Q3ListViewItem(lbox, i18n("No I/O port devices found."));
return true;
}
-bool GetInfo_Sound (QListView *lbox)
+bool GetInfo_Sound (Q3ListView *lbox)
{
lbox->setSorting(false);
if (!GetDmesgInfo(lbox, "audio", NULL))
- new QListViewItem(lbox, i18n("No audio devices found."));
+ new Q3ListViewItem(lbox, i18n("No audio devices found."));
// append information for each audio devices found
- QListViewItem *lvitem = lbox->firstChild();
+ Q3ListViewItem *lvitem = lbox->firstChild();
for(; lvitem; lvitem = lvitem->nextSibling()) {
- QString s;
- int pos, len;
- const char *start;
+ QString s, s2;
+ int pos;
char *dev;
s = lvitem->text(0);
// The autoconf message is in form 'audio0 at auvia0: ...'
if (s.find("audio") == 0 && (pos = s.find(" at ")) > 0) {
- pos += 4; // skip " at "
- start = s.toAscii() + pos;
- len = (int) strcspn(start, ":\n\t ");
- dev = (char *) malloc(1 + len + 1);
- sprintf(dev, "^%.*s", len, start); /* safe */
+ s2 = s.mid(pos+4); // skip " at "
+ s2.remove(QRegExp("[:\n\t ].*"));
+ dev = strdup(s2.toAscii().data());
GetDmesgInfo(lbox, dev, NULL);
@@ -237,19 +233,19 @@ bool GetInfo_Sound (QListView *lbox)
return true;
}
-bool GetInfo_Devices (QListView *lBox)
+bool GetInfo_Devices (Q3ListView *lBox)
{
(void) GetDmesgInfo(lBox, NULL, NULL);
return true;
}
-bool GetInfo_SCSI (QListView *lbox)
+bool GetInfo_SCSI (Q3ListView *lbox)
{
if (!GetDmesgInfo(lbox, "scsibus", NULL))
- new QListViewItem(lbox, i18n("No SCSI devices found."));
+ new Q3ListViewItem(lbox, i18n("No SCSI devices found."));
// remove the 'waiting %d seconds for devices to settle' message
- QListViewItem *lvitem = lbox->firstChild();
+ Q3ListViewItem *lvitem = lbox->firstChild();
for(; lvitem; lvitem = lvitem->nextSibling()) {
QString s = lvitem->text(0);
@@ -262,12 +258,14 @@ bool GetInfo_SCSI (QListView *lbox)
return true;
}
-bool GetInfo_Partitions (QListView *lbox)
+bool GetInfo_Partitions (Q3ListView *lbox)
{
int num; // number of mounts
- // FIXME: older pkgsrc patches checked ST_RDONLY for this declaration
- // what is ST_RDONLY and how does it affect getmntinfo?
+#ifdef HAVE_STATVFS
+ struct statvfs *mnt; // mount data pointer
+#else
struct statfs *mnt; // mount data pointer
+#endif
// get mount info
if (!(num=getmntinfo(&mnt, MNT_WAIT))) {
@@ -290,24 +288,31 @@ bool GetInfo_Partitions (QListView *lbox
unsigned long long big[2];
QString vv[5];
+#ifdef HAVE_STATVFS
+ big[0] = big[1] = mnt->f_frsize; // coerce the product
+#else
big[0] = big[1] = mnt->f_bsize; // coerce the product
+#endif
big[0] *= mnt->f_blocks;
big[1] *= mnt->f_bavail; // FIXME: use f_bfree if root?
// convert to strings
vv[0] = KIO::convertSize(big[0]);
- vv[1] = QLatin1String("%1 (%2%%)")
+ vv[1] = QString("%1 (%2%)")
.arg(KIO::convertSize(big[1]))
.arg(mnt->f_blocks ? mnt->f_bavail*100/mnt->f_blocks : 0);
- // FIXME: these two are large enough to punctuate
- vv[2] = QString::number(mnt->f_files);
- vv[3] = QLatin1String("%1 (%2%%) ")
+ vv[2] = QString("%L1").arg(mnt->f_files);
+ vv[3] = QString("%L1 (%2%) ")
.arg(mnt->f_ffree)
.arg(mnt->f_files ? mnt->f_ffree*100/mnt->f_files : 0);
vv[4].clear();
+#ifdef HAVE_STATVFS
+#define MNTF(x) if (mnt->f_flag & ST_##x) vv[4] += QLatin1String(#x " ");
+#else
#define MNTF(x) if (mnt->f_flags & MNT_##x) vv[4] += QLatin1String(#x " ");
+#endif
MNTF(ASYNC)
MNTF(DEFEXPORTED)
MNTF(EXKERB)
@@ -316,7 +321,9 @@ bool GetInfo_Partitions (QListView *lbox
MNTF(EXPORTED)
MNTF(EXPUBLIC)
MNTF(EXRDONLY)
+#ifndef HAVE_STATVFS
MNTF(IGNORE)
+#endif
MNTF(LOCAL)
MNTF(NOATIME)
MNTF(NOCOREDUMP)
@@ -335,7 +342,7 @@ bool GetInfo_Partitions (QListView *lbox
// put it in the table
// FIXME: there're more data but we have limited args (this is wrong! just add!)
- new QListViewItem(lbox,
+ new Q3ListViewItem(lbox,
// FIXME: names need pad space
mnt->f_mntfromname,
mnt->f_mntonname,
@@ -347,7 +354,7 @@ bool GetInfo_Partitions (QListView *lbox
return true;
}
-bool GetInfo_XServer_and_Video (QListView *lBox)
+bool GetInfo_XServer_and_Video (Q3ListView *lBox)
{
return GetInfo_XServer_Generic( lBox );
}

View file

@ -0,0 +1,17 @@
$NetBSD: patch-ar,v 1.1 2007/12/31 22:33:43 mwdavies Exp $
--- kcontrol/CMakeLists.txt.orig 2007-12-31 00:03:01.000000000 +1300
+++ kcontrol/CMakeLists.txt
@@ -39,11 +39,7 @@ add_subdirectory( hardware )
if(X11_Xaccess_FOUND)
add_subdirectory( accessibility )
endif(X11_Xaccess_FOUND)
-if( ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" )
- message(STATUS "TODO: infocenter is disabled on NetBSD, does not compile yet.")
-else( ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" )
- add_subdirectory( infocenter )
-endif( ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" )
+add_subdirectory( infocenter )
add_subdirectory( access )
if(FONTCONFIG_FOUND AND FREETYPE_FOUND)