libhd 5.0
hwclass_names.h
Go to the documentation of this file.
1typedef struct {
2 int key;
3 char *value;
4} hash_t;
5
6static char *key2value(hash_t *hash, int id);
7static int value2key(hash_t *hash, char *str);
8
9/* corresponds to hd_hw_item_t */
10static hash_t hw_items[] = {
11 { hw_sys, "system" },
12 { hw_cpu, "cpu" },
13 { hw_keyboard, "keyboard" },
14 { hw_braille, "braille" },
15 { hw_mouse, "mouse" },
16 { hw_joystick, "joystick" },
17 { hw_printer, "printer" },
18 { hw_scanner, "scanner" },
19 { hw_chipcard, "chipcard" },
20 { hw_monitor, "monitor" },
21 { hw_tv, "tv card" },
22 { hw_display, "graphics card" },
23 { hw_framebuffer, "framebuffer" },
24 { hw_camera, "camera" },
25 { hw_sound, "sound" },
26 { hw_storage_ctrl, "storage" },
27 { hw_network_ctrl, "network" },
28 { hw_isdn, "isdn adapter" },
29 { hw_modem, "modem" },
30 { hw_network, "network interface" },
31 { hw_disk, "disk" },
32 { hw_partition, "partition" },
33 { hw_cdrom, "cdrom" },
34 { hw_floppy, "floppy" },
35 { hw_manual, "manual" },
36 { hw_usb_ctrl, "usb controller" },
37 { hw_usb, "usb" },
38 { hw_bios, "bios" },
39 { hw_pci, "pci" },
40 { hw_isapnp, "isapnp" },
41 { hw_bridge, "bridge" },
42 { hw_hub, "hub" },
43 { hw_scsi, "scsi" },
44 { hw_ide, "ide" },
45 { hw_memory, "memory" },
46 { hw_dvb, "dvb card" },
47 { hw_pcmcia, "pcmcia" },
48 { hw_pcmcia_ctrl, "pcmcia controller" },
49 { hw_ieee1394, "firewire" },
50 { hw_ieee1394_ctrl, "firewire controller" },
51 { hw_hotplug, "hotplug" },
52 { hw_hotplug_ctrl, "hotplug controller" },
53 { hw_zip, "zip" },
54 { hw_pppoe, "pppoe" },
55 { hw_wlan, "wlan card" },
56 { hw_redasd, "redasd" },
57 { hw_dsl, "dsl adapter" },
58 { hw_block, "block device" },
59 { hw_tape, "tape" },
60 { hw_vbe, "vesa bios" },
61 { hw_bluetooth, "bluetooth" },
62 { hw_unknown, "unknown" },
63 { 0, NULL }
64};
65
66int value2key(hash_t *hash, char *str)
67{
68 for(; hash->value; hash++) {
69 if(!strcmp(hash->value, str)) break;
70 }
71
72 return hash->key;
73}
74
75char *key2value(hash_t *hash, int id)
76{
77 for(; hash->value; hash++) {
78 if(hash->key == id) break;
79 }
80
81 return hash->value;
82}
83
84
86{
87 return key2value(hw_items, item);
88}
89
90
92{
93 return name ? value2key(hw_items, name) : hw_none;
94}
95
96
hd_hw_item_t hd_hw_item_type(char *name)
Definition: hwclass_names.h:91
char * hd_hw_item_name(hd_hw_item_t item)
Definition: hwclass_names.h:85
enum hw_item hd_hw_item_t
list types for hd_list()
@ hw_redasd
Definition: hd.h:147
@ hw_usb_ctrl
Definition: hd.h:144
@ hw_wlan
Definition: hd.h:147
@ hw_pcmcia
Definition: hd.h:146
@ hw_sys
Definition: hd.h:140
@ hw_storage_ctrl
Definition: hd.h:142
@ hw_isdn
Definition: hd.h:143
@ hw_floppy
Definition: hd.h:144
@ hw_dvb
Definition: hd.h:145
@ hw_isapnp
Definition: hd.h:145
@ hw_chipcard
Definition: hd.h:141
@ hw_pcmcia_ctrl
Definition: hd.h:146
@ hw_dsl
Definition: hd.h:147
@ hw_monitor
Definition: hd.h:141
@ hw_manual
Definition: hd.h:144
@ hw_framebuffer
Definition: hd.h:142
@ hw_keyboard
Definition: hd.h:140
@ hw_pci
Definition: hd.h:144
@ hw_scsi
Definition: hd.h:145
@ hw_printer
Definition: hd.h:141
@ hw_none
Definition: hd.h:140
@ hw_disk
Definition: hd.h:143
@ hw_hub
Definition: hd.h:145
@ hw_modem
Definition: hd.h:143
@ hw_hotplug
Definition: hd.h:146
@ hw_bluetooth
Definition: hd.h:148
@ hw_cpu
Definition: hd.h:140
@ hw_sound
Definition: hd.h:142
@ hw_pppoe
Definition: hd.h:147
@ hw_unknown
append new entries here
Definition: hd.h:150
@ hw_ieee1394_ctrl
Definition: hd.h:146
@ hw_block
Definition: hd.h:147
@ hw_display
Definition: hd.h:142
@ hw_ieee1394
Definition: hd.h:146
@ hw_vbe
Definition: hd.h:148
@ hw_bridge
Definition: hd.h:145
@ hw_memory
Definition: hd.h:145
@ hw_mouse
Definition: hd.h:140
@ hw_usb
Definition: hd.h:144
@ hw_network_ctrl
Definition: hd.h:143
@ hw_tape
Definition: hd.h:148
@ hw_camera
Definition: hd.h:142
@ hw_scanner
Definition: hd.h:141
@ hw_tv
Definition: hd.h:141
@ hw_cdrom
Definition: hd.h:144
@ hw_hotplug_ctrl
Definition: hd.h:147
@ hw_braille
Definition: hd.h:140
@ hw_joystick
Definition: hd.h:141
@ hw_partition
Definition: hd.h:143
@ hw_bios
Definition: hd.h:144
@ hw_network
Definition: hd.h:143
@ hw_zip
Definition: hd.h:147
@ hw_ide
Definition: hd.h:145
static hash_t hw_items[]
Definition: hwclass_names.h:10
static int value2key(hash_t *hash, char *str)
Definition: hwclass_names.h:66
static char * key2value(hash_t *hash, int id)
Definition: hwclass_names.h:75
Definition: hwclass_names.h:1
int key
Definition: hwclass_names.h:2
char * value
Definition: hwclass_names.h:3