2
* $Id: info_osx.cpp,v 1.2 2003/06/29 20:16:54 reed Exp $
4
* Copyright (c) 2003 Benjamin Reed <ranger@befunk.com>
6
* info_osx.cpp is part of the KDE program kcminfo. Copied wholesale
7
* from info_fbsd.cpp =)
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
#define INFO_CPU_AVAILABLE
25
//#define INFO_IRQ_AVAILABLE
26
//#define INFO_DMA_AVAILABLE
27
//#define INFO_PCI_AVAILABLE
28
//#define INFO_IOPORTS_AVAILABLE
29
#define INFO_SOUND_AVAILABLE
30
#define INFO_DEVICES_AVAILABLE
31
#define INFO_SCSI_AVAILABLE
32
#define INFO_PARTITIONS_AVAILABLE
33
#define INFO_XSERVER_AVAILABLE
36
* all following functions should return TRUE, when the Information
37
* was filled into the lBox-Widget. Returning FALSE indicates that
38
* information was not available.
41
#include <sys/types.h>
42
#include <sys/sysctl.h>
52
#include <qfontmetrics.h>
55
#include <qtextstream.h>
59
#include <mach/mach.h>
60
#include <mach-o/arch.h>
63
#include <CoreAudio/CoreAudio.h>
66
#include <machine/limits.h>
68
bool GetInfo_CPU (QListView *lBox)
74
struct host_basic_info basic_info;
75
unsigned int count=HOST_BASIC_INFO_COUNT;
77
ret=host_info(mach_host_self(), HOST_BASIC_INFO,
78
(host_info_t)&basic_info, &count);
79
if (ret != KERN_SUCCESS) {
80
kdDebug() << "unable to get host information from mach" << endl;
83
kdDebug() << "got Host Info: (" << basic_info.avail_cpus << ") CPUs available" << endl;
84
const NXArchInfo *archinfo;
85
archinfo=NXGetArchInfoFromCpuType(basic_info.cpu_type, basic_info.cpu_subtype);
86
new QListViewItem(lBox, i18n("Kernel is configured for %1 CPUs").arg(basic_info.max_cpus));
87
for (int i = 1; i <= basic_info.avail_cpus; i++) {
88
cpustring = i18n("CPU %1: %2").arg(i).arg(archinfo->description);
89
new QListViewItem(lBox, cpustring);
96
bool GetInfo_IRQ (QListView *)
101
bool GetInfo_DMA (QListView *)
106
bool GetInfo_PCI (QListView *)
111
bool GetInfo_IO_Ports (QListView *)
116
bool GetInfo_Sound (QListView *lBox)
118
#ifdef HAVE_COREAUDIO
119
#define kMaxStringSize 1024
121
AudioDeviceID gOutputDeviceID;
122
unsigned long propertySize;
123
char deviceName[kMaxStringSize];
124
char manufacturer[kMaxStringSize];
125
propertySize = sizeof(gOutputDeviceID);
126
status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &propertySize, &gOutputDeviceID);
128
kdDebug() << "get default output device failed, status = " << (int)status << endl;
132
if (gOutputDeviceID != kAudioDeviceUnknown) {
134
propertySize = kMaxStringSize;
137
status = AudioDeviceGetProperty(gOutputDeviceID, 1, 0, kAudioDevicePropertyDeviceName, &propertySize, deviceName);
139
kdDebug() << "get device name failed, status = " << (int)status << endl;
142
new QListViewItem(lBox, i18n("Device Name: %1").arg(deviceName));
145
status = AudioDeviceGetProperty(gOutputDeviceID, 1, 0, kAudioDevicePropertyDeviceManufacturer, &propertySize, manufacturer);
147
kdDebug() << "get manufacturer failed, status = " << (int)status << endl;
150
new QListViewItem(lBox, i18n("Manufacturer: %1").arg(manufacturer));
160
bool GetInfo_SCSI (QListView *lbox)
165
bool GetInfo_Partitions (QListView *lbox)
170
bool GetInfo_XServer_and_Video (QListView *lBox)
172
return GetInfo_XServer_Generic( lBox );
175
bool GetInfo_Devices (QListView *lbox)