| 1 | /* simple.c |
| 2 | |
| 3 | Simple libftdi usage example |
| 4 | |
| 5 | This program is distributed under the GPL, version 2 |
| 6 | */ |
| 7 | |
| 8 | #include <stdio.h> |
| 9 | #include <ftdi.h> |
| 10 | |
| 11 | int main(int argc, char **argv) |
| 12 | { |
| 13 | int ret; |
| 14 | struct ftdi_context ftdic; |
| 15 | ftdi_init(&ftdic); |
| 16 | |
| 17 | if((ret = ftdi_usb_open(&ftdic, 0x0403, 0x6001)) < 0) { |
| 18 | fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret, ftdi_get_error_string(&ftdic)); |
| 19 | return EXIT_FAILURE; |
| 20 | } |
| 21 | |
| 22 | ftdi_usb_close(&ftdic); |
| 23 | ftdi_deinit(&ftdic); |
| 24 | |
| 25 | return EXIT_SUCCESS; |
| 26 | } |