1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
/*
* Copyright (c) 2003 Benjamin Reed <ranger@befunk.com>
*
* info_osx.cpp is part of the KDE program kcminfo. Copied wholesale
* from info_fbsd.cpp =)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#define INFO_CPU_AVAILABLE
//#define INFO_IRQ_AVAILABLE
//#define INFO_DMA_AVAILABLE
//#define INFO_PCI_AVAILABLE
//#define INFO_IOPORTS_AVAILABLE
#define INFO_SOUND_AVAILABLE
#define INFO_DEVICES_AVAILABLE
#define INFO_SCSI_AVAILABLE
#define INFO_PARTITIONS_AVAILABLE
#define INFO_XSERVER_AVAILABLE
/*
* all following functions should return TRUE, when the Information
* was filled into the lBox-Widget. Returning FALSE indicates that
* information was not available.
*/
#include <sys/types.h>
#include <sys/sysctl.h>
#include <fstab.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <tqdict.h>
#include <tqfile.h>
#include <tqfontmetrics.h>
#include <tqptrlist.h>
#include <tqstring.h>
#include <tqtextstream.h>
#include <kdebug.h>
#include <mach/mach.h>
#include <mach-o/arch.h>
#ifdef HAVE_COREAUDIO
#include <CoreAudio/CoreAudio.h>
#endif
#include <machine/limits.h>
bool GetInfo_CPU (TQListView *lBox)
{
TQString cpustring;
kern_return_t ret;
struct host_basic_info basic_info;
unsigned int count=HOST_BASIC_INFO_COUNT;
ret=host_info(mach_host_self(), HOST_BASIC_INFO,
(host_info_t)&basic_info, &count);
if (ret != KERN_SUCCESS) {
kdDebug() << "unable to get host information from mach" << endl;
return false;
} else {
kdDebug() << "got Host Info: (" << basic_info.avail_cpus << ") CPUs available" << endl;
const NXArchInfo *archinfo;
archinfo=NXGetArchInfoFromCpuType(basic_info.cpu_type, basic_info.cpu_subtype);
new TQListViewItem(lBox, i18n("Kernel is configured for %1 CPUs").arg(basic_info.max_cpus));
for (int i = 1; i <= basic_info.avail_cpus; i++) {
cpustring = i18n("CPU %1: %2").arg(i).arg(archinfo->description);
new TQListViewItem(lBox, cpustring);
}
return true;
}
return false;
}
bool GetInfo_IRQ (TQListView *)
{
return false;
}
bool GetInfo_DMA (TQListView *)
{
return false;
}
bool GetInfo_PCI (TQListView *)
{
return false;
}
bool GetInfo_IO_Ports (TQListView *)
{
return false;
}
bool GetInfo_Sound (TQListView *lBox)
{
#ifdef HAVE_COREAUDIO
#define kMaxStringSize 1024
OStqStatus status;
AudioDeviceID gOutputDeviceID;
unsigned long propertySize;
char deviceName[kMaxStringSize];
char manufacturer[kMaxStringSize];
propertySize = sizeof(gOutputDeviceID);
status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &propertySize, &gOutputDeviceID);
if (status) {
kdDebug() << "get default output device failed, status = " << (int)status << endl;
return false;
}
if (gOutputDeviceID != kAudioDeviceUnknown) {
propertySize = kMaxStringSize;
/* Device Name */
status = AudioDeviceGetProperty(gOutputDeviceID, 1, 0, kAudioDevicePropertyDeviceName, &propertySize, deviceName);
if (status) {
kdDebug() << "get device name failed, status = " << (int)status << endl;
return false;
}
new TQListViewItem(lBox, i18n("Device Name: %1").arg(deviceName));
/* Manufacturer */
status = AudioDeviceGetProperty(gOutputDeviceID, 1, 0, kAudioDevicePropertyDeviceManufacturer, &propertySize, manufacturer);
if (status) {
kdDebug() << "get manufacturer failed, status = " << (int)status << endl;
return false;
}
new TQListViewItem(lBox, i18n("Manufacturer: %1").arg(manufacturer));
return true;
} else {
return false;
}
#else
return false;
#endif
}
bool GetInfo_SCSI (TQListView *lbox)
{
return false;
}
bool GetInfo_Partitions (TQListView *lbox)
{
return false;
}
bool GetInfo_XServer_and_Video (TQListView *lBox)
{
return GetInfo_XServer_Generic( lBox );
}
bool GetInfo_Devices (TQListView *lbox)
{
return false;
}
|