* Returns information about the given driver or device instance. * * @param driver The sr_dev_driver struct to query. * @param key The configuration key (SR_CONF_*). * @param data Pointer to a GVariant where the value will be stored. Must * not be NULL. The caller is given ownership of the GVariant * and must thus decrease the refcount after use. However if *
| 217 | * as an indication that it's not applicable. |
| 218 | */ |
| 219 | SR_PRIV int sr_config_get(const struct sr_dev_driver *driver, |
| 220 | const struct sr_dev_inst *sdi, |
| 221 | const struct sr_channel *ch, |
| 222 | const struct sr_channel_group *cg, |
| 223 | int key, GVariant **data) |
| 224 | { |
| 225 | int ret; |
| 226 | |
| 227 | if (!driver || !data) |
| 228 | return SR_ERR; |
| 229 | |
| 230 | if (!driver->config_get) |
| 231 | return SR_ERR_ARG; |
| 232 | |
| 233 | if ((ret = driver->config_get(key, data, sdi, ch, cg)) == SR_OK) { |
| 234 | /* Got a floating reference from the driver. Sink it here, |
| 235 | * caller will need to unref when done with it. */ |
| 236 | assert(*data); |
| 237 | g_variant_ref_sink(*data); |
| 238 | } |
| 239 | |
| 240 | return ret; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * Set a configuration key in a device instance. |
no outgoing calls
no test coverage detected