|
|
Device Detection Tool 2.0 Design
1. OverviewDevice Detection Tool can tell you in just a couple of minutes whether the Solaris OS supports the devices that are detected in your x86/x64 system. It produces a table that shows whether a Solaris driver is available for each device the tool detects. The table tells you whether the driver is built in to the Solaris OS or available in OpenSolaris.org or whether a third-party driver is available. For its functionality and usage, refer to its official web site. In
a certain aspect, Device Detection Tool is a 'predict' tool. It could
predict whether those devices in you Windows or Linux system work
when a Solaris OS is installed on the machine. How does it do that?
It is actually simple:
2. ArchitectureFollowing is the architecture diagram of Device Detection Tool.
From the architecture diagram you can see that there are three parts of the tool: (1) Driver Database; (2) PCI device data probe program for specific system; (3) and the function unit. In the later chapters, the parts are introduced one by one.
3. Driver DatabaseThe driver database of Device Detection Tool are special format text files – configuration file, pci.ids and a driver.db specified to each target OS. 3.1 configuration fileDDTool reads arguments from a single configuration file, and this file will be put on a server. DDTool gets the configuration file remotely while launching. And then DDTool reads arguments from it. Those arguments are URL of pci.ids and driver.db, and The
configuration file is a XML file, and its format is as
follows: 3.2 pci.idspci.ids is a public repository of all known ID's used in PCI devices, and we can get full device names and vendor names instead of the numeric device id and vendor id by using it. It is maintained by developers outside Sun, and can be distributed under the 3-clause BSD License. We can adopt it as a part of DDTool Database without any license problem. The following are examples of records in pci.ids: -------------------------------------------------------------------------------- 3.3 driver.db3.3.1 overview of driver.dbdriver.db is created and maintained by our team. We can use it to get driver availability status of devices. At present, DDTool provides driver.db for the latest Solaris 10 and Solaris Express Developer Edition OS.
3.3.2 Kernel driver db(1)
every line in driver.db is a record which corresponds to a single
device;
[example
1]: 3.3.3 Xorg driver dbDevice Detection Tool 2.0 detects both the kernel video driver and the Xorg video driver for each video device. Not all video devices have both of the two types of video drivers. Some video devices have only the kernel driver. For example, the ATI RV280[Radeon 9200 PRO] video device has only a kernel video driver named vgatext. Xorg driver db is a mapping table between pciids and Xorg driver name. Every line in Xorg Driver DB is a record which corresponds to a single device. The syntax is as follows: ---------------------------------------------------------- pic<vendor_id>,<device_id>
Xorg_drivername
3.3.4 drivername-classcode mapping tableThe table is used to check whether a matched driver really supports devices in a specific type. It is created manually by our team members, and at the end of the driver.db file. The syntax is as follows: ------------------------------------
4. Collect PCI device data4.1 Parsing PCI device data from output message of system commandsDevice Detection Tool 1.0 gets the device information by running specific system commands respectively on Solaris, Linux and Windows OS as follows, and parses the output message of system commands to extract device information such as vendor id, device id, etc..
4.2 Probe users’s system to get PCI device data directlyDevice Detection Tool 2.0 enhances the device data collecting method. It imports following interfaces to collect device information:
The
interface between native probe programs and DDTool is very
simple. It is also output message porting to DDTool by the natvie
programs. The message has a unique format on all platform as follows:
The ids are separated by a ',' without space. One line ending with a line break (“\n”) is corresponding to a single device. Following
is an example:
4.3 A new functionDevice Detection Tool 2.0 also allows device information to be feed into it from plain text files that contain the output message of system commands listed in the first table. The received device information is scanned and parsed by Device Detection Tool 2.0 to extract device data (as what Device Detection Tool 1.0 did). This function enables the users to check the Solaris driver availability status for remote machines or those without Internet access.
5. Retrieve Device Data5.1 Overview of RetrievingAfter the PCI device configuration data is collected, DDTool will retrieve the DDTool Database with these keywords(the values of device id, vendor id, class code, subsystem vendor id and subsystem id). Retrieving a single device will look up pci.ids and driver.db sequentially ( please refer the table below):
5.2 Driver Searching Policy5.2.1 Device HidingBridges, SMBus, Memory controller, secondary video controllers are filtered out from the final report. Because (a) they don't have impact on the installation of Solaris OS; and (b) Solaris OS generally don't have a driver for them. Thus all of these devices are ignored. DDTool won’t search driver status for them, and they won’t be in the final report. Therefore, DDTool ignores following devices and won’t display them in the final report: those devices whose class code is begin with one of "000600", "000601", "000602", "000603", "000604", "000680", "0005", "000c05", "0008", or "000380".5.2.2 Searching Kernel Driver DBWhen a device is detected, DDTool is aware of its class_code, vendor_id, device_id, subsystem_vendor_id, subsystem_id, and revision_id. With the 6 values, 7 keywords can be created for this device as follows: (KW1): pci<vendor_id>,<device_id>.<subsystem_vendor_id>.<subsystem_id>.<revision_id> (KW2): pci<vendor_id>,<device_id>.<subsystem_vendor_id>.<subsystem_id> (KW3): pci<subsystem_vendor_id>,<subsystem_id> (KW4): pci<vendor_id>,<device_id>.<revision_id> (KW5): pci<vendor_id>,<device_id> (KW6): pciclass<class_code> (6 bytes class code) (KW7): pciclass<class_code> (4 bytes class code) The 7 keywords are sort by degressive priority. The priority of KW1 is the highest. DDTool searches Kernel Driver DB line by line (each line in Kernel Driver DB is a separated record)with the 7 keywords. (step 1) First of all, DDTool go through Solaris bundled records in PCI Kernel Driver DB complying with following rules: (a) It compares the key-value of each record with keywords in decreasing priority: KW1 -> KW2 -> ... -> KW7. (b) If a record is matched, DDTool goes to check whether the class code of the device is listed corresponding record of the founded driver name in drivername- classcode mapping table. If so, the record is matched record. Otherwise, the record is ignored. (c) If any record matches the highest priority keyword (KW1), the record is returned. (d) If any record matches one of non-highest priority keywords (KW2, KW3 ... KW7 ), this record is saved in buffer. And DDTool continues to search for other records. (e) In the searching process, if any record matches a keyword with another non-highest priority keyword which has a higher priority than the current buffered one, the new record is saved in buffer to replace the old one. (f) The searching process won’t stop until (c) or all driver records in the current category are compared. In the latter situation, if DDTool only finds some record(s) matched with non-highest priority keyword(s), the buffered record is returned. If DDTool doesn’t find any record, null is returned. (step 2) If a record is returned from searching Solaris bundled driver, and this driver is supported by both of 32-bit and 64-bit6 Solaris OS, this record is the result. Otherwise, if there is only 32-bit Solaris bundled driver available. This record is saved in buffer, and go through third-party records continuely following rule (a), (c) ~ (f) to search a 64-bit driver. (step 3) If a record is returned from searching third-party driver, and this driver is supported by both of 32-bit and 64-bit Solaris OS, or it is supported by 64-bit Solaris OS only, the 32-bit Solaris bundled driver and 64-bit thrid-party driver are displayed in the final report. Otherwise, the tool continuely go through OpenSolaris records following rule (a), (c) ~ (f). (step 4) If a record is returned from searching OpenSolaris driver, and this driver is supported by both of 32-bit and 64-bit Solaris OS, or it is supported by 64-bit Solaris OS only, the 32-bit Solaris bundled driver and 64-bit OpenSolaris driver are displayed in the final report. Otherwise, there is only the 32-bit Solaris bundled driver displayed in the report. Note: Since the classcode-drivername mapping table is only available for Solaris Bunlded driver now, the step of (b) is not useful for searching third-party of OpenSolaris driver. 5.2.3 Searching Xorg Driver DBDDTool searches the corresponding Xorg driver status for a video device in the Xorg Driver DB. (Step 1) (1.1) If a device's kernel driver name is 'nvidia', its Xorg driver name is 'nvidia'. In this case, DDTool returns and appends 'nvidia' to its kernel driver name. (1.2) If a device's kernel driver is a third party one, its Xorg driver name is the same as the third party kernel driver name. In this case, DDTool returns and appends the same name to its kernel driver name. (1.3) If a device has a Solaris kernel driver which is not 'nvidia', DDTool begins to searche each record in Xorg Driver DB with a single keyword which is "pci<vendor_id>,<device_id>" (KW5). (Step 2) DDTool reads a line from Xorg Driver DB, split it into 2 strings, and extracts the first string as the key-value of this record. (Step 3) In any record matches KW5, the record is the result record, and DDTool returns and appends the Xorg driver name contained in this record to this device's kernel driver name. (Step 4) After DDTool searches all records in Xorg Driver DB, if there is no any record matching KW5 of this device, that means this video device has no Xorg driver. DDTool just returns without any other action.
The
report data will be sorted and formatted again to create the final
report which could be displayed by UI.
7. ReferenceSun Device Detection Tool web site Device Detection Tool Open Project Page |