From: Bert Vermeulen Date: Sun, 22 Jul 2012 14:55:26 +0000 (+0200) Subject: cli: remove dead code X-Git-Tag: sigrok-cli-0.4.0~93 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a2e8008830a99fe0e45399e4360f2d77ce577f2c;p=sigrok-cli.git cli: remove dead code --- diff --git a/parsers.c b/parsers.c index 65a2653..8d0bbe5 100644 --- a/parsers.c +++ b/parsers.c @@ -126,66 +126,6 @@ GHashTable *parse_generic_arg(const char *arg, gboolean sep_first) return hash; } -struct sr_dev *parse_devstring(const char *devstring) -{ - struct sr_dev *dev, *d; - struct sr_dev_driver **drivers; - GSList *devs, *l; - int i, num_devs, dev_num, dev_cnt; - char *tmp; - - if (!devstring) - return NULL; - - dev = NULL; - dev_num = strtol(devstring, &tmp, 10); - if (tmp != devstring) { - /* argument is numeric, meaning a device ID. Make all drivers - * scan for devices. - */ - num_devs = num_real_devs(); - if (dev_num < 0 || dev_num >= num_devs) - return NULL; - - dev_cnt = 0; - devs = sr_dev_list(); - for (l = devs; l; l = l->next) { - d = l->data; - if (sr_dev_has_hwcap(d, SR_HWCAP_DEMO_DEV)) - continue; - if (dev_cnt == dev_num) { - if (dev_num == dev_cnt) { - dev = d; - break; - } - } - dev_cnt++; - } - } else { - /* select device by driver -- only initialize that driver, - * no need to let them all scan - */ - dev = NULL; - drivers = sr_driver_list(); - for (i = 0; drivers[i]; i++) { - if (strcmp(drivers[i]->name, devstring)) - continue; - num_devs = sr_driver_init(drivers[i]); - if (num_devs == 1) { - devs = sr_dev_list(); - dev = devs->data; - } else if (num_devs > 1) { - printf("driver '%s' found %d devices, select by ID instead.\n", - devstring, num_devs); - } - /* fall through: selected driver found no devices */ - break; - } - } - - return dev; -} - char *strcanon(const char *str) { int p0, p1; diff --git a/sigrok-cli.c b/sigrok-cli.c index 814eb1f..b39dcf6 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -1214,23 +1214,6 @@ static void load_input_file(void) } } -int num_real_devs(void) -{ - struct sr_dev *dev; - GSList *devs, *l; - int num_devs; - - num_devs = 0; - devs = sr_dev_list(); - for (l = devs; l; l = l->next) { - dev = l->data; - if (!sr_dev_has_hwcap(dev, SR_HWCAP_DEMO_DEV)) - num_devs++; - } - - return num_devs; -} - static int set_dev_options(struct sr_dev *dev, GHashTable *args) { GHashTableIter iter; diff --git a/sigrok-cli.h b/sigrok-cli.h index 979b008..66028cd 100644 --- a/sigrok-cli.h +++ b/sigrok-cli.h @@ -25,7 +25,6 @@ int num_real_devs(void); /* parsers.c */ char **parse_probestring(int max_probes, const char *probestring); -char **sr_parse_triggerstring(struct sr_dev *dev, const char *triggerstring); GHashTable *parse_generic_arg(const char *arg, gboolean sep_first); struct sr_dev *parse_devstring(const char *devstring); uint64_t sr_parse_timestring(const char *timestring);