annotate libuwrap/prelim_init.c @ 48:9cfe3223fbf8

doc/FTDI-EEPROM-tools: document -d options
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 11 Sep 2023 03:58:41 +0000
parents ab506f6aa57c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * libftdi-0.20 performs these preliminary steps just before it goes
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * looking for the device of interest via usb_get_busses() followed
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * by traversal of the returned tree - hence we do likewise.
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <usb.h>
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "prelim_init.h"
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 void libusb_prelim_init(void)
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 {
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 usb_init();
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 if (usb_find_busses() < 0) {
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 fprintf(stderr, "error: usb_find_busses() failed\n");
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 exit(1);
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 }
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if (usb_find_devices() < 0) {
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 fprintf(stderr, "error: usb_find_devices() failed\n");
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 exit(1);
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 }
ab506f6aa57c libuwrap started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 }