hwclass_names.h
Go to the documentation of this file.
typedef struct {
int key;
char *value;
} hash_t;
static char *key2value(hash_t *hash, int id);
static int value2key(hash_t *hash, char *str);
/* corresponds to hd_hw_item_t */
static hash_t hw_items[] = {
{ hw_sys, "system" },
{ hw_cpu, "cpu" },
{ hw_keyboard, "keyboard" },
{ hw_braille, "braille" },
{ hw_mouse, "mouse" },
{ hw_joystick, "joystick" },
{ hw_printer, "printer" },
{ hw_scanner, "scanner" },
{ hw_chipcard, "chipcard" },
{ hw_monitor, "monitor" },
{ hw_tv, "tv card" },
{ hw_display, "graphics card" },
{ hw_framebuffer, "framebuffer" },
{ hw_camera, "camera" },
{ hw_sound, "sound" },
{ hw_storage_ctrl, "storage" },
{ hw_network_ctrl, "network" },
{ hw_isdn, "isdn adapter" },
{ hw_modem, "modem" },
{ hw_network, "network interface" },
{ hw_disk, "disk" },
{ hw_partition, "partition" },
{ hw_cdrom, "cdrom" },
{ hw_floppy, "floppy" },
{ hw_manual, "manual" },
{ hw_usb_ctrl, "usb controller" },
{ hw_usb, "usb" },
{ hw_bios, "bios" },
{ hw_pci, "pci" },
{ hw_isapnp, "isapnp" },
{ hw_bridge, "bridge" },
{ hw_hub, "hub" },
{ hw_scsi, "scsi" },
{ hw_ide, "ide" },
{ hw_memory, "memory" },
{ hw_dvb, "dvb card" },
{ hw_pcmcia, "pcmcia" },
{ hw_pcmcia_ctrl, "pcmcia controller" },
{ hw_ieee1394, "firewire" },
{ hw_ieee1394_ctrl, "firewire controller" },
{ hw_hotplug, "hotplug" },
{ hw_hotplug_ctrl, "hotplug controller" },
{ hw_zip, "zip" },
{ hw_pppoe, "pppoe" },
{ hw_wlan, "wlan card" },
{ hw_redasd, "redasd" },
{ hw_dsl, "dsl adapter" },
{ hw_block, "block device" },
{ hw_tape, "tape" },
{ hw_vbe, "vesa bios" },
{ hw_bluetooth, "bluetooth" },
{ hw_unknown, "unknown" },
{ 0, NULL }
};
int value2key(hash_t *hash, char *str)
{
for(; hash->value; hash++) {
if(!strcmp(hash->value, str)) break;
}
return hash->key;
}
char *key2value(hash_t *hash, int id)
{
for(; hash->value; hash++) {
if(hash->key == id) break;
}
return hash->value;
}
char *hd_hw_item_name(hd_hw_item_t item)
{
return key2value(hw_items, item);
}
hd_hw_item_t hd_hw_item_type(char *name)
{
return name ? value2key(hw_items, name) : hw_none;
}
hd_hw_item_type
hd_hw_item_t hd_hw_item_type(char *name)
Definition hwclass_names.h:91
hd_hw_item_name
char * hd_hw_item_name(hd_hw_item_t item)
Definition hwclass_names.h:85
hd_hw_item_t
enum hw_item hd_hw_item_t
list types for hd_list()
hw_redasd
@ hw_redasd
Definition hd.h:147
hw_usb_ctrl
@ hw_usb_ctrl
Definition hd.h:144
hw_wlan
@ hw_wlan
Definition hd.h:147
hw_pcmcia
@ hw_pcmcia
Definition hd.h:146
hw_sys
@ hw_sys
Definition hd.h:140
hw_storage_ctrl
@ hw_storage_ctrl
Definition hd.h:142
hw_isdn
@ hw_isdn
Definition hd.h:143
hw_floppy
@ hw_floppy
Definition hd.h:144
hw_dvb
@ hw_dvb
Definition hd.h:145
hw_isapnp
@ hw_isapnp
Definition hd.h:145
hw_chipcard
@ hw_chipcard
Definition hd.h:141
hw_pcmcia_ctrl
@ hw_pcmcia_ctrl
Definition hd.h:146
hw_dsl
@ hw_dsl
Definition hd.h:147
hw_monitor
@ hw_monitor
Definition hd.h:141
hw_manual
@ hw_manual
Definition hd.h:144
hw_framebuffer
@ hw_framebuffer
Definition hd.h:142
hw_keyboard
@ hw_keyboard
Definition hd.h:140
hw_pci
@ hw_pci
Definition hd.h:144
hw_scsi
@ hw_scsi
Definition hd.h:145
hw_printer
@ hw_printer
Definition hd.h:141
hw_none
@ hw_none
Definition hd.h:140
hw_disk
@ hw_disk
Definition hd.h:143
hw_hub
@ hw_hub
Definition hd.h:145
hw_modem
@ hw_modem
Definition hd.h:143
hw_hotplug
@ hw_hotplug
Definition hd.h:146
hw_bluetooth
@ hw_bluetooth
Definition hd.h:148
hw_cpu
@ hw_cpu
Definition hd.h:140
hw_sound
@ hw_sound
Definition hd.h:142
hw_pppoe
@ hw_pppoe
Definition hd.h:147
hw_unknown
@ hw_unknown
append new entries here
Definition hd.h:150
hw_ieee1394_ctrl
@ hw_ieee1394_ctrl
Definition hd.h:146
hw_block
@ hw_block
Definition hd.h:147
hw_display
@ hw_display
Definition hd.h:142
hw_ieee1394
@ hw_ieee1394
Definition hd.h:146
hw_vbe
@ hw_vbe
Definition hd.h:148
hw_bridge
@ hw_bridge
Definition hd.h:145
hw_memory
@ hw_memory
Definition hd.h:145
hw_mouse
@ hw_mouse
Definition hd.h:140
hw_usb
@ hw_usb
Definition hd.h:144
hw_network_ctrl
@ hw_network_ctrl
Definition hd.h:143
hw_tape
@ hw_tape
Definition hd.h:148
hw_camera
@ hw_camera
Definition hd.h:142
hw_scanner
@ hw_scanner
Definition hd.h:141
hw_tv
@ hw_tv
Definition hd.h:141
hw_cdrom
@ hw_cdrom
Definition hd.h:144
hw_hotplug_ctrl
@ hw_hotplug_ctrl
Definition hd.h:147
hw_braille
@ hw_braille
Definition hd.h:140
hw_joystick
@ hw_joystick
Definition hd.h:141
hw_partition
@ hw_partition
Definition hd.h:143
hw_bios
@ hw_bios
Definition hd.h:144
hw_network
@ hw_network
Definition hd.h:143
hw_zip
@ hw_zip
Definition hd.h:147
hw_ide
@ hw_ide
Definition hd.h:145
hw_items
static hash_t hw_items[]
Definition hwclass_names.h:10
value2key
static int value2key(hash_t *hash, char *str)
Definition hwclass_names.h:66
key2value
static char * key2value(hash_t *hash, int id)
Definition hwclass_names.h:75
hash_t
Definition hwclass_names.h:1
hash_t::key
int key
Definition hwclass_names.h:2
hash_t::value
char * value
Definition hwclass_names.h:3