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;
}
void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f)
Definition hdp.c:46
@ hw_scsi
Definition hd.h:145
hd_data_t * hd_free_hd_data(hd_data_t *hd_data)
Free all data.
Definition hd.c:990
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_t * hd_free_hd_list(hd_t *hd)
Free hardware items returned by e.g. hd_list().
Definition hd.c:1216
struct s_hd_t * next
Link to next hardware item.
Definition hd.h:2203
int main(int argc, char **argv)
Definition isdn_cdb.c:164
static hd_data_t * hd_data
Definition pppoe.c:30
Holds all data accumulated during hardware probing.
Definition hd.h:2610
Individual hardware item.
Definition hd.h:2202

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;
}
@ hw_display
Definition hd.h:142
hd_t * hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx)
Definition hd.c:2311
unsigned hd_display_adapter(hd_data_t *hd_data)
Definition hd.c:3055