2 * Copyright (c) 2003 Benjamin Reed <ranger@befunk.com>
4 * info_osx.cpp is part of the KDE program kcminfo. Copied wholesale
5 * from info_fbsd.cpp =)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * all following functions should return true, when the Information
24 * was filled into the lBox-Widget. Returning false indicates that
25 * information was not available.
28 #include <sys/types.h>
29 #include <sys/sysctl.h>
39 #include <QFontMetrics>
41 #include <QTextStream>
45 #include <mach/mach.h>
46 #include <mach-o/arch.h>
49 #include <CoreAudio/CoreAudio.h>
52 #include <machine/limits.h>
54 bool GetInfo_CPU(QListView
*lBox
) {
59 struct host_basic_info basic_info
;
60 unsigned int count
=HOST_BASIC_INFO_COUNT
;
62 ret
=host_info(mach_host_self(), HOST_BASIC_INFO
, (host_info_t
)&basic_info
, &count
);
63 if (ret
!= KERN_SUCCESS
) {
64 kDebug() << "unable to get host information from mach";
67 kDebug() << "got Host Info: (" << basic_info
.avail_cpus
<< ") CPUs available";
68 const NXArchInfo
*archinfo
;
69 archinfo
=NXGetArchInfoFromCpuType(basic_info
.cpu_type
, basic_info
.cpu_subtype
);
70 new QListViewItem(lBox
, i18n("Kernel is configured for %1 CPUs", basic_info
.max_cpus
));
71 for (int i
= 1; i
<= basic_info
.avail_cpus
; i
++) {
72 cpustring
= i18n("CPU %1: %2", i
, archinfo
->description
);
73 new QListViewItem(lBox
, cpustring
);
80 bool GetInfo_IRQ(QListView
*) {
84 bool GetInfo_DMA(QListView
*) {
88 bool GetInfo_PCI(QTreeWidget
*) {
92 bool GetInfo_IO_Ports(QListView
*) {
96 bool GetInfo_Sound(QListView
*lBox
) {
98 #define qMaxStringSize 1024
100 AudioDeviceID gOutputDeviceID
;
101 unsigned long propertySize
;
102 char deviceName
[qMaxStringSize
];
103 char manufacturer
[qMaxStringSize
];
104 propertySize
= sizeof(gOutputDeviceID
);
105 status
= AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice
, &propertySize
, &gOutputDeviceID
);
107 kDebug() << "get default output device failed, status = " << (int)status
;
111 if (gOutputDeviceID
!= kAudioDeviceUnknown
) {
113 propertySize
= qMaxStringSize
;
116 status
= AudioDeviceGetProperty(gOutputDeviceID
, 1, 0, kAudioDevicePropertyDeviceName
, &propertySize
, deviceName
);
118 kDebug() << "get device name failed, status = " << (int)status
;
121 new QListViewItem(lBox
, i18n("Device Name: %1", deviceName
));
124 status
= AudioDeviceGetProperty(gOutputDeviceID
, 1, 0, kAudioDevicePropertyDeviceManufacturer
, &propertySize
, manufacturer
);
126 kDebug() << "get manufacturer failed, status = " << (int)status
;
129 new QListViewItem(lBox
, i18n("Manufacturer: %1", manufacturer
));
139 bool GetInfo_SCSI(QListView
*lbox
) {
143 bool GetInfo_Partitions(QListView
*lbox
) {
147 bool GetInfo_XServer_and_Video(QListView
*lBox
) {
148 return GetInfo_XServer_Generic(lBox
);
151 bool GetInfo_Devices(QListView
*lbox
) {