Skip to content

Commit

Permalink
cli: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
biot committed Aug 3, 2012
1 parent 22981b2 commit a2e8008
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 78 deletions.
60 changes: 0 additions & 60 deletions parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 0 additions & 17 deletions sigrok-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion sigrok-cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a2e8008

Please sign in to comment.