File: guide.xml

package info (click to toggle)
discover 2.1.2-10.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,756 kB
  • sloc: sh: 7,862; ansic: 7,280; xml: 1,809; makefile: 679
file content (1669 lines) | stat: -rw-r--r-- 73,453 bytes parent folder | download | duplicates (9)
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
<?xml version="1.0" standalone="no"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBk XML V4.1.2//EN"
        "/usr/share/sgml/docbook/dtd/xml/4.1.2/docbookx.dtd"
[
<!ENTITY % progeny-entity SYSTEM "../doctools/progeny.ent">
%progeny-entity;

<!ENTITY % config-entity SYSTEM "../doctools/config.ent">
%config-entity;

<!ENTITY % package-entity SYSTEM "../package.ent">
%package-entity;

<!ENTITY discover-1 SYSTEM "discover.refentry">
<!ENTITY discover-conf-5 SYSTEM "discover.conf.refentry">
<!ENTITY discover-modprobe-8 SYSTEM "discover-modprobe.refentry">
<!ENTITY discover-modprobe-conf-5 SYSTEM "discover-modprobe.conf.refentry">
]
>

<!--
Copyright 2002 Progeny Linux Systems, Inc.
Copyright 2002 Hewlett-Packard Company

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-->

<!---

id attribute naming convention for this document

All preface, part, chapter, section, appendix, figure, and example elements
should have id attributes.  The id should start with an abbreviation of the
parent element as follows:

appendix  ap
chapter   ch
example   ex
figure    fg
part      pt
preface   pr
section   sc

The remainder of the id attribute value should duplicate the actual content
of the title, downcased and with spaces transliterated to underscores
("_").  It is acceptable to drop articles and abbreviate very long titles.  It
may be necessary to make the id attribute value communicate the hierarchy of
one or parent element ids to prevent collisions.

Example:

<section id="sc-vendor_element">
  <title id="sc-vendor_element-title">The <sgmltag>vendor</sgmltag> element</title>

  [...]

  <section id="sc-vendor_element_id_attribute">
    <title id="sc-vendor_element_name_attribute-title">The <sgmltag>name</sgmltag> attribute</title>

Furthermore, all of the elements listed above should contain a title element,
which itself possesses an id attribute named identically to the parent
element's id, but with "-title" suffixed.

Example:

<example id="ex-naming_convention">
  <title id="ex-naming_convention-title">Naming Convention</title>
</example>

We do not use the endterm attribute of link or xref elements because of
problems they cause with formatted output when using DSSSL backends.  Talk
to jdaily or branden about this issue.

-->

<book>
  <bookinfo>
    <releaseinfo>$Progeny$</releaseinfo>

    <authorgroup>
      &author.branden;
      &author.jdaily;
    </authorgroup>

    <title>The &discover; Hardware Detection System</title>
    <titleabbrev>Discover</titleabbrev>

    <copyright>
      <year>2002</year> <holder>Progeny Linux Systems, Inc.</holder>
    </copyright>
    <copyright>
      <year>2002</year> <holder>Hewlett-Packard Company</holder>
    </copyright>
    &license.mit;
    <legalnotice>
      <para>Linux is a registered trademark of Linus Torvalds.</para>
    </legalnotice>
  </bookinfo>

  <preface id="pr-what_is_discover">
    <title id="pr-what_is_discover-title">What Is &discover;?</title>

    <para>&discover; is a tool that reports information about a
    system's hardware.  It uses operating system-dependent modules
    (selected at build time) to detect what hardware is actually on the
    system and provides system-independent interfaces for querying &xml; data
    sources about this hardware.  These data sources contain specific
    information required to enable support for various devices via defined
    software interfaces.  The tool can be accessed by linking to the
    &discover; library or by calling <link
    linkend="ch-discover_manpage"><command>discover</command></link> (which
    itself links to the &discover; library) and parsing its output.  In the
    future, other interfaces (for example, modules for interpreted
    languages such as Perl and Python) may be included.</para>

    <para>Why use &discover;?  There are at least a few reasons:</para>

    <itemizedlist>
      <listitem>
        <para><emphasis>Flexibility.</emphasis> &discover; is designed
        from the ground up to be flexible.  It is portable to a variety
        of operating environments, and its modular design supports the
        addition
        of arbitrary methods for querying the host operating system (OS)
        about installed devices.  &discover; is also designed to be
        flexible in terms of the types of data that can be retrieved.
        &discover; does not tie the user to retrieving only one type of
        information, such as the name of the Linux kernel module that
        should be loaded to support a given device.  Instead, &discover;
        supports the association of arbitrary data with hardware devices,
        typically through specification of an interface to the hardware in
        question, such as a Linux kernel module or an XFree86 server driver
        module.</para>
      </listitem>
      <listitem>
        <para><emphasis>Updatability.</emphasis> Many
        hardware-autodetection programs suffer from an inherent
        limitation in that they are restricted to reading hardware
        lists or databases that are stored on the local filesystem.
        This is not an efficient approach in the fast-moving world of
        consumer computer hardware, with new devices constantly being
        introduced.  A couple of months after the latest version of
        your OS of choice is released, it may fail to recognize that
        the latest revision of, for instance, a video chipset is
        compatible with an older one, and can use the same software
        interfaces.  &discover; overcomes this problem by supporting the
        retrieval of hardware information via &http;<footnote><para>Other
        protocols such as &ftp; are available but deprecated; &discover;
        uses integrity verification mechanisms such as
        <acronym>MD5</acronym> checksums in the &http;
        protocol.</para></footnote> (<quote>over the web</quote>).  When
        &http; access is impossible, &discover; falls back to
        locally stored hardware lists.</para>
      </listitem>
      <listitem>
        <para><emphasis>Portability.</emphasis> On top of its
        flexibility in terms of system interfaces to hardware, &discover;
        has been written to be broadly portable to all of
        today's popular POSIX-compliant systems.  &discover; is not a
        Linux-only solution.  &discover; is intended to provide operating
        system vendors, computer manufacturers, and third-party vendors of
        software and peripherals with a powerful tool for describing the
        hardware they support to the interfaces they care about.  Because
        &discover;'s data sources can be anywhere on the Internet, the OS
        vendor need not be the sole provider of hardware catalogs.</para>
      </listitem>
      <listitem>
        <para><emphasis>Usability.</emphasis> &discover; is not an in-house
        tool designed to solve a narrow class of problems.  &discover; is
        designed to be easy to use from the perspectives of the individual
        system administrator, the applications programmer, and the hardware
        manufacturer or support staff.  &discover;'s &xml; database
        structure, its command-line tools, and its library &api; are
        well documented and support extensions to meet diverse
        demands.</para>
      </listitem>
      <listitem>
        <para><emphasis>Freely licensed.</emphasis> &discover; has a
        copyright license that is highly adaptable to the needs of the
        varied audiences to which &discover; is targeted.  Under the
        so-called
        <quote>UCB/BSD</quote> or <quote>MIT/X Consortium</quote> terms,
        after the names of American universities and some very well known
        software projects that used these terms, anyone is free to copy,
        modify, and distribute the software, and to extend (or not) these
        same freedoms to those who receive the software.  Progeny
        would like to see &discover; adopted by a wide variety of existing
        software products, such the various GNU/Linux distributions; the
        FreeBSD, NetBSD, and OpenBSD projects; the GNU Project of the Free
        Software Foundation; the XFree86 Project; system integrators; and
        the designers and manufacturers of computer hardware.
        We believe that &discover;'s design empowers those with the
        greatest knowledge of hardware and the software interfaces to that
        hardware to express
        that knowledge and make it available to the world, thereby
        ameliorating an entire class of computer configuration problems.
        Progeny does not want &discover;'s licensing to stand in the way of
        realizing that dream, which is why we have chosen these license
        terms.</para>
      </listitem>
    </itemizedlist>

    <para>We must take a moment to explain what &discover; is
    <emphasis>not</emphasis>: &discover; is not a replacement for the
    service &mdash; usually provided by the underlying operating system
    kernel or a user-space program that interfaces with it &mdash; of
    simply translating bus-specific vendor and model identifiers to
    human-readable names.  &discover; performs its own translations of
    this data as a convenience for generating human-readable reports, but
    it does not attempt to enumerate all hardware devices that exist for a
    particular bus architecture.  Rather, &discover; is intended only to
    catalog data for which there is some useful information to impart
    regarding software interfaces.  Facilities already exist in modern
    operating systems for answering the questions <quote>What is the name
    of this device?</quote> and <quote>Who manufactured it?</quote>
    &discover;'s role is to answer questions like <quote>What Linux kernel
    module do I need to load for this device to work?</quote>  More
    importantly, &discover; will enable you to provide answers in the
    future to questions you don't even expect to ask today.</para>

    <para>&discover; is not intended to be a comprehensive
    hardware-management tool.  It is an
    <emphasis>enabling technology</emphasis>,
    designed to provide data that a tool layered above it can use.  Two
    applications are provided with &discover; to demonstrate how the
    library can be leveraged: the command-line utility &discover-command;,
    and a Linux kernel module loading script,
    <command>discover-modprobe</command>, designed to be invoked at system
    boot time.</para>

    <para>This manual is divided into four parts.  First, we examine the
    &discover; &xml; data file format, exploring the elements and
    attributes used to describe hardware and various interfaces to it. This
    part will enable you to read and understand a &discover; &xml; file.  
    Next, we offer some recommendations for writing your own &discover;
    &xml; data. Knowing the syntax is valuable, but knowing how best to
    take advantage of it is even more useful.  We then present the
    reference pages describing Progeny's &discover;-based command-line
    tools and the configuration files used to control their behavior. You
    may want to use these references as a guide when implementing your own
    &discover;-based applications.  The final part describes the &discover;
    library &api; so that you can develop your own solutions based on
    &discover;.  Appendices offer references to the formal descriptions of
    the &discover; &api; and &xml; &dtd;s.</para>

  </preface>

  <part id="pt-data_structure">
    <title id="pt-data_structure-title">Data Structure</title>

    <chapter id="ch-overview_discover_data_format">
      <title id="ch-overview_discover_data_format-title">Overview of
      the &discover; Data Format</title>
      <para>Most modern computer peripherals contain self-identifying
      information in a format standardized for the hardware interface
      (bus).  This enables the OS on the host system
      to query or scan a bus and catalog the devices.  In general, the OS
      stores this information in the same basic format in which it is
      returned, without translating it more times than necessary for
      device drivers to communicate with the peripheral.  However, this
      information varies by bus type and is often insufficiently clear for
      human consumption. Furthermore, many operating systems do not contain
      a comprehensive database that maps each peripheral to every subsystem
      running on the OS that may want to communicate with that peripheral.
      &discover; addresses these issues by providing flexible databases
      stored in &xml; format.</para>

      <para>Extensible Markup Language (&xml;) is a highly flexible
      hypertext format. &discover; uses &xml; exclusively to store hardware
      information externally.  Some familiarity with &xml; syntax is
      therefore assumed. For more information,
      see <ulink url="http://www.w3.org/XML/">the
      W3C's &xml; website</ulink>.</para>

      <para>For a formal description of &discover;'s &xml; data format, see
      the &discover; <link linkend="ap-discover_dtd">Document Type
      Definition (&dtd;)</link> document.  The purpose of this document is
      to present the information in a form digestible by the novice.</para>

      <para>Because each hardware bus type, such as &pci; or &usb;,
      communicates different details about the connected devices
      (essentially, each one solves the same problem in a different way),
      &discover; has a different set of lists for each bus type.  For each
      bus, up to three lists are stored: a bus class list
      maps the bus specification's notion of a device type (hereinafter
      referred to as a <quote>device class</quote> to reduce confusion) to
      &discover;'s device types, which are used for running selective
      queries; a vendor list associates bus-specific vendor identification
      data with natural-language names for hardware vendors; and a device
      list contains information specific to individual devices.</para>

    </chapter>

    <chapter id="ch-master_list">
      <title id="ch-master_list-title">Master List</title>

      <para>When &discover; is provided with a &url; for the retrieval of
      hardware information, the data retrieved is expected to be in
      &xml; format and to contain further &url;s for retrieval.</para>

      <para>The root element must be <sgmltag
        class="element">discover-data</sgmltag>, which has no attributes,
        and can only contain <sgmltag class="element">location</sgmltag>
        elements.</para>

      <para>The <sgmltag class="element">location</sgmltag> element is
      always empty, and has three required attributes: <sgmltag
      class="attribute">bus</sgmltag>, <sgmltag
      class="attribute">type</sgmltag>, and <sgmltag
      class="attribute">url</sgmltag>.</para>

      <variablelist>
        <title><sgmltag class="element">location</sgmltag>
        Attributes</title>
        <varlistentry>
          <term><sgmltag class="attribute">type</sgmltag></term>
          <listitem>
            <para>This attribute can have one of these values: <sgmltag
            class="attvalue">busclass</sgmltag>, <sgmltag
            class="attvalue">device</sgmltag>, or <sgmltag
            class="attvalue">vendor</sgmltag>. See <xref
            linkend="ch-busclass_lists"/>, <xref
            linkend="ch-vendor_lists"/>, and <xref
            linkend="ch-device_lists"/>.</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term><sgmltag class="attribute">url</sgmltag></term>
          <listitem>
            <para>This must be a valid &url; containing one of the three
              types of data lists.</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term><sgmltag class="attribute">bus</sgmltag></term>
          <listitem>
            <para>This is the bus to which the &url; applies.  See <xref
            linkend="sc-busclass_element_name_attribute"/> for a list of
            valid bus names.</para>
          </listitem>
        </varlistentry>

      </variablelist>

    </chapter>

    <chapter id="ch-busclass_lists">
      <title id="ch-busclass_lists-title">Busclass Lists</title>
      <para>As noted in the previous chapter, a busclass list provides a
      mapping between device classes recognized by the hardware bus and the
      device type names used by &discover;.  Because every bus is
      different, sometimes there is no perfect, one-to-one correspondence
      between &discover; device types and the device classes recognized by
      a particular bus.  This is one reason that the busclass lists, like
      other types of &discover; data lists, are updatable.
      Revisions in a bus specification may demand updates to the
      mapping.</para>

      <para>The device classes recognized by a bus are typically determined
      by the specification for the bus as determined by a standards
      committee or other technical body, and do not change frequently (if
      at all).</para>

      <example id="ex-busclass_list">
        <title id="ex-busclass_list-title">The
        <sgmltag>busclass_list</sgmltag> element</title>
        <programlisting><![CDATA[<?xml version="1.0"?>

<busclass_list bus="usb">
  <busclass id="0202" name="modem"/>
  <busclass id="1030" name="broadband"/>
  <busclass id="0101" name="printer"/>
  <busclass id="ffff" name="imaging"/>
  <busclass id="0206" name="network"/>
  <busclass id="0300" name="humaninput"/>
  <busclass id="ff00" name="video"/>
  <busclass id="0000" name="unknown"/>
  <busclass id="0804" name="removabledisk"/>
</busclass_list>]]></programlisting>
      </example>

      <para>In the foregoing example, we can see one possible mapping of
      the &usb; bus's numeric device class IDs to &discover;'s device type
      names (see <xref linkend="sc-busclass_element_name_attribute"/>).
      The file begins by declaring the version of the &xml; standard to
      which it conforms, and then presents data.  The format should be
      fairly familiar to those accustomed to &html;-style structured markup
      languages.</para>

      <para>Not all of &discover;'s supported device types are listed in
      the example; for example, <literal>display</literal> is missing.
      This is not a problem, since not all buses are used for all hardware
      applications.  &usb; 1.1 would be a poor choice of bus for
      &vga;-compatible display controllers, for instance, because the
      available bandwidth on the &usb; 1.1 bus is insufficient to handle
      typical data loads for such devices.</para>

      <para>Another infelicity in the above example is the association of
      the <literal>ffff</literal> device class ID with the &discover; 
      device type <literal>imaging</literal>.  In actuality, a device type 
      class of <literal>ffff</literal> in the &usb; specification indicates 
      a device of an unknown classification.  In practice, most
      consumer-level devices with this device class are scanners, one of 
      the first applications of &usb; technology in the consumer 
      marketplace.  It is
      possible that in certain deployments, the association of &usb;'s
      unknown device class ID with &discover;'s <literal>imaging</literal>
      device type is suboptimal &mdash; another reason the busclass lists
      are not hard-coded into the library.</para>

      <section id="sc-busclass_list_element">
        <title id="sc-busclass_list_element-title">The
        <sgmltag>busclass_list</sgmltag> element</title>

        <para>A <sgmltag>busclass_list</sgmltag> element possesses a
        <sgmltag>bus</sgmltag> attribute and contains one or more
        <sgmltag>busclass</sgmltag> elements.</para>

        <section id="sc-busclass_list_element_bus_attribute">
          <title id="sc-busclass_list_element_bus_attribute-title">The
          <sgmltag>bus</sgmltag> attribute</title>

          <para>The <sgmltag>bus</sgmltag> attribute of the
          <sgmltag>busclass_list</sgmltag> element is set to the name of
          the bus being described by the busclass list.</para>

          <para>The <sgmltag class="attribute">bus</sgmltag> attribute
          presently supports the following values:</para>

          &bus-classes;

          <para>We expect to support more buses in the future;
          <literal>ieee1394</literal> and <literal>sbus</literal> are
          possible candidates.</para>

        </section>
      </section>

      <section id="sc-busclass_element">
        <title id="sc-busclass_element-title">The
        <sgmltag>busclass</sgmltag> element</title>

        <para>A <sgmltag>busclass</sgmltag> element possesses two
        attributes, <sgmltag>id</sgmltag> and <sgmltag>name</sgmltag>, and
        contains no elements.</para>

        <section id="sc-busclass_element_id_attribute">
          <title id="sc-busclass_element_id_attribute-title">The
          <sgmltag>id</sgmltag> attribute</title>

          <para>The <sgmltag>id</sgmltag> attribute is set to a bus-specific
          device class identifier.</para>
        </section>

        <section id="sc-busclass_element_name_attribute">
          <title id="sc-busclass_element_name_attribute-title">The
          <sgmltag>name</sgmltag> attribute</title>

          <para>The <sgmltag>name</sgmltag> attribute is set to a
          &discover; device type.  &discover;'s device types are an effort
          to balance a few criteria:</para>

          <itemizedlist>
            <listitem>
              <para>Device types (<quote>bus classes</quote> in &discover;
              terminology) defined by the &pci; specification</para>
            </listitem>
            <listitem>
              <para>Bus classes defined by the &usb; specification</para>
            </listitem>
            <listitem>
              <para>Bus classes defined by the &scsi; specification</para>
            </listitem>
            <listitem>
              <para>Device types commonly conceived of by the personal
              computer user</para>
            </listitem>
          </itemizedlist>

          <para>&discover;'s definitions of device types will not meet with
          universal agreement; as happens in most categorization problems,
          some decisions had to be made arbitrarily.  &discover; does not
          attempt to solve the general problem of grouping various
          peripherals into categories; rather, &discover; solves the
          problem for itself and uses bus-specific mappings to translate a
          device's own notion of its type to &discover;'s device
          type.</para>

          &device-types;
        </section>
      </section>

    </chapter>

    <chapter id="ch-vendor_lists">
      <title id="ch-vendor_lists-title">Vendor Lists</title>
      <para>Many buses have vendor identification numbers
      that are registered with that bus's standardization body and
      programmed into the devices when they are manufactured.  These
      numbers generally are assigned arbitrarily, and typically have little
      meaning to the end user; therefore, most hardware detection tools
      provide a way to translate these numeric vendor IDs to human-readable
      strings.  Thus, instead of knowing that your &pci; or &agp; video card
      was manufactured by <quote>1002,</quote> you can determine that it
      was manufactured by <quote>ATI Technologies, Inc.</quote></para>

      <example id="ex-vendor_list">
        <title id="ex-vendor_list-title">The <sgmltag>vendor_list</sgmltag>
        element</title>
        <programlisting><![CDATA[<?xml version="1.0"?>

<vendor_list bus="pci">
  <vendor id="0675" name="Dynalink"/>
  <vendor id="0e11" name="Compaq Computer Corporation"/>
  <vendor id="1004" name="VLSI Technology Inc"/>
  <vendor id="1025" name="Acer Incorporated [ALI]"/>
  <vendor id="102b" name="Matrox Graphics, Inc."/>
  <vendor id="109e" name="Brooktree Corporation"/>
</vendor_list>]]></programlisting>
      </example>

      <para>The foregoing example is similar in structure to the <link
      linkend="ex-busclass_list">busclass list example</link>; a numeric
      vendor ID maps to a vendor name, which can be used by &discover; for
      queries or reports generated for the user's benefit.</para>

      <section id="sc-vendor_list_element">
        <title id="sc-vendor_list_element-title">The
        <sgmltag>vendor_list</sgmltag> element</title>

        <para>A <sgmltag>vendor_list</sgmltag> element possesses a
        <sgmltag>bus</sgmltag> attribute and contains one or more
        <sgmltag>vendor</sgmltag> elements.</para>

        <section id="sc-vendor_list_element_bus_attribute">
          <title id="sc-vendor_list_element_bus_attribute-title">The
          <sgmltag>bus</sgmltag> attribute</title>

          <para>The <sgmltag>bus</sgmltag> attribute of the
          <sgmltag>vendor_list</sgmltag> element is set to the name of
          the bus being described by the vendor list.</para>

          <para>The following bus attributes are supported:</para>

          &bus-classes;
        </section>
      </section>

      <section id="sc-vendor_element">
        <title id="sc-vendor_element-title">The <sgmltag>vendor</sgmltag> element</title>

        <para>A <sgmltag>vendor</sgmltag> element possesses two
        attributes, <sgmltag>id</sgmltag> and <sgmltag>name</sgmltag>, and
        contains no elements.</para>

        <section id="sc-vendor_element_id_attribute">
          <title id="sc-vendor_element_id_attribute-title">The <sgmltag>id</sgmltag> attribute</title>

          <para>The <sgmltag>id</sgmltag> attribute is set to a bus-specific
          vendor identifier.</para>
        </section>

        <section id="sc-vendor_element_name_attribute">
          <title id="sc-vendor_element_name_attribute-title">The <sgmltag>name</sgmltag> attribute</title>

          <para>The <sgmltag>name</sgmltag> attribute is set to a
          human-readable vendor identifier, typically the official name of
          the corporation or other business entity that designed or
          manufactured that peripheral.</para>
        </section>
      </section>

    </chapter>

    <chapter id="ch-device_lists">
      <title id="ch-device_lists-title">Device Lists</title>
      <para>The device lists are the heart of &discover;'s functionality.
      They are the most frequently updated lists and contain the
      information of greatest value.</para>

      <para>&discover;'s device lists not only provide a way to identify
      individual peripherals by name, but also permit the specification of
      an arbitrary quantity of organized data for each device, supporting
      an arbitrary number of software interfaces.</para>

      <note>
        <para>The following is a fictitious example.  The information
        within it is for illustrative purposes only.  See <xref
        linkend="pt-data_content"/> for a discussion of the
        <quote>real</quote> hardware data as provided by Progeny, and for
        some suggested conventions on organizing the data namespace.</para>
      </note>

      <example id="ex-sample_device_data">
        <title id="ex-sample_device_data-title">Sample device data</title>
        <programlisting><![CDATA[<?xml version="1.0"?>

<device_list bus="pci">
  <device busclass="1984" model="0101" model_name="Cerebral Reprogrammer" vendor="B16B">
    <data class="linux">
      <data class="module">
        <data class="name">winston</data>
        <data class="options">base_address=0x300 manual_override=0</data>
      </data>
    </data>
    <data class="win2k">
      <data class="hal_driver">
        <data class="StrUglyHungarianNotatedDriverName">settlement</data>
        <data class="flags">NSA_KEY=96b5f3e3283a62c85f6cb6f4017135c2</data>
      </data>
    </data>
  </device>
</device_list>]]></programlisting>
      </example>

      <para>The example above includes a <sgmltag>device_list</sgmltag>
      element containing <sgmltag>device</sgmltag> elements, and a
      <sgmltag>device</sgmltag> element that defines the device itself,
      but reserves any software- or interface-specific details to the
      <sgmltag>data</sgmltag> elements it contains.</para>

      <para>The actual data provided in the example is accessed by means of
      data paths; see <xref linkend="sc-accessing_device_data"/> for 
      further information.</para>

      <section id="sc-device_list_element">
        <title id="sc-device_list_element-title">The
        <sgmltag>device_list</sgmltag> element</title>

        <para>A <sgmltag>device_list</sgmltag> element possesses a
        <sgmltag>bus</sgmltag> attribute and contains one or more
        <sgmltag>device</sgmltag> elements.</para>

        <section id="sc-device_list_element_bus_attribute">
          <title id="sc-device_list_element_bus_attribute-title">The
          <sgmltag>bus</sgmltag> attribute</title>

          <para>The <sgmltag>bus</sgmltag> attribute of the
          <sgmltag>device_list</sgmltag> element is set to the name of
          the bus described by the device list.</para>

          <para>The following bus attributes are supported:</para>

          &bus-classes;
        </section>
      </section>

      <section id="sc-device_element">
        <title id="sc-device_element-title">The <sgmltag>device</sgmltag> element</title>

        <para>A <sgmltag>device</sgmltag> element possesses four attributes:</para>

        <itemizedlist>
          <listitem>
            <para><sgmltag>busclass</sgmltag></para>
          </listitem>
          <listitem>
            <para><sgmltag>vendor</sgmltag></para>
          </listitem>
          <listitem>
            <para><sgmltag>model</sgmltag></para>
          </listitem>
          <listitem>
            <para><sgmltag>model_name</sgmltag></para>
          </listitem>
        </itemizedlist>

        <para>All of these attributes must be specified for each
        <sgmltag>device</sgmltag> element.  The <sgmltag>busclass</sgmltag>
        attribute is set to a <link
        linkend="sc-busclass_element_id_attribute">busclass
        identifier</link>, <sgmltag>vendor</sgmltag> to a <link
        linkend="sc-vendor_element_id_attribute">vendor
        identifier</link>, <sgmltag>model</sgmltag> to a bus-specific
        model identifier, and <sgmltag>model_name</sgmltag> to a
        human-readable vendor identifier, typically the name of the product
        under which the device reporting the <sgmltag>model</sgmltag>
        identifier is sold or otherwise distributed.</para>

        <para>A <sgmltag>device</sgmltag> element contains zero or more
        <sgmltag>data</sgmltag> elements.</para>

      </section>

      <section id="sc-data_element">
        <title id="sc-data_element-title">The <sgmltag>data</sgmltag> element</title>

        <para>A <sgmltag>data</sgmltag> element possesses a mandatory
        <sgmltag>class</sgmltag> attribute, an optional
        <sgmltag>version</sgmltag> attribute, and zero or more
        <sgmltag>data</sgmltag> elements.</para>

        <para>The ability to nest <sgmltag>data</sgmltag> elements inside
        other <sgmltag>data</sgmltag> elements affords interface designers
        and device driver authors the ability to specify a hierarchy of
        data, instead of being compelled to encapsulate only one piece of
        data per device for their interface.</para>

        <section id="sc-data_element_class_attribute">
          <title id="sc-data_element_class_attribute-title">The <sgmltag>class</sgmltag> attribute</title>

          <para>A <sgmltag>class</sgmltag> attribute is set to an arbitrary
          value determined by an interface designer.  For
          <sgmltag>data</sgmltag> elements whose parent element is a
          <sgmltag>device</sgmltag> element, this should be the name of
          the interface being described, such as
          <literal>freebsd</literal>, <literal>linux</literal>, or
          <literal>xfree86</literal>.</para>

          <para>A <sgmltag>data</sgmltag> element whose parent element is a
          <sgmltag>data</sgmltag> element should set this attribute to a
          term reflecting the interface designer's intended data hierarchy.
          &discover; does not mandate any particular hierarchy for
          interface designers.</para>
        </section>

        <section id="sc-data_element_version_attribute">
          <title id="sc-data_element_version_attribute-title">The <sgmltag>version</sgmltag> attribute</title>

          <para>Data elements have an optional attribute named <sgmltag
          class="attribute">version</sgmltag>.  This indicates a version
          <emphasis>range</emphasis> applicable to the data contained
          within the element.  The purpose of this attribute is to permit
          the specification of data that is valid only for a range of
          versions of the given interface.  For example, the Linux kernel
          changed some of the names of its modules between the 2.2 and 2.4
          series.</para>

          <para>&discover;'s range syntax, common in mathematical writings,
          is expressed as an interval; that is, it consists of a pair of
          endpoints with a comma between them, and brackets or parentheses
          as qualifiers for inclusion or exclusion of the endpoints' exact
          values.  For example, the version specification <literal>[1.0,
          2.0)</literal> matches any version less than 2.0 and greater
          than or equal to 1.0.  It is the responsibility of the calling
          environment to specify the version of the interface actually in
          use.  In other words, the &discover; library does not take it
          upon itself to determine the currently running version of the
          Linux kernel, XFree86 X server, CUPS printing daemon, and so
          forth.</para>

          <para>Due to the lack of consistent standards for version numbers
          (in fact, some version numbers aren't numbers at all),
          &discover; requires simplifications for the <sgmltag
          class="attribute">version</sgmltag> attribute.  The versions that
          express the range must be in dotted-decimal form, such as
          <literal>7.1.0</literal>.  The version that is supplied to the
          &discover; library as part of a query (for example, via the
          <option>--data-version</option> argument to &discover-command;)
          may or may not comply with this requirement, but should
          be expressed such that it compares in a desirable way against
          version strings that do.</para>

          <para>In place of the upper end of the range,
          <literal>inf</literal> (infinity) can be used if the information
          is still relevant and should be for forseeable versions.</para>

        </section>

      </section>

      <section id="sc-accessing_device_data">
        <title id="sc-accessing_device_data-title">Accessing the Device
        Data</title>

        <para>&discover; data is grouped into hierarchical <sgmltag
        class="element">data</sgmltag> elements.  This data can be accessed
        via its data path.  The data path is the concatenation of the class
        attribute values of a <sgmltag class="element">data</sgmltag>
        element and all its parents, separated by slash
        (<literal>/</literal>) characters.  In the following example,
        <literal>quux</literal> is accessed via the data path
        <quote>foo/bar</quote>:</para>

        <informalexample>
          <programlisting><![CDATA[<data class="foo">
  <data class="bar">quux</data>
</data>]]></programlisting>
        </informalexample>

        <para>In <xref linkend="ex-sample_device_data"/> above, we would
        determine the name of the Linux kernel module
        (<quote>winston</quote>) for the <quote>Cerebral
        Reprogrammer</quote> device by referencing the data path
        <literal>linux/module/name</literal>; similarly, the data path
        <literal>win2k/hal_driver/flags</literal> returns
        <literal>NSA_KEY=96b5f3e3283a62c85f6cb6f4017135c2</literal>.</para>

      </section>

    </chapter>
  </part>

  <part id="pt-data_content">
    <title id="pt-data_content-title">Recommended Data Content Conventions</title>

    <partintro>
      <para>As discussed in the <link
      linkend="pr-what_is_discover">preface</link>, &discover; is not
      intended to be a replacement for system utilities such as
      <command>lspci</command> on Linux.  A
      <sgmltag class="element">device</sgmltag> element should exist
      for a piece of hardware only if there is some interface information
      to communicate about the hardware; that is, some 
      <sgmltag class="element">data</sgmltag> elements to house within the
      <sgmltag class="element">device</sgmltag> element. This part of the
      manual contains Progeny's recommendations on how to organize that
      information for maximum utility.</para>
    </partintro>

    <chapter id="ch-data_hierarchy">
      <title id="ch-data_hierarchy-title">Data Hierarchy</title>

      <para>As discussed in <xref linkend="sc-accessing_device_data"/>, the
      &xml; structure around the data allows for a hierarchical
      view.</para>

      <para>While &discover; does not mandate any particular hierarchy or
      namespace organization for <sgmltag class="element">data</sgmltag>
      elements, the &xml; files provided by Progeny express &mdash; and
      some applications based on &discover; (such as
      <command>discover-modprobe</command>) expect &mdash; a certain
      structure for Linux kernel module and XFree86 configuration
      information.</para>

      <para>At Progeny, we have often found it convenient to refer to a
      top-level <sgmltag class="element">data</sgmltag> element's <sgmltag
      class="attribute">class</sgmltag> attribute value as an
      <quote>interface</quote> (see the following example).</para>

      <example id="ex-defining_an_interface">
        <title id="ex-defining_an_interface-title">Defining an interface</title>
        <programlisting><![CDATA[<device busclass="0300" vendor="de8d" model="90a9" model_name="Stingray">
  <data class="xfree86">
    <data class="server" version="[3, 4)">
      <data class="name">XF86_SVGA</data>
    </data>
  </data>
  <data class="openbsd">
    <data class="security_level">untrusted</data>
  </data>
</device>]]></programlisting>
      </example>

      <para>In <xref linkend="ex-defining_an_interface"/>, two interfaces
      have been defined for the <quote>Stingray</quote> device:
      <literal>xfree86</literal> and <literal>openbsd</literal>.</para>

      <section id="sc-linux_kernel_modules">
        <title id="sc-linux_kernel_modules-title">Linux Kernel Modules</title>

        <para>A hardware device that requires a particular Linux kernel
        module should have nested <sgmltag class="element">data</sgmltag>
        elements to describe that module.  The top-level <sgmltag
        class="element">data</sgmltag> element should have a <sgmltag
        class="attribute">class</sgmltag> attribute with a value of
        <sgmltag class="attvalue">linux</sgmltag>.  Underneath that should
        be a <sgmltag class="element">data</sgmltag> element with a
        <sgmltag class="attribute">class</sgmltag> of <sgmltag
        class="attvalue">module</sgmltag>.</para>

        <para>Within that <sgmltag class="element">data</sgmltag> element,
        there should be one or two more, one with a <sgmltag
        class="attribute">class</sgmltag> of <sgmltag
        class="attvalue">name</sgmltag>, and an optional one with a
        <sgmltag class="attribute">class</sgmltag> of <sgmltag
        class="attvalue">options</sgmltag>.  The former has as content the
        name of the module; the latter, options to be passed to
        <command>modprobe</command>.</para>

        <figure id="fg-linux_interface">
          <title id="fg-linux_interface-title">Linux interface</title>
          <screen><![CDATA[/linux
    |
    |-/module
          |
          |-/name
          |
          |-/options]]></screen>
        </figure>

        <para>In <xref linkend="fg-linux_interface"/>, each component of
        the tree represents a <sgmltag class="element">data</sgmltag>
        element; the label is the value of its <sgmltag
        class="attribute">class</sgmltag> attribute.</para>

        <para>If the kernel version affects the choice of module name or
        options, the top-level <sgmltag class="attvalue">linux</sgmltag>
        <sgmltag class="element">data</sgmltag> element should have a
        version range attribute; see <xref
        linkend="sc-data_element_version_attribute"/>.</para>

        <example id="ex-using_linux_interface">
          <title id="ex-using_linux_interface-title">Using the <sgmltag class="attvalue">linux</sgmltag> interface</title>
          <programlisting><![CDATA[<device busclass="0204" model="1702" model_name="IS64PH ISDN Adapter" vendor="0675">
  <data class="linux">
    <data class="module">
       <data class="name">hisax</data>
       <data class="options">io=0x300 irq=11</data>
    </data>
  </data>
</device>]]></programlisting>
        </example>

        <para>See <xref 
        linkend="ex-using_version_attribute_of_data_element"/> for guidance
        on how to specify different Linux kernel modules for the same
        device, depending on the version of the Linux kernel in use.</para>

      </section>

      <section id="sc-xfree86_x_servers">
        <title id="sc-xfree86_x_servers-title">XFree86 X Servers</title>

        <para>The data hierarchy of a video card device (&discover;'s
        <literal>display</literal> type) should include a top-level
        <sgmltag class="element">data</sgmltag> element with a <sgmltag
        class="attribute">class</sgmltag> attribute of <sgmltag
        class="attvalue">xfree86</sgmltag> (the interface)
        and likely with a <sgmltag class="attribute">version</sgmltag>
        attribute as well; nested within that element will be a <sgmltag
        class="attvalue">server</sgmltag> <sgmltag
        class="element">data</sgmltag> element containing a <sgmltag
        class="attvalue">name</sgmltag> <sgmltag
        class="element">data</sgmltag> element identifying the name of the
        server executable.  For XFree86 version 4.0 or greater, the
        <sgmltag class="attvalue">name</sgmltag> will always be <sgmltag
        class="attvalue">XFree86</sgmltag>, and the <sgmltag
        class="attvalue">server</sgmltag> <sgmltag
        class="element">data</sgmltag> element will also contain a <sgmltag
        class="attvalue">device</sgmltag> <sgmltag
        class="element">data</sgmltag> element, which contains one or more
        <sgmltag class="element">data</sgmltag> elements communicating
        information to be stored in the <filename>XF86Config</filename>
        file.  The children of the <sgmltag
        class="attvalue">device</sgmltag> <sgmltag
        class="element">data</sgmltag> element are named in correspondence
        with the syntax of the <filename>XF86Config</filename> file's
        <literal>Device</literal> section; see the <ulink
        url="http://www.xfree86.org/current/XF86Config.5.html">XF86Config
        manual page</ulink> for further information.  In particular, note
        that in many cases only a
        <sgmltag class="attvalue">driver</sgmltag> <sgmltag
        class="element">data</sgmltag> element is necessary.</para>

        <figure id="fg-xfree86_interface">
          <title id="fg-xfree86_interface-title">XFree86 interface</title>
          <screen><![CDATA[/xfree86
    |
    |-/server
          |
          |-/name
          |
          |-/device
                |
                |-/driver
                |
                |-/chipid
                |
                |-/chipset
                |
                |-/ramdac
                |
                |-/dacspeed
                |
                |-/videoram
                |
                |-/options
                |
                |-...]]></screen>
        </figure>

        <para><xref linkend="fg-xfree86_interface"/> illustrates the
        <sgmltag class="attvalue">xfree86</sgmltag>
        interface.  <xref linkend="ex-using_xfree86_interface"/> shows
        how you might write <sgmltag class="attvalue">xfree86</sgmltag>
        interface information for a &discover; <sgmltag
        class="attvalue">display</sgmltag> device.</para>

        <example id="ex-using_xfree86_interface">
          <title id="ex-using_xfree86_interface-title">Using the <sgmltag class="attvalue">xfree86</sgmltag> interface</title>
          <programlisting><![CDATA[<device busclass="0300" vendor="1002" model="4654" model_name="Mach64 VT [264VT FT]">
  <data class="xfree86">
    <data class="server" version="[4, inf)">
      <data class="name">XFree86</data>
      <data class="device">
        <data class="driver">ati</data>
      </data>
    </data>
    <data class="server" version="(0, 4)">
      <data class="name">XF86_Mach64</data>
    </data>
  </data>
</device>]]></programlisting>
        </example>
      </section>

      <section id="sc-locally-defined_interfaces">
        <title id="sc-locally-defined_interfaces-title">Locally-Defined Interfaces</title>

          <para>Progeny recommends that publicly distributed &discover;
          &xml; files avoid using the interface name
          <literal>local</literal>; that is, a
          <sgmltag class="attribute">class</sgmltag> attribute value of
          <literal>local</literal> in a top-level
          <sgmltag class="element">data</sgmltag> element.  This
          means that data paths such as <literal>local/foo/bar</literal>
          should not be defined in a public &discover; &xml; file, but
          both <literal>foo/bar/local</literal> and
          <literal>foo/local/bar</literal> are okay.</para>

          <para>The intention is to reserve this part of the namespace
          for users' experiments with defining their own &mdash;
          and possibly future, widely adopted &mdash; interface definitions
          for &discover; data.  An interface definition could thus be
          <quote>beta tested</quote> by a person or organization to ensure
          that it is efficiently structured before it is unleashed upon the
          world elsewhere in the namespace, where people may write tools
          that expect to be able to resolve the interface definition's data
          paths.</para>

          <para>Likewise, Progeny recommends that authors of applications
          that use &discover; avoid traversing into a top-level
          <literal>local</literal> <sgmltag class="element">data</sgmltag>
          element, which may impose an undesirable support burden on
          the designers of the interface while they are still working out
          their design.  (The application also may not find the data it
          desires, or may not get back what it expects.)</para>
      </section>

    </chapter>

    <chapter id="ch-order-matters">
      <title id="ch-order-matters-title">Why Order Matters</title>

      <para>When searching device elements, the first exact match will be
      selected.  Subsequent matches are ignored.
      </para>

      <para>Specifically, three comparisons are made:</para>

      <orderedlist>
        <listitem>
          <para>The hardware must provide identification that matches
          attributes of the <sgmltag>device</sgmltag> element.  As an
          example, a &pci; device supplies numeric vendor and model
          identifiers, which are used to match the
          <sgmltag>model</sgmltag> and <sgmltag>vendor</sgmltag>
          attributes.</para>
        </listitem>
        <listitem>
          <para>The <sgmltag>class</sgmltag> attributes of child
          <sgmltag>data</sgmltag> elements must match the data path as
          given to the library for searching.</para>
        </listitem>
        <listitem>
          <para>The first version range, if any, associated with the nested
          <sgmltag>data</sgmltag> elements must encompass any
          version provided by the client.</para>
        </listitem>
      </orderedlist>

      <example>
        <title>Matching <sgmltag>device</sgmltag> elements</title>

        <para>Assume that the path <literal>linux/module/name</literal> is
        provided, along with a version of 2.4.2.  The following is sample
        data; the <sgmltag>device</sgmltag> elements may be from the same
        or different data files.</para>

        <programlisting><![CDATA[
<device busclass="0000" vendor="102f" model="5555" model_name="100VG ethernet">
  <data class="linux" version="[2.4, inf)">]]><co id="bad_name"/><![CDATA[
    <data class="modules">
        <data class="name">vg100</data>
    </data>
  </data>
  <data class="linux" version="[2.0, 2.2)">]]><co id="range_20to22"/><![CDATA[
    <data class="module">
        <data class="name">vg100</data>
        <data class="options">io=0x300</data>
    </data>
  </data>
</device>

<device busclass="0000" vendor="102f" model="5555" model_name="100VG ethernet">
  <data class="linux">]]><co id="blank_range"/><![CDATA[
    <data class="module">
        <data class="name">vg100new</data>
    </data>
  </data>
  <data class="linux" version="[2.4, inf)">]]><co id="range_24toinf"/><![CDATA[
    <data class="module">
        <data class="name">vg100old</data>
    </data>
  </data>
</device>

]]></programlisting>

        <calloutlist>
          <callout arearefs="bad_name">
            <para>This item is the first one scanned, and would match,
            except that the requested data path includes
            <quote>module</quote> as a component, not
            <quote>modules</quote> as specified here.</para>
          </callout>
          <callout arearefs="range_20to22">
            <para>This item doesn't match because the provided range is
            outside the limits defined by the element. (2.4.2 is not
            greater than or equal to 2.0 and less than 2.2.)</para>
          </callout>
          <callout arearefs="blank_range">
            <para>This item matches because no range is given, so
            <quote>vg100new</quote> is the value returned.</para>
          </callout>
          <callout arearefs="range_24toinf">
            <para>This is the nearest match, but the &discover; library
            will never select it because its previous sibling has no
            version range, and thus will catch any version provided.</para>
          </callout>
        </calloutlist>
      </example>
    </chapter>

    <chapter id="ch-using_data_versioning">
      <title id="ch-using_data_versioning-title">Using Data Versioning</title>

      <section id="sc-specifying_range">
        <title id="sc-specifying_range-title">Specifying a Range</title>

        <para>Because multiple versions of a software interface often are
        in simultaneous deployment, Progeny recommendeds that the upper
        bound of a <sgmltag class="element">data</sgmltag> element's
        <sgmltag class="attribute">version</sgmltag> attribute be defined
        as the first version that is inconsistent with the information
        provided within it, and that the upper end of the interval be open
        (terminated with a parenthesis).  As an example, suppose we know
        that the name of the Linux kernel module to drive the RealTek
        RTL-8139 Ethernet device was <literal>rtl8139</literal> in the 2.2
        kernel series and <literal>8139too</literal> in the 2.4 series.  To
        express this, we would say the following:</para>

        <example id="ex-using_version_attribute_of_data_element">
          <title
          id="ex-using_version_attribute_of_data_element-title">Using the
          <sgmltag>version</sgmltag> attribute of the
          <sgmltag>data</sgmltag> element</title>
        <programlisting><![CDATA[<device_list bus="pci">
<device busclass="0200" model="8139" model_name="RTL-8139" vendor="10ec">
  <data class="linux" version="[2.4,inf)">
    <data class="module">
       <data class="name">8139too</data>
    </data>
  </data>
  <data class="linux" version="[2.2,2.4)">
    <data class="module">
       <data class="name">rtl8139</data>
    </data>
  </data>
</device>
</device_list>]]></programlisting>
        </example>

        <para>In the first data element, for instance, we would not use a
        version attribute of <literal>[2.2.0,2.2.19]</literal> because it is needlessly specific.  What happens if the Linux kernel
        developers release Linux kernel 2.2.20?  By saying
        <literal>[2.2,2.4)</literal>, we <quote>catch</quote> everything in
        the kernel 2.2 series<footnote><para>We would say
        <literal>[2.2,2.3)</literal> instead, but, like many Free Software
        projects, the Linux kernel uses odd minor version numbers to
        denote unstable, development series of the software, and even minor
        version numbers to denote stable, production series of the
        software. In the example, then, we arbitrarily treat all 2.3 series
        kernels the same as 2.2 kernels.</para></footnote> &mdash; past,
        present, and future.</para>

      </section>

      <section id="sc-how_discover_library_matches_range">
        <title id="sc-how_discover_library_matches_range-title">How the &discover; Library Matches a Range</title>

        <para>The data files will be searched in order; the first data path
        that matches the version range or doesn't have a version range will
        be returned.</para>

        <para>Recalling the discussion in <xref
        linkend="sc-data_element_version_attribute"/>, if you want the
        first data element matching the requested data path to also be the
        <quote>fallback</quote> element if no version range applies, you
        can duplicate that data element and place it at the end.  However,
        a better practice is to make certain that all reasonable versions
        will match one of the ranges, and that the first range listed has
        an open-ended high end, such as <literal>[2.4, inf)</literal> for
        Linux kernel modules in
        <xref linkend="ex-using_version_attribute_of_data_element"/>.  This
        will have the effect of <quote>assuming</quote> that
        all unversioned requests for <literal>linux</literal> data will be
        for Linux kernel 2.4 or later.</para>
      </section>
    </chapter>

  </part>

  <part id="pt-command-line_tools">
    <title id="pt-command-line_tools-title">Command-Line Tools</title>
    <chapter id="ch-discover_manpage">
      <title id="ch-discover_manpage-title"><command>discover</command> Manual Page</title>

    <refentry>
      &discover-1;
    </refentry>
    </chapter>
    <chapter id="ch-discover-conf_manpage">
      <title
      id="ch-discover-conf_manpage-title"><filename>discover.conf</filename> Manual Page</title>
      <refentry>
        &discover-conf-5;
      </refentry>
    </chapter>
    <chapter id="ch-discover-modprobe_manpage">
      <title
      id="ch-discover-modprobe_manpage-title"><command>discover-modprobe</command>
      Manual Page</title>
        <refentry>
          &discover-modprobe-8;
        </refentry>
    </chapter>

    <chapter id="ch-discover-modprobe-conf_manpage">
      <title
      id="ch-discover-modprobe-conf_manpage-title"><filename>discover-modprobe.conf</filename>
      Manual Page</title>
        <refentry>
          &discover-modprobe-conf-5;
        </refentry>
    </chapter>
  </part>

  <part id="pt-library">
    <title id="pt-library-title">Library</title>
    <chapter id="ch-discover_library">
      <title id="ch-discover_library-title">The &discover; Library</title>

      <section id="sc-library_design_principles">
        <title id="sc-library_design_principles-title">Library Design
        Principles</title>

        <para>Lazy allocation is used throughout &discover;.  This means
        that there are no <quote>init</quote> functions, and no functions
        to scan the bus.  Instead, retrieval functions scan or initialize
        as necessary. Each of these retrieval functions has an equivalent
        function for freeing the allocated memory.  This is valuable to
        long-lived processes to aid in memory management, but even
        short-lived processes may want to use them to force reloading of
        the information.</para>
      </section>

      <section id="sc-discover_data_sources">
        <title id="sc-discover_data_sources-title">&discover; Data
        Sources</title>

        <para>&discover; knows about one data source by default: the local
        data from the <literal>discover-data</literal> package.  Additional
        sources can be added with the
        <function>discover_conf_append_url</function> and
        <function>discover_conf_insert_url</function> functions.  As their
        names suggest, they append or insert &url;s on the data source
        list.  Earlier data overrides later data; to override
        the local data sources, insert &url;s.</para>
        <!-- XXX: Need to verify the insert/append behavior -->
      </section>

      <section id="sc-bus_map">
        <title id="sc-bus_map-title">The Bus Map</title>

        <para>Most high-level operations begin at the bus map.  Bus maps
        (<ulink
        url="api-reference/group__types.html#a2"><type>discover_bus_map_t</type></ulink>)
        are retrieved with calls to
        <function>discover_conf_get_bus_map</function> or
        <function>discover_conf_get_bus_map_by_name</function>.
        <function>discover_conf_get_bus_map</function> returns an array of
        maps, one for each supported bus, with the last element being all
        0s. <function>discover_conf_get_bus_map_by_name</function> returns
        the map for the named bus.  The map contains pointers to all the
        functions that operate on the bus, as well as the
        <varname>scan_default</varname> variable, which determines whether
        the bus is scanned by default.  There is also a
        <varname>scan_never</varname> variable, but it is for internal use
        only.  The name of the bus is stored in the
        <varname>name</varname> variable.</para>

        <para>The following functions are available in the bus map.  The
        <quote>get</quote> functions take a single <ulink
        url="api-reference/group__types.html#a1"><type>discover_error_t</type></ulink>
        argument and return a list of <ulink
        url="api-reference/group__types.html#a3"><type>discover_device_t</type></ulink>
        structures, while the <quote>free</quote> functions take no
        arguments and return no value.</para>

        <variablelist>
          <varlistentry>
            <term><function>get_devices</function></term>
            <listitem>
              <para>Retrieve the list of devices found on this bus.
              Returns NULL if the bus is not present on the
              system, or if no devices are attached to it.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_get_busclasses</function></term>
            <listitem>
              <para>Retrieve the list of busclasses for this bus (from
              the &xml; data sources).</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_get_devices</function></term>
            <listitem>
              <para>Retrieve the list of devices for this bus (from
              the &xml; data sources).  Note that this is the list of
              devices that &discover; knows about, not the list of devices
              present on the system.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_get_vendors</function></term>
            <listitem>
              <para>Retrieve the list of vendors for this bus (from
              the &xml; data sources).</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_get_busclass_urls</function></term>
            <listitem>
              <para>Retrieve the list of &url;s from which busclass data
              is retrieved.  This function is probably not useful to
              most clients.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_get_device_urls</function></term>
            <listitem>
              <para>Retrieve the list of &url;s from which device data
              is retrieved.  This function is probably not useful to
              most clients.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_get_vendor_urls</function></term>
            <listitem>
              <para>Retrieve the list of &url;s from which vendor data
              is retrieved.  This function is probably not useful to
              most clients.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>free_devices</function></term>
            <listitem>
              <para>Free the list of devices.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_free_busclasses</function></term>
            <listitem>
              <para>Free the list of busclasses.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_free_devices</function></term>
            <listitem>
              <para>Free the list of devices (the &xml; data, not the
              list of devices found on the system).</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_free_vendors</function></term>
            <listitem>
              <para>Free the list of vendors.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_free_busclass_urls</function></term>
            <listitem>
              <para>Free the list of busclass &url;s.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_free_device_urls</function></term>
            <listitem>
              <para>Free the list of device &url;s.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term><function>xml_free_vendor_urls</function></term>
            <listitem>
              <para>Free the list of vendor &url;s.</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>

      <section id="sc-scanning_system">
        <title id="sc-scanning_system-title">Scanning the System</title>

        <para>&discover; provides a few ways to scan the system for
        information.</para>

        <para>You can walk the bus map:</para>

        <informalexample>
          <programlisting><![CDATA[for (i = 0; busmap[i].name; i++) {
    if (busmap[i].scan == DISCOVER_SCAN_DEFAULT) {
        devices = busmap[i].get_devices(&status);
        check_status(status);
        do_something_cool(devices);
    }
}]]></programlisting>
        </informalexample>

        <para>You can scan a specific bus:</para>

        <informalexample>
          <programlisting><![CDATA[devices = discover_get_pci_devices(&status);
check_status(status);
do_something_cool(devices);]]></programlisting>
        </informalexample>

        <para>Perhaps most usefully, you can scan for devices
        of a specific type:</para>

        <informalexample>
          <programlisting><![CDATA[devices = discover_device_find("video", &status);
check_status(status);
do_something_video(devices);]]></programlisting>
        </informalexample>
      </section>

      <section id="sc-using_discover_device_t_structures">
        <title id="sc-using_discover_device_t_structures-title">Using
        <type>discover_device_t</type> Structures</title>

        <para>Now that you have some device structures, what can you
        do with them?  The most interesting operation is retrieving
        data with <function>discover_device_get_data</function>.  Also
        available are
        <function>discover_device_get_vendor_name</function>,
        <function>discover_device_get_model_name</function>,
        <function>discover_device_get_model_id</function>, and
        <function>discover_device_get_vendor_id</function>.</para>

        <para><function>discover_device_get_data</function> takes a
        <link linkend="sc-accessing_device_data">data path</link> and a
        <link linkend="sc-data_element_version_attribute">version
        number</link> and searches for the first data structure that
        matches.</para>

        <para><function>discover_device_get_vendor_name</function>
        returns the human-readable name for the device's
        vendor.</para>

        <para><function>discover_device_get_model_name</function>
        returns the human-readable name for the device's model.</para>

        <para><function>discover_device_get_model_id</function>
        returns the bus-specific ID for the device model.</para>

        <para><function>discover_device_get_vendor_id</function>
        returns the bus-specific ID for the device vendor.</para>
      </section>
    </chapter>

    <chapter id="ch-sysdeps">
      <title id="ch-sysdeps-title">System Dependencies</title>

      <section id="sc-sysdeps_api">
        <title id="sc-sysdeps_api-title">&api;</title>

        <para>The system-dependent code (<firstterm>sysdeps</firstterm>)
        that must be custom-written for each operating system conforms to a
        very simple &api;.  &discover; invokes
        <function>_discover_get_<replaceable>busname</replaceable>_raw()</function>
        with no arguments, and expects a linked list of
        <ulink url="api-reference/sysdep_8h.html#a0"><type>discover_sysdep_data_t</type></ulink> structures in return.</para>

        <para>The <ulink url="api-reference/sysdep_8h.html#a0"><type>discover_sysdep_data_t</type></ulink> structures should
        contain as much descriptive information as they can regarding the
        devices discovered.  Specifically, the three pieces of information
        desired are the <link
        linkend="ch-busclass_lists">busclass</link> (device
        type), <link linkend="ch-vendor_lists">vendor
        identifier</link>, and model identifier, which is a unique
        identification string that the vendor has provided for the given
        piece of hardware.</para>

        <example>
          <title>Linux &pci; sysdep code</title>

          <programlisting><![CDATA[#include <config.h>

#include <stdio.h>
#include <stdlib.h>

#include <sysdep.h>

discover_sysdep_data_t *
_discover_get_pci_raw(void)
{
    FILE *f;
    char *line = NULL;
    size_t len = 0;
    discover_sysdep_data_t *head = NULL, *node, *last = NULL;
    unsigned int id;

    if ((f = fopen(PATH_PROC_PCI, "r"))) {
        while (getline(&line, &len, f) >= 0) {
            if (line[0] == '\n' || line[0] == '#') {
                continue;
            }

            node = _discover_sysdep_data_new();
            sscanf(line, "%*04x\t%08x", &id);
            node->vendor = (id >> 16);
            node->model = id & 0xffff;

            if (head == NULL) {
                head = node;
                last = head;
            } else {
                last->next = node;
                last = node;
            }
        }
        free(line);
        fclose(f);
    }
    return head;
}]]>
</programlisting>
        </example>
      </section>
    </chapter>
  </part>

  <appendix id="ap-discover_api_reference">
    <title id="ap-discover_api_reference-title">&discover; &api; Reference</title>

    <para>The &api; reference is <ulink
    url="api-reference/index.html">here</ulink>.</para>
  </appendix>

  <appendix id="ap-discover_dtd">
    <title id="ap-discover_dtd-title">&discover; &dtd;</title>
    <programlisting>
<inlinegraphic format='linespecific' fileref="../discover.dtd"/>
    </programlisting>
  </appendix>

  <appendix id="ap-discover_conf_dtd">
    <title id="ap-discover_conf_dtd-title">&discover; Configuration File &dtd;</title>
    <programlisting>
<inlinegraphic format='linespecific' fileref="../etc/conffile.dtd"/>
    </programlisting>
  </appendix>

  <appendix id="ap-licensing_issue_linux_sysdeps">
    <title id="ap-licensing_issue_linux_sysdeps-title">Licensing Issue on the Linux Sysdeps</title>

    <para>It should be noted that the Linux-specific files in the
    <filename>sysdeps/linux</filename> directory of the source distribution
    are derived from code written for the <application>Detect</application>
    library by MandrakeSoft SA, and are licensed under the
    <acronym>GNU</acronym> Project's <ulink
    url="http://www.gnu.org/copyleft/gpl.html">General Public
    License</ulink> (<acronym>GPL</acronym>).</para>

    <para>Note that section 2 of the <acronym>GPL</acronym> places
    requirements on derived works that prevent licensees from exercising
    some of the permissions granted under the license on the rest of
    &discover;.  However, not everyone who modifies or distributes
    &discover; will necessarily be subject to the terms of the
    <acronym>GPL</acronym>.  If you do not compile, use, or distribute the
    Linux sysdeps (for instance, if you are building &discover; for
    FreeBSD), then the license terms on them do not attach.</para>

    <para>We realize, however, that it is desirable that all of &discover;
    be under the the same license terms.  There are a few possible
    solutions to this problem:</para>

    <itemizedlist>
      <listitem>
        <para>If you do not need the Linux sysdeps, you can delete them
        from your copy of &discover;.</para>
      </listitem>
      <listitem>
        <para>You can rewrite the Linux sysdeps.  The resulting code will
        be your work, so the only limitations on you will be those imposed
        by &discover;'s license.  If you do so, we encourage you to license
        your rewrite under the same terms as the rest of &discover; &mdash;
        in that event, Progeny will be happy to incorporate your code into
        a future release of &discover;.</para>
      </listitem>
      <listitem>
        <para>You can contact MandrakeSoft SA and negotiate a different
        license to their code that is used in the Linux sysdeps.</para>
      </listitem>
      <listitem>
        <para>You can contact MandrakeSoft SA and attempt to persuade them
        to relicense their code that is used in the Linux sydeps
        under the terms used by the rest of &discover;. (MandrakeSoft SA
        would not have to abandon or assign their copyright.)  If you
        succeed in this effort, please let Progeny know and we will update
        the license terms on our copy of the MandrakeSoft SA code.</para>
      </listitem>
      <listitem>
        <para>You can wait; eventually Progeny employees, or some
        volunteer, will rewrite the Linux sysdeps and license them under
        the terms that the rest of &discover; uses.</para>
      </listitem>
    </itemizedlist>

    <note>
      <para>The foregoing discussing is not legal advice and makes no claim
      to be such.  It is a layperson's understanding of the licensing
      issues from a software developer's perspective.  Progeny makes no
      warranties or guarantees as to the accuracy of the above
      analysis in a legal context.  If you require a professional legal
      opinion, consult attorneys specializing in copyright and licensed to
      practice in the jurisdictions of interest to you or to your
      organization.</para>
    </note>
  </appendix>

</book>

<!-- vim: set ai et tw=75 sw=2 sts=2: -->
<!--  Local variables: -->
<!--  eval: (sgml-load-dtd "../doctools/docbook-book.ced") -->
<!--  End: -->