- ret = SR_OK;
- if (!strcmp(stropt, STR_PATTERN_SIGROK)) {
- devc->sample_generator = PATTERN_SIGROK;
- } else if (!strcmp(stropt, STR_PATTERN_RANDOM)) {
- devc->sample_generator = PATTERN_RANDOM;
- } else if (!strcmp(stropt, STR_PATTERN_INC)) {
- devc->sample_generator = PATTERN_INC;
- } else if (!strcmp(stropt, STR_PATTERN_ALL_LOW)) {
- devc->sample_generator = PATTERN_ALL_LOW;
- } else if (!strcmp(stropt, STR_PATTERN_ALL_HIGH)) {
- devc->sample_generator = PATTERN_ALL_HIGH;
+ logic_pattern = analog_pattern = -1;
+ /* Is it a logic pattern? */
+ for (i = 0; i < ARRAY_SIZE(logic_pattern_str); i++) {
+ if (!strcmp(stropt, logic_pattern_str[i])) {
+ logic_pattern = i;
+ break;
+ }
+ }
+ if (logic_pattern == -1) {
+ /* Is it an analog pattern? */
+ for (i = 0; i < ARRAY_SIZE(analog_pattern_str); i++) {
+ if (!strcmp(stropt, analog_pattern_str[i])) {
+ analog_pattern = i;
+ break;
+ }
+ }
+ }
+ if (logic_pattern > -1) {
+ devc->logic_pattern = logic_pattern;
+ /* Might as well do this now. */
+ if (logic_pattern == PATTERN_ALL_LOW)
+ memset(devc->logic_data, 0x00, LOGIC_BUFSIZE);
+ else if (logic_pattern == PATTERN_ALL_HIGH)
+ memset(devc->logic_data, 0xff, LOGIC_BUFSIZE);
+ ret = SR_OK;
+ sr_dbg("Setting logic pattern to %s", logic_pattern_str[logic_pattern]);
+ } else if (analog_pattern > -1) {
+ sr_dbg("Setting analog pattern to %s", analog_pattern_str[analog_pattern]);
+ if (probe_group)
+ set_analog_pattern(probe_group, analog_pattern);
+ else {
+ /* No probe group specified, apply pattern to all of them. */
+ for (l = sdi->probe_groups; l; l = l->next) {
+ pg = l->data;
+ set_analog_pattern(pg, analog_pattern);
+ }
+ ret = SR_OK;
+ }