FreeCalypso > hg > fc-usbser-tools
comparison cp2102/find_dev.c @ 98:1cacc1ae56f0
cp2102 tools: convert to -d option for non-default device
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 28 Sep 2023 04:45:13 +0000 |
| parents | 8d35346f1d46 |
| children |
comparison
equal
deleted
inserted
replaced
| 97:8d35346f1d46 | 98:1cacc1ae56f0 |
|---|---|
| 20 find_cp2102_device(devsel_arg) | 20 find_cp2102_device(devsel_arg) |
| 21 char *devsel_arg; | 21 char *devsel_arg; |
| 22 { | 22 { |
| 23 struct usb_device *dev; | 23 struct usb_device *dev; |
| 24 | 24 |
| 25 if (!strcmp(devsel_arg, "default")) { | 25 if (devsel_arg) { |
| 26 dev = find_usbdev_by_desc_string(devsel_arg); | |
| 27 if (!dev) { | |
| 28 fprintf(stderr, | |
| 29 "error: specified USB device not found\n"); | |
| 30 exit(1); | |
| 31 } | |
| 32 } else { | |
| 26 dev = find_usbdev_by_matchspec(&default_id); | 33 dev = find_usbdev_by_matchspec(&default_id); |
| 27 if (!dev) { | 34 if (!dev) { |
| 28 fprintf(stderr, | 35 fprintf(stderr, |
| 29 "error: no default-ID CP2102 device found\n"); | 36 "error: no default-ID CP2102 device found\n"); |
| 30 exit(1); | 37 exit(1); |
| 31 } | 38 } |
| 32 } else { | |
| 33 dev = find_usbdev_by_desc_string(devsel_arg); | |
| 34 if (!dev) { | |
| 35 fprintf(stderr, | |
| 36 "error: specified USB device not found\n"); | |
| 37 exit(1); | |
| 38 } | |
| 39 } | 39 } |
| 40 return dev; | 40 return dev; |
| 41 } | 41 } |
