- slope = g_variant_get_string(data, NULL);
-
- if (!slope || !(slope[0] == 'f' || slope[0] == 'r'))
- sr_err("Invalid trigger slope");
- ret = SR_ERR_ARG;
- break;
- }
- devc->trigger_slope = (slope[0] == 'r')
- ? SLOPE_POSITIVE : SLOPE_NEGATIVE;
+ if ((idx = std_str_idx(data, ARRAY_AND_SIZE(trigger_slopes))) < 0)
+ return SR_ERR_ARG;
+ devc->trigger_slope = idx;