9
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * libftdi-0.20 performs these preliminary steps just before it goes
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * looking for the device of interest via usb_get_busses() followed
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * by traversal of the returned tree - hence we do likewise.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h>
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h>
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <usb.h>
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "prelim_init.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 void libusb_prelim_init(void)
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 {
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 usb_init();
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 if (usb_find_busses() < 0) {
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 fprintf(stderr, "error: usb_find_busses() failed\n");
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 exit(1);
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 }
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 if (usb_find_devices() < 0) {
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 fprintf(stderr, "error: usb_find_devices() failed\n");
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 exit(1);
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 }
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 }
|