FreeCalypso > hg > fc-usbser-tools
comparison cp2102/read_baudtab.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 | ae8075bcc029 |
children | 1cacc1ae56f0 |
comparison
equal
deleted
inserted
replaced
96:c6d04771bf6a | 97:8d35346f1d46 |
---|---|
12 #include <unistd.h> | 12 #include <unistd.h> |
13 #include <usb.h> | 13 #include <usb.h> |
14 #include "../libuwrap/find_dev.h" | 14 #include "../libuwrap/find_dev.h" |
15 #include "cp210x_defs.h" | 15 #include "cp210x_defs.h" |
16 | 16 |
17 extern struct usb_device *find_cp2102_device(); | |
18 | |
17 u_char eeprom[SIZE_EEPROM]; | 19 u_char eeprom[SIZE_EEPROM]; |
18 | 20 |
19 main(argc, argv) | 21 main(argc, argv) |
20 char **argv; | 22 char **argv; |
21 { | 23 { |
24 | 26 |
25 if (argc != 2) { | 27 if (argc != 2) { |
26 fprintf(stderr, "usage: %s device-selector\n", argv[0]); | 28 fprintf(stderr, "usage: %s device-selector\n", argv[0]); |
27 exit(1); | 29 exit(1); |
28 } | 30 } |
29 dev = find_usbdev_by_desc_string(argv[1]); | 31 dev = find_cp2102_device(argv[1]); |
30 if (!dev) { | |
31 fprintf(stderr, "error: specified USB device not found\n"); | |
32 exit(1); | |
33 } | |
34 usbh = usb_open(dev); | 32 usbh = usb_open(dev); |
35 if (!usbh) { | 33 if (!usbh) { |
36 fprintf(stderr, "error: usb_open() failed\n"); | 34 fprintf(stderr, "error: usb_open() failed\n"); |
37 exit(1); | 35 exit(1); |
38 } | 36 } |