[patches] Add dmi kernel class support into HAL

Lennart Poettering mzuny at 0pointer.de
Tue May 22 07:21:16 PDT 2007


On Tue, 22.05.07 15:06, Richard Hughes (hughsient at gmail.com) wrote:

> +	static const char *chassis_map[] = {
> +		"Other",                 "unknown",
> +		"Unknown",               "unknown",
> +		"Desktop",               "desktop",
> +		"Low Profile Desktop",   "desktop",

[...]

> +		"Peripheral Chassis",    "unknown",
> +		"RAID Chassis",          "unknown",
> +		"Rack Mount Chassis",    "unknown",
> +		"Sealed-case PC",        "unknown",
> +		"Multi-system",          "unknown",
> +		NULL
> +	};

You really want to use "static const char * const chassis_map[] = {"
here. Both the strings and the array itself should be const!

Also: Please consider using GNU gperf for this. Constant lookup tables
are very good candidates for gperf. 

Humm. the "chassis_type" field contains a numeric id. To get a human
readable string you need to convert that first using some lookup
table. Unless I am mistaken you don't do that ranslation right now?

See the DMI/SMBIOS spec for the numeric ids:

http://www.dmtf.org/standards/published_documents/DSP0134.pdf

Section 3.3.4.1. on page 22.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the hal mailing list