FreeCalypso > hg > fc-usbser-tools
comparison cp2102/read_eeprom_main.c @ 97:8d35346f1d46
cp2102 tools: accept "default" as device-selector
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 Sep 2023 03:26:11 +0000 |
parents | a378bf95c26c |
children | 1cacc1ae56f0 |
comparison
equal
deleted
inserted
replaced
96:c6d04771bf6a | 97:8d35346f1d46 |
---|---|
13 #include <unistd.h> | 13 #include <unistd.h> |
14 #include <usb.h> | 14 #include <usb.h> |
15 #include "../libuwrap/find_dev.h" | 15 #include "../libuwrap/find_dev.h" |
16 #include "cp210x_defs.h" | 16 #include "cp210x_defs.h" |
17 | 17 |
18 extern struct usb_device *find_cp2102_device(); | |
19 | |
18 u_char eeprom[SIZE_EEPROM]; | 20 u_char eeprom[SIZE_EEPROM]; |
19 | 21 |
20 main(argc, argv) | 22 main(argc, argv) |
21 char **argv; | 23 char **argv; |
22 { | 24 { |
27 if (argc != 3) { | 29 if (argc != 3) { |
28 fprintf(stderr, "usage: %s device-selector output-hex-file\n", | 30 fprintf(stderr, "usage: %s device-selector output-hex-file\n", |
29 argv[0]); | 31 argv[0]); |
30 exit(1); | 32 exit(1); |
31 } | 33 } |
32 dev = find_usbdev_by_desc_string(argv[1]); | 34 dev = find_cp2102_device(argv[1]); |
33 if (!dev) { | |
34 fprintf(stderr, "error: specified USB device not found\n"); | |
35 exit(1); | |
36 } | |
37 usbh = usb_open(dev); | 35 usbh = usb_open(dev); |
38 if (!usbh) { | 36 if (!usbh) { |
39 fprintf(stderr, "error: usb_open() failed\n"); | 37 fprintf(stderr, "error: usb_open() failed\n"); |
40 exit(1); | 38 exit(1); |
41 } | 39 } |