* Set the name of the specified probe in the specified device. * * If the probe already has a different name assigned to it, it will be * removed, and the new name will be saved instead. * * @param sdi The device instance the probe is connected to. * @param probenum The number of the probe whose name to set. * Note that the probe numbers start at 0. * @param name The new na
| 81 | * @since 0.1.0 (but the API changed in 0.2.0) |
| 82 | */ |
| 83 | SR_PRIV int sr_dev_probe_name_set(const struct sr_dev_inst *sdi, |
| 84 | int probenum, const char *name) |
| 85 | { |
| 86 | GSList *l; |
| 87 | struct sr_channel *probe; |
| 88 | int ret; |
| 89 | |
| 90 | if (!sdi) { |
| 91 | sr_err("%s: sdi was NULL", __func__); |
| 92 | return SR_ERR_ARG; |
| 93 | } |
| 94 | |
| 95 | ret = SR_ERR_ARG; |
| 96 | for (l = sdi->channels; l; l = l->next) { |
| 97 | probe = l->data; |
| 98 | if (probe->index == probenum) { |
| 99 | g_free(probe->name); |
| 100 | probe->name = g_strdup(name); |
| 101 | ret = SR_OK; |
| 102 | break; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | return ret; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Enable or disable a probe on the specified device. |
no outgoing calls
no test coverage detected