3 !!!!! this file will be included by info.cpp !!!!!
5 Mostly written 1998-1999 by Helge Deller (deller@gmx.de),
6 with some pieces of code from Aubert Pierre.
9 1999-06-21 added more models to the lookup-table (deller)
10 1999-06-18 added support for 64-Bit HP-UX in CPU-detection(deller)
11 1999-05-04 added audio(alib)-support (deller)
12 1999-04-27 [tested with HP-UX 10.20 (HP9000/715/64-EISA)]
13 added support for nearly all categories
14 (means: not finished!)
15 1998-11-01 first, nearly empty version (deller)
16 with a little source for CPU from Aubert Pierre
20 #include <sys/types.h>
21 #include <sys/param.h>
22 #include <sys/pstat.h>
23 #include <sys/utsname.h>
24 #include <sys/statvfs.h>
29 #include <QFontMetrics>
30 #include <QTextStream>
33 #define INFO_CPU_AVAILABLE
34 # define INFO_CPU_MODEL "/bin/model" // as pipe !!
36 #define INFO_IRQ_AVAILABLE
38 #define INFO_DMA_AVAILABLE
40 #define INFO_PCI_AVAILABLE
41 # define INFO_PCI "" // Please, who know it ????
42 # define INFO_PCI_EISA "/etc/eisa/system.sci" // File !
44 #define INFO_IOPORTS_AVAILABLE
45 # define INFO_IOPORTS_1 "/etc/dmesg" // as pipe !
46 # define INFO_IOPORTS_2 "/usr/sbin/dmesg" // as pipe !
48 #define INFO_SOUND_AVAILABLE
50 #define INFO_DEVICES_AVAILABLE
51 # define INFO_DEVICES "/etc/ioscan" // as pipe !!
53 #define INFO_SCSI_AVAILABLE
55 #define INFO_PARTITIONS_AVAILABLE
56 # define INFO_PARTITIONS_1 FSTAB // = "/etc/fstab" (in fstab.h)
57 # define INFO_PARTITIONS_2 "/etc/checklist"
59 #define INFO_XSERVER_AVAILABLE
63 /* The following table is from an HP-UX 10.20 System
64 build out of the files
65 "/usr/lib/sched.models"
67 "/opt/langtools/lib/sched.models"
68 If you have more entries, then please add them or send them to me!
71 // entries for PA_REVISION[]
74 V_1x1
, V_1x1a
, V_1x1b
, V_1x1c
, V_1x1d
, V_1x1e
,
78 static const char PA_REVISION
[V_LAST
][7]
80 "1.1", "1.1a", "1.1b", "1.1c", "1.1d", "1.1e",
83 // entries for PA_NAME[]
86 PA7100
, PA7100LC
, PA7200
, PA7300
,
87 PA8000
, PA8200
, PA8500
,
90 static const char PA_NAME
[PARISC_PA_LAST
][11]
92 "PA7100", "PA7100LC", "PA7200", "PA7300",
93 "PA8000", "PA8200", "PA8500" };
95 struct _type_LOOKUPTABLE
{
97 unsigned short parisc_rev
; // = enum V_ENTRIES
98 unsigned short parisc_name
; // = enum PA_ENTRIES
102 static const struct _type_LOOKUPTABLE PA_LOOKUPTABLE
[] = {
104 (there seems to exist several different files with same version-number !)*/
105 { "600" ,V_1x0
,PA7000
},
106 { "635" ,V_1x0
,PA7000
},
107 { "645" ,V_1x0
,PA7000
},
108 { "700" ,V_1x1
,PA7000
},
109 { "705" ,V_1x1a
,PA7000
},
110 { "710" ,V_1x1a
,PA7000
},
111 { "712" ,V_1x1c
,PA7100LC
},
112 { "715" ,V_1x1c
,PA7100LC
},
113 { "720" ,V_1x1a
,PA7000
},
114 { "722" ,V_1x1c
,PA7100LC
},
115 { "725" ,V_1x1c
,PA7100LC
},
116 { "728" ,V_1x1d
,PA7200
},
117 { "730" ,V_1x1a
,PA7000
},
118 { "735" ,V_1x1b
,PA7100
},
119 { "742" ,V_1x1b
,PA7100
},
120 { "743" ,V_1x1b
,PA7100
}, // or a 1.1c,PA7100LC !!
121 { "744" ,V_1x1e
,PA7300
},
122 { "745" ,V_1x1b
,PA7100
},
123 { "747" ,V_1x1b
,PA7100
},
124 { "750" ,V_1x1a
,PA7000
},
125 { "755" ,V_1x1b
,PA7100
},
126 { "770" ,V_1x1d
,PA7200
},
127 { "777" ,V_1x1d
,PA7200
},
128 { "778" ,V_1x1e
,PA7300
},
129 { "779" ,V_1x1e
,PA7300
},
130 { "780" ,V_2x0
,PA8000
},
131 { "781" ,V_2x0
,PA8000
},
132 { "782" ,V_2x0
,PA8200
},
133 { "783" ,V_2x0
,PA8500
},
134 { "785" ,V_2x0
,PA8500
},
135 { "800" ,V_1x0
,PA7000
}, // and one with: 2.0 / PA8000
136 { "801" ,V_1x1c
,PA7100LC
},
137 { "802" ,V_2x0
,PA8000
},
138 { "803" ,V_1x1e
,PA7300
},
139 { "804" ,V_2x0
,PA8000
},
140 { "806" ,V_1x1c
,PA7100LC
},
141 { "807" ,V_1x1a
,PA7000
},
142 { "808" ,V_1x0
,PA7000
},
143 { "809" ,V_1x1d
,PA7200
},
144 { "810" ,V_2x0
,PA8000
},
145 { "811" ,V_1x1c
,PA7100LC
},
146 { "813" ,V_1x1e
,PA7300
},
147 { "815" ,V_1x0
,PA7000
},
148 { "816" ,V_1x1c
,PA7100LC
},
149 { "817" ,V_1x1a
,PA7000
},
150 { "819" ,V_1x1d
,PA7200
},
151 { "820" ,V_2x0
,PA8000
},
152 { "821" ,V_1x1d
,PA7200
},
153 { "822" ,V_1x0
,PA7000
},
154 { "825" ,V_1x0
,PA7000
},
155 { "826" ,V_1x1c
,PA7100LC
},
156 { "827" ,V_1x1a
,PA7000
},
157 { "829" ,V_1x1d
,PA7200
},
158 { "831" ,V_1x1d
,PA7200
},
159 { "832" ,V_1x0
,PA7000
},
160 { "834" ,V_1x0
,PA7000
},
161 { "835" ,V_1x0
,PA7000
},
162 { "837" ,V_1x1a
,PA7000
},
163 { "839" ,V_1x1d
,PA7200
},
164 { "840" ,V_1x0
,PA7000
},
165 { "841" ,V_1x1d
,PA7200
},
166 { "842" ,V_1x0
,PA7000
},
167 { "845" ,V_1x0
,PA7000
},
168 { "847" ,V_1x1a
,PA7000
},
169 { "849" ,V_1x1d
,PA7200
},
170 { "850" ,V_1x0
,PA7000
},
171 { "851" ,V_1x1d
,PA7200
},
172 { "852" ,V_1x0
,PA7000
},
173 { "855" ,V_1x0
,PA7000
},
174 { "856" ,V_1x1c
,PA7100LC
},
175 { "857" ,V_1x1a
,PA7000
},
176 { "859" ,V_1x1d
,PA7200
},
177 { "860" ,V_1x0
,PA7000
},
178 { "861" ,V_2x0
,PA8000
},
179 { "865" ,V_1x0
,PA7000
},
180 { "869" ,V_1x1d
,PA7200
},
181 { "870" ,V_1x0
,PA7000
},
182 { "871" ,V_2x0
,PA8000
},
183 { "877" ,V_1x1a
,PA7000
},
184 { "879" ,V_2x0
,PA8000
},
185 { "887" ,V_1x1b
,PA7100
},
186 { "889" ,V_2x0
,PA8000
},
187 { "890" ,V_1x0
,PA7000
},
188 { "891" ,V_1x1b
,PA7100
},
189 { "892" ,V_1x1b
,PA7100
},
190 { "893" ,V_2x0
,PA8000
},
191 { "895" ,V_2x0
,PA8000
},
192 { "896" ,V_2x0
,PA8000
},
193 { "897" ,V_1x1b
,PA7100
},
194 { "898" ,V_2x0
,PA8200
},
195 { "899" ,V_2x0
,PA8200
},
196 { "900" ,V_1x0
,PA7000
},
197 { "B115" ,V_1x1e
,PA7300
},
198 { "B120" ,V_1x1e
,PA7300
},
199 { "B132L" ,V_1x1e
,PA7300
},
200 { "B160L" ,V_1x1e
,PA7300
},
201 { "B180L" ,V_1x1e
,PA7300
},
202 { "C100" ,V_1x1d
,PA7200
},
203 { "C110" ,V_1x1d
,PA7200
},
204 { "C115" ,V_1x1e
,PA7300
},
205 { "C120" ,V_1x1e
,PA7300
},
206 { "C130" ,V_2x0
,PA8000
},
207 { "C140" ,V_2x0
,PA8000
},
208 { "C160L" ,V_1x1e
,PA7300
},
209 { "C160" ,V_2x0
,PA8000
},
210 { "C180L" ,V_1x1e
,PA7300
},
211 { "C180-XP" ,V_2x0
,PA8000
},
212 { "C180" ,V_2x0
,PA8000
},
213 { "C200+" ,V_2x0
,PA8200
},
214 { "C230+" ,V_2x0
,PA8200
},
215 { "C240+" ,V_2x0
,PA8200
},
216 { "CB260" ,V_2x0
,PA8200
},
217 { "D200" ,V_1x1d
,PA7200
}, // or: 1.1c, PA7100LC
218 { "D210" ,V_1x1d
,PA7200
}, // or: 1.1c, PA7100LC
219 { "D220" ,V_1x1e
,PA7300
},
220 { "D230" ,V_1x1e
,PA7300
},
221 { "D250" ,V_1x1d
,PA7200
},
222 { "D260" ,V_1x1d
,PA7200
},
223 { "D270" ,V_2x0
,PA8000
},
224 { "D280" ,V_2x0
,PA8000
},
225 { "D310" ,V_1x1c
,PA7100LC
},
226 { "D320" ,V_1x1e
,PA7300
},
227 { "D330" ,V_1x1e
,PA7300
},
228 { "D350" ,V_1x1d
,PA7200
},
229 { "D360" ,V_1x1d
,PA7200
},
230 { "D370" ,V_2x0
,PA8000
},
231 { "D380" ,V_2x0
,PA8000
},
232 { "D400" ,V_1x1d
,PA7200
},
233 { "D410" ,V_1x1d
,PA7200
},
234 { "D650" ,V_2x0
,PA8000
},
235 { "DX0" ,V_1x1c
,PA7100LC
},
236 { "DX5" ,V_1x1c
,PA7100LC
},
237 { "DXO" ,V_1x1c
,PA7100LC
},
238 { "E25" ,V_1x1c
,PA7100LC
},
239 { "E35" ,V_1x1c
,PA7100LC
},
240 { "E45" ,V_1x1c
,PA7100LC
},
241 { "E55" ,V_1x1c
,PA7100LC
},
242 { "F10" ,V_1x1a
,PA7000
},
243 { "F20" ,V_1x1a
,PA7000
},
244 { "F30" ,V_1x1a
,PA7000
},
245 { "G30" ,V_1x1a
,PA7000
},
246 { "G40" ,V_1x1a
,PA7000
},
247 { "G50" ,V_1x1b
,PA7100
},
248 { "G60" ,V_1x1b
,PA7100
},
249 { "G70" ,V_1x1b
,PA7100
},
250 { "H20" ,V_1x1a
,PA7000
},
251 { "H30" ,V_1x1a
,PA7000
},
252 { "H40" ,V_1x1a
,PA7000
},
253 { "H50" ,V_1x1b
,PA7100
},
254 { "H60" ,V_1x1b
,PA7100
},
255 { "H70" ,V_1x1b
,PA7100
},
256 { "I30" ,V_1x1a
,PA7000
},
257 { "I40" ,V_1x1a
,PA7000
},
258 { "I50" ,V_1x1b
,PA7100
},
259 { "I60" ,V_1x1b
,PA7100
},
260 { "I70" ,V_1x1b
,PA7100
},
261 { "J200" ,V_1x1d
,PA7200
},
262 { "J210XC" ,V_1x1d
,PA7200
},
263 { "J210" ,V_1x1d
,PA7200
},
264 { "J220" ,V_2x0
,PA8000
},
265 { "J2240" ,V_2x0
,PA8200
},
266 { "J280" ,V_2x0
,PA8000
},
267 { "J282" ,V_2x0
,PA8000
},
268 { "J400" ,V_2x0
,PA8000
},
269 { "J410" ,V_2x0
,PA8000
},
270 { "K100" ,V_1x1d
,PA7200
},
271 { "K200" ,V_1x1d
,PA7200
},
272 { "K210" ,V_1x1d
,PA7200
},
273 { "K230" ,V_1x1d
,PA7200
},
274 { "K250" ,V_2x0
,PA8000
},
275 { "K260" ,V_2x0
,PA8000
},
276 { "K370" ,V_2x0
,PA8200
},
277 { "K380" ,V_2x0
,PA8200
},
278 { "K400" ,V_1x1d
,PA7200
},
279 { "K410" ,V_1x1d
,PA7200
},
280 { "K420" ,V_1x1d
,PA7200
},
281 { "K430" ,V_1x1d
,PA7200
},
282 { "K450" ,V_2x0
,PA8000
},
283 { "K460" ,V_2x0
,PA8000
},
284 { "K470" ,V_2x0
,PA8200
},
285 { "K570" ,V_2x0
,PA8200
},
286 { "K580" ,V_2x0
,PA8200
},
287 { "S700i" ,V_1x1e
,PA7300
},
288 { "S715" ,V_1x1e
,PA7300
},
289 { "S744" ,V_1x1e
,PA7300
},
290 { "S760" ,V_1x1e
,PA7300
},
291 { "T500" ,V_1x1c
,PA7100LC
}, // or: 1.1b, PA7100
292 { "T520" ,V_1x1b
,PA7100
},
293 { "T540" ,V_2x0
,PA8000
},
294 { "T600" ,V_2x0
,PA8000
},
295 { "V2000" ,V_2x0
,PA8000
},
296 { "V2200" ,V_2x0
,PA8200
},
297 { "V2250" ,V_2x0
,PA8200
},
298 { "V2500" ,V_2x0
,PA8500
},
300 { "" ,0 ,0 } /* Last Entry has to be empty. */
305 /* Helper-Functions */
307 // Value() is defined in info.cpp !!!
309 static bool Find_in_LOOKUPTABLE( QListView
*lBox
, char *machine
)
312 const struct _type_LOOKUPTABLE
*Entry
= PA_LOOKUPTABLE
;
314 QListViewItem
* olditem
= 0;
317 Machine
= machine
; // machine is like: "9000/715/D"
318 while ((*Machine
) && (*Machine
!='/'))
326 len
= strlen(Machine
);
328 while (Entry
->Name
[0])
329 { if (strncmp(Entry
->Name
,Machine
,len
)==0)
331 olditem
= new QListViewItem(lBox
, olditem
, i18n("PA-RISC Processor"),
332 QString(PA_NAME
[Entry
->parisc_name
]));
333 olditem
= new QListViewItem(lBox
, olditem
, i18n("PA-RISC Revision"),
334 QString("PA-RISC ") + QString(PA_REVISION
[Entry
->parisc_rev
]));
338 ++Entry
; // next Entry !
345 /* all following functions should return true, when the Information
346 was filled into the lBox-Widget.
347 returning false indicates, that information was not available.
351 bool GetInfo_CPU( QListView
*lBox
)
356 struct pst_dynamic psd
;
357 struct pst_static pst
;
358 struct pst_processor pro
;
361 QListViewItem
* olditem
= 0;
364 if((pstat_getstatic(&pst
, sizeof(pst
), (size_t)1, 0) == -1) ||
365 (pstat_getdynamic(&psd
, sizeof(psd
), (size_t)1, 0)== -1)) {
366 *GetInfo_ErrorString
= i18n("Could not get Information."); /* Error */
371 lBox
->addColumn(i18n("Information") );
372 lBox
->addColumn(i18n("Value") );
376 olditem
= new QListViewItem(lBox
, olditem
, i18n("Machine"), info
.machine
);
378 model
= new QFile(INFO_CPU_MODEL
);
380 { if ((pipe
= popen(INFO_CPU_MODEL
, "r")))
381 { QTextStream
*t
= new QTextStream(pipe
, QIODevice::ReadOnly
);
383 olditem
= new QListViewItem(lBox
, olditem
, i18n("Model"), str
);
390 olditem
= new QListViewItem(lBox
, olditem
, i18n("Machine Identification Number"),
391 strlen(info
.__idnumber
) ? QString(info
.__idnumber
) : i18n("(none)") );
393 if (psd
.psd_proc_cnt
<=0)
394 psd
.psd_proc_cnt
=1; // Minimum one CPU !
396 olditem
= new QListViewItem(lBox
, olditem
, i18n("Number of Active Processors"),
397 Value(psd
.psd_proc_cnt
));
399 pstat_getprocessor( &pro
, sizeof(pro
), 1, 0 );
400 olditem
= new QListViewItem(lBox
, olditem
, i18n("CPU Clock"),
401 Value(pro
.psp_iticksperclktick
/10000) + ' ' + i18n("MHz"));
403 switch(sysconf(_SC_CPU_VERSION
))
404 { case CPU_HP_MC68020
: str2
= "Motorola 68020"; break;
405 case CPU_HP_MC68030
: str2
= "Motorola 68030"; break;
406 case CPU_HP_MC68040
: str2
= "Motorola 68040"; break;
407 case CPU_PA_RISC1_0
: str2
= "PA-RISC 1.0"; break;
408 case CPU_PA_RISC1_1
: str2
= "PA-RISC 1.1"; break;
409 case CPU_PA_RISC1_2
: str2
= "PA-RISC 1.2"; break;
411 #if defined(_SC_KERNEL_BITS)
412 switch (sysconf(_SC_KERNEL_BITS
)) {
413 case 64: str2
= "PA-RISC 2.0w (64 bit)"; break;
414 case 32: str2
= "PA-RISC 2.0n (32 bit)"; break;
415 default: str2
= "PA-RISC 2.0"; break;
417 #else /* !defined(_SC_KERNEL_BITS) */
418 str2
= "PA-RISC 2.0"; break;
420 default: str2
= i18n("(unknown)"); break;
423 olditem
= new QListViewItem(lBox
, olditem
, i18n("CPU Architecture"), str2
);
425 Find_in_LOOKUPTABLE( lBox
, info
.machine
);// try to get extended Information.
427 for (i
=PS_PA83_FPU
; i
<=PS_PA89_FPU
; ++i
) {
428 if ((1<<(i
-1)) & pro
.psp_coprocessor
.psc_present
) {
429 str
= QString( (i
==PS_PA83_FPU
) ? "PS_PA83_FPU":"PS_PA89_FPU" )
431 + QString(((1<<(i
-1))&pro
.psp_coprocessor
.psc_enabled
) ?
432 i18n("enabled") : i18n("disabled") )
435 olditem
= new QListViewItem(lBox
, olditem
, i18n("Numerical Coprocessor (FPU)"), str
);
437 }// for(coprocessor..)
439 str
= Value(((pst
.physical_memory
*pst
.page_size
)/1024/1024))
441 + i18n("MB"); // Mega-Byte
442 olditem
= new QListViewItem(lBox
, olditem
, i18n("Total Physical Memory"), str
);
444 str
= Value(pst
.page_size
) + QString(" ") + i18n("Bytes");
445 olditem
= new QListViewItem(lBox
, olditem
, i18n("Size of One Page"), str
);
450 bool GetInfo_ReadfromFile( QListView
*lBox
, const char *Name
)
454 QFile
*file
= new QFile(Name
);
455 QListViewItem
* olditem
= 0;
457 if(!file
->open(QIODevice::ReadOnly
)) {
462 while (file
->readLine(buf
,sizeof(buf
)-1) >= 0)
464 olditem
= new QListViewItem(lBox
, olditem
, QString::fromLocal8Bit(buf
));
469 return (lBox
->childCount());
473 bool GetInfo_IRQ( QListView
* )
478 bool GetInfo_DMA( QListView
* )
483 bool GetInfo_PCI( QListView
*lBox
)
485 return( GetInfo_ReadfromFile(lBox
,INFO_PCI
) +
486 GetInfo_ReadfromFile(lBox
,INFO_PCI_EISA
) );
489 bool GetInfo_IO_Ports( QListView
*lBox
)
491 if (GetInfo_ReadfromPipe( lBox
, INFO_IOPORTS_1
, false ))
494 return GetInfo_ReadfromPipe( lBox
, INFO_IOPORTS_2
, false );
498 bool GetInfo_Devices( QListView
*lBox
)
500 return GetInfo_ReadfromPipe( lBox
, INFO_DEVICES
, false );
503 bool GetInfo_SCSI( QListView
*lBox
)
505 return GetInfo_Devices( lBox
);
507 /* Parts taken from fsusage.c from the Midnight Commander (mc)
509 Copyright (C) 1991, 1992 Free Software Foundation, In
511 Return the number of TOSIZE-byte blocks used by
512 BLOCKS FROMSIZE-byte blocks, rounding away from zero.
513 TOSIZE must be positive. Return -1 if FROMSIZE is not positive. */
515 static long fs_adjust_blocks(long blocks
, int fromsize
, int tosize
)
522 if (fromsize
== tosize
) /* E.g., from 512 to 512. */
524 else if (fromsize
> tosize
) /* E.g., from 2048 to 512. */
525 return blocks
* (fromsize
/ tosize
);
526 else /* E.g., from 256 to 512. */
527 return (blocks
+ (blocks
< 0 ? -1 : 1)) / (tosize
/ fromsize
);
530 /* Fill in the fields of FSP with information about space usage for
531 the filesystem on which PATH resides.
532 Return 0 if successful, -1 if not. */
534 #define CONVERT_BLOCKS(b) fs_adjust_blocks ((b), fsd.f_bsize, 512)
536 static int get_fs_usage (char *path
, long *l_total
, long *l_avail
)
537 { struct statfs fsd
; /* 4.3BSD, SunOS 4, HP-UX, AIX. */
538 unsigned long fsu_blocks
,fsu_bfree
,fsu_bavail
;
540 *l_total
= *l_avail
= 0;
541 if (statfs (path
, &fsd
) < 0)
544 fsu_blocks
= CONVERT_BLOCKS (fsd
.f_blocks
);
545 fsu_bfree
= CONVERT_BLOCKS (fsd
.f_bfree
);
546 fsu_bavail
= CONVERT_BLOCKS (fsd
.f_bavail
);
548 *l_avail
= getuid () ? fsu_bavail
/2 : fsu_bfree
/2;
549 *l_total
= fsu_blocks
/2;
555 // Some Ideas taken from garbazo from his source in info_fbsd.cpp
557 bool GetInfo_Partitions (QListView
*lbox
)
560 QString Title
[NUMCOLS
];
563 struct fstab
*fstab_ent
;
567 QString
MB(i18n("MB")+ " "); // International Text for MB=Mega-Byte
569 if (setfsent() != 1) // Try to open fstab
572 Title
[0] = i18n("Device");
573 Title
[1] = i18n("Mount Point");
574 Title
[2] = i18n("FS Type");
575 Title
[3] = i18n("Total Size");
576 Title
[4] = i18n("Free Size");
578 for (n
=0; n
<NUMCOLS
; ++n
) {
579 lbox
->addColumn(Title
[n
] );
582 while ((fstab_ent
=getfsent())!=NULL
) {
583 /* fstab_ent->fs_type holds only "rw","xx","ro"... */
584 memset(&svfs
,0,sizeof(svfs
));
585 statvfs(fstab_ent
->fs_file
,&svfs
);
586 get_fs_usage(fstab_ent
->fs_file
, &total
, &avail
);
588 if (!strcmp(fstab_ent
->fs_type
,FSTAB_XX
)) // valid drive ?
589 svfs
.f_basetype
[0] = 0;
591 if(svfs
.f_basetype
[0]) {
592 new QListViewItem(lbox
, QString(fstab_ent
->fs_spec
),
593 QString(fstab_ent
->fs_file
) + QString(" "),
594 (svfs
.f_basetype
[0] ? QString(svfs
.f_basetype
) : i18n("n/a")),
595 Value((total
+512)/1024,6) + MB
,
596 Value((avail
+512)/1024,6) + MB
);
599 new QListViewItem(lbox
, QString(fstab_ent
->fs_spec
),
600 QString(fstab_ent
->fs_file
) + QString(" "),
601 (svfs
.f_basetype
[0] ? QString(svfs
.f_basetype
) : i18n("n/a")));
611 bool GetInfo_XServer_and_Video( QListView
*lBox
)
614 return GetInfo_XServer_Generic( lBox
);
623 bool GetInfo_Sound( QListView
*lBox
)
625 *GetInfo_ErrorString
= i18n("Audio-Support (Alib) was disabled during configuration and compile-time.");
629 #else // defined(HAVE_ALIB_H)
633 static const char formatNames
[6][15] = {
634 "ADFUnknown", "ADFMuLaw", "ADFALaw",
635 "ADFLin16", "ADFLin8", "ADFLin8Offset" };
637 /* handle typo in 1st release of Alib.h */
638 #ifndef ARightOutputChMask
639 #define ARightOutputChMask ARighOutputChMask
643 bool GetInfo_Sound( QListView
*lBox
)
651 QListViewItem
* olditem
= 0;
653 // server = Hostname....
655 audio
= AOpenAudio( server
, &status
);
657 *GetInfo_ErrorString
= i18n("Unable to open Audio-Server (Alib).");
661 lBox
->addColumn(i18n("Information") );
662 lBox
->addColumn(i18n("Value") );
664 olditem
= new QListViewItem(lBox
, olditem
, i18n("Audio Name"), QString(audio
->audio_name
));
665 olditem
= new QListViewItem(lBox
, olditem
, i18n("Vendor"), QString(audio
->vendor
));
666 olditem
= new QListViewItem(lBox
, olditem
, i18n("Alib Version"),
667 Value(audio
->alib_major_version
) + QString(".") +
668 Value(audio
->alib_minor_version
));
670 olditem
= new QListViewItem(lBox
, olditem
, i18n("Protocol Revision"),
671 Value(audio
->proto_major_version
) + QString(".") +
672 Value(audio
->proto_minor_version
));
674 olditem
= new QListViewItem(lBox
, olditem
, i18n("Vendor Number"),
675 Value(audio
->vnumber
));
677 olditem
= new QListViewItem(lBox
, olditem
, i18n("Release"),
678 Value(audio
->release
));
680 olditem
= new QListViewItem(lBox
, olditem
, i18n("Byte Order"),
681 QString((audio
->byte_order
==ALSBFirst
)? i18n("ALSBFirst (LSB)"):
682 ((audio
->byte_order
==AMSBFirst
)? i18n("AMSBFirst (MSB)"):
683 i18n("Invalid Byteorder.")) ));
685 olditem
= new QListViewItem(lBox
, olditem
, i18n("Bit Order"),
686 QString((audio
->sound_bit_order
==ALeastSignificant
)?
687 i18n("ALeastSignificant (LSB)") :
688 ((audio
->sound_bit_order
==AMostSignificant
) ?
689 i18n("AMostSignificant (MSB)"):i18n("Invalid Bitorder.")) ));
691 olditem
= new QListViewItem(lBox
, olditem
, i18n("Data Formats"));
692 for ( i
= 0; i
< audio
->n_data_format
; i
++ ) {
693 if (audio
->data_format_list
[i
] <= ADFLin8Offset
)
694 new QListViewItem(olditem
, QString(formatNames
[audio
->data_format_list
[i
]]));
696 olditem
->setOpen(true);
698 olditem
= new QListViewItem(lBox
, olditem
, i18n("Sampling Rates"));
699 for ( i
= 0; i
< audio
->n_sampling_rate
; i
++ ) {
700 new QListViewItem(olditem
, Value(audio
->sampling_rate_list
[i
]));
702 olditem
->setOpen(true);
704 olditem
= new QListViewItem(lBox
, olditem
, i18n("Input Sources"));
705 if ( audio
->input_sources
& AMonoMicrophoneMask
)
706 new QListViewItem(olditem
, i18n("Mono-Microphone"));
707 if ( audio
->input_sources
& AMonoAuxiliaryMask
)
708 new QListViewItem(olditem
, i18n("Mono-Auxiliary"));
709 if ( audio
->input_sources
& ALeftMicrophoneMask
)
710 new QListViewItem(olditem
, i18n("Left-Microphone"));
711 if ( audio
->input_sources
& ARightMicrophoneMask
)
712 new QListViewItem(olditem
, i18n("Right-Microphone"));
713 if ( audio
->input_sources
& ALeftAuxiliaryMask
)
714 new QListViewItem(olditem
, i18n("Left-Auxiliary"));
715 if ( audio
->input_sources
& ARightAuxiliaryMask
)
716 new QListViewItem(olditem
, i18n("Right-Auxiliary"));
717 olditem
->setOpen(true);
719 olditem
= new QListViewItem(lBox
, olditem
,i18n("Input Channels"));
720 if ( audio
->input_channels
& AMonoInputChMask
)
721 new QListViewItem(olditem
, i18n("Mono-Channel"));
722 if ( audio
->input_channels
& ALeftInputChMask
)
723 new QListViewItem(olditem
, i18n("Left-Channel"));
724 if ( audio
->input_channels
& ARightInputChMask
)
725 new QListViewItem(olditem
, i18n("Right-Channel"));
726 olditem
->setOpen(true);
728 olditem
= new QListViewItem(lBox
, olditem
, i18n("Output Destinations"));
729 if ( audio
->output_destinations
& AMonoIntSpeakerMask
)
730 new QListViewItem(olditem
, i18n("Mono-InternalSpeaker"));
731 if ( audio
->output_destinations
& AMonoJackMask
)
732 new QListViewItem(olditem
, i18n("Mono-Jack"));
733 if ( audio
->output_destinations
& ALeftIntSpeakerMask
)
734 new QListViewItem(olditem
, i18n("Left-InternalSpeaker"));
735 if ( audio
->output_destinations
& ARightIntSpeakerMask
)
736 new QListViewItem(olditem
, i18n("Right-InternalSpeaker"));
737 if ( audio
->output_destinations
& ALeftJackMask
)
738 new QListViewItem(olditem
, i18n("Left-Jack"));
739 if ( audio
->output_destinations
& ARightJackMask
)
740 new QListViewItem(olditem
, i18n("Right-Jack"));
741 olditem
->setOpen(true);
743 olditem
= new QListViewItem(lBox
, olditem
, i18n("Output Channels"));
744 if ( audio
->output_channels
& AMonoOutputChMask
)
745 new QListViewItem(olditem
, i18n("Mono-Channel"));
746 if ( audio
->output_channels
& ALeftOutputChMask
)
747 new QListViewItem(olditem
, i18n("Left-Channel"));
748 if ( audio
->output_channels
& ARightOutputChMask
)
749 new QListViewItem(olditem
, i18n("Right-Channel"));
750 olditem
->setOpen(true);
753 olditem
= new QListViewItem(lBox
, olditem
, i18n("Gain"));
754 new QListViewItem(olditem
, i18n("Input Gain Limits"),
755 Value(audio
->max_input_gain
));
756 new QListViewItem(olditem
,i18n("Output Gain Limits"),
757 Value(audio
->min_output_gain
) + QString(" ")
758 + Value(audio
->max_output_gain
));
759 new QListViewItem(olditem
, i18n("Monitor Gain Limits"),
760 Value(audio
->min_monitor_gain
) + QString(" ")
761 + Value(audio
->max_monitor_gain
));
762 new QListViewItem(olditem
, i18n("Gain Restricted"),
763 Value(audio
->gm_gain_restricted
));
764 olditem
->setOpen(true);
767 olditem
= new QListViewItem(lBox
, olditem
,i18n("Lock"),
769 olditem
= new QListViewItem(lBox
, olditem
, i18n("Queue Length"),
771 olditem
= new QListViewItem(lBox
, olditem
, i18n("Block Size"),
772 Value(audio
->block_size
));
773 olditem
= new QListViewItem(lBox
, olditem
, i18n("Stream Port (decimal)"),
774 Value(audio
->stream_port
));
775 olditem
= new QListViewItem(lBox
, olditem
, i18n("Ev Buffer Size"),
776 Value(audio
->ev_buf_size
));
777 olditem
= new QListViewItem(lBox
, olditem
, i18n("Ext Number"),
778 Value(audio
->ext_number
));
780 ACloseAudio( audio
, &status
);
785 #endif // defined(HAVE_ALIB_H)