comparison fteeprom/fteeprom-erase.c @ 37:4d77c191c034

fteeprom-erase program written, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Apr 2019 19:39:50 +0000
parents
children
comparison
equal deleted inserted replaced
36:899ba273c30a 37:4d77c191c034
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <ftdi.h>
6
7 main(argc, argv)
8 char **argv;
9 {
10 struct ftdi_context ftdi;
11
12 if (argc != 2) {
13 fprintf(stderr, "usage: %s device-selector\n");
14 exit(1);
15 }
16 ftdi_init(&ftdi);
17 if (ftdi_usb_open_string(&ftdi, argv[1]) < 0) {
18 fprintf(stderr, "FTDI USB open failed: %s\n", ftdi.error_str);
19 exit(1);
20 }
21 if (ftdi_erase_eeprom(&ftdi) < 0) {
22 fprintf(stderr, "EEPROM write error: %s\n", ftdi.error_str);
23 exit(1);
24 }
25 ftdi_usb_close(&ftdi);
26 exit(0);
27 }