Examples

Get list of SCSI controllers

Get primary display controller

## Get list of SCSI controllers

#include <stdio.h>
#include <stdlib.h>
#include <hd.h>
int main(int argc, char **argv)
{
hd_data_t *hd_data;
hd_t *hd;
hd_data = calloc(1, sizeof *hd_data);
hd = hd_list(hd_data, hw_scsi, 1, NULL);
for(; hd; hd = hd->next) {
hd_dump_entry(hd_data, hd, stdout)
}
hd_free_hd_list(hd); /* free it */
hd_free_hd_data(hd_data);
free(hd_data);
return 0;
}
hd_t
struct s_hd_t hd_t
Individual hardware item.
hd_dump_entry
void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f)
Definition hdp.c:46
hw_scsi
@ hw_scsi
Definition hd.h:145
hd_free_hd_data
hd_data_t * hd_free_hd_data(hd_data_t *hd_data)
Free all data.
Definition hd.c:990
hd_list
hd_t * hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old)
Definition hd.c:3296
hd_free_hd_list
hd_t * hd_free_hd_list(hd_t *hd)
Free hardware items returned by e.g. hd_list().
Definition hd.c:1216
s_hd_t::next
struct s_hd_t * next
Link to next hardware item.
Definition hd.h:2202
hd.h
main
int main(int argc, char **argv)
Definition isdn_cdb.c:164
hd_data
static hd_data_t * hd_data
Definition pppoe.c:30
hd_data_t
Holds all data accumulated during hardware probing.
Definition hd.h:2609

## Get primary display controller

#include <stdio.h>
#include <stdlib.h>
#include <hd.h>
int main(int argc, char **argv)
{
hd_data_t *hd_data;
hd_t *hd;
unsigned display_idx;
hd_data = calloc(1, sizeof *hd_data);
hd = hd_list(hd_data, hw_display, 1, NULL);
display_idx = hd_display_adapter(hd_data);
hd_dump_entry(hd_data, hd_get_device_by_idx(hd_data, display_idx), stdout)
hd_free_hd_list(hd);
hd_free_hd_data(hd_data);
free(hd_data);
return 0;
}
hw_display
@ hw_display
Definition hd.h:142
hd_get_device_by_idx
hd_t * hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx)
Definition hd.c:2311
hd_display_adapter
unsigned hd_display_adapter(hd_data_t *hd_data)
Definition hd.c:3055