comparison fteeprom/fteeprom-erase.c @ 0:11b8a30333b3

fteeprom: initial import from freecalypso-hwlab
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 03 Sep 2023 18:08:22 +0000
parents
children af801ab43a33
comparison
equal deleted inserted replaced
-1:000000000000 0:11b8a30333b3
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 }