libhd  5.0
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_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 */
free(hd_data);
return 0;
}

Get primary display controller

#include <stdio.h>
#include <stdlib.h>
#include <hd.h>
int main(int argc, char **argv)
{
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);
free(hd_data);
return 0;
}
hd_display_adapter
unsigned hd_display_adapter(hd_data_t *hd_data)
Definition: hd.c:3051
s_hd_t
Individual hardware item.
Definition: hd.h:2201
hw_scsi
@ hw_scsi
Definition: hd.h:145
s_hd_t::next
struct s_hd_t * next
Link to next hardware item.
Definition: hd.h:2202
hd_get_device_by_idx
hd_t * hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx)
Definition: hd.c:2307
main
int main(int argc, char **argv)
Definition: isdn_cdb.c:164
hd.h
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:1212
hw_display
@ hw_display
Definition: hd.h:142
hd_data
static hd_data_t * hd_data
Definition: pppoe.c:29
hd_free_hd_data
hd_data_t * hd_free_hd_data(hd_data_t *hd_data)
Free all data.
Definition: hd.c:986
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:3292
hd_data_t
Holds all data accumulated during hardware probing.
Definition: hd.h:2609
hd_dump_entry
void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f)
Definition: hdp.c:46