![]() |
libsigrok
0.2.2
sigrok hardware access and backend library
|
Device handling in libsigrok. More...
Functions | |
int | sr_dev_probe_name_set (const struct sr_dev_inst *sdi, int probenum, const char *name) |
Set the name of the specified probe in the specified device. More... | |
int | sr_dev_probe_enable (const struct sr_dev_inst *sdi, int probenum, gboolean state) |
Enable or disable a probe on the specified device. More... | |
int | sr_dev_trigger_set (const struct sr_dev_inst *sdi, int probenum, const char *trigger) |
Add a trigger to the specified device (and the specified probe). More... | |
gboolean | sr_dev_has_option (const struct sr_dev_inst *sdi, int key) |
Determine whether the specified device instance has the specified capability. More... | |
GSList * | sr_dev_list (const struct sr_dev_driver *driver) |
Get the list of devices/instances of the specified driver. More... | |
int | sr_dev_clear (const struct sr_dev_driver *driver) |
Clear all devices/instances of the specified driver. More... | |
int | sr_dev_open (struct sr_dev_inst *sdi) |
Open the specified device. More... | |
int | sr_dev_close (struct sr_dev_inst *sdi) |
Close the specified device. More... | |
Device handling in libsigrok.
int sr_dev_clear | ( | const struct sr_dev_driver * | driver | ) |
Clear all devices/instances of the specified driver.
driver | The driver to use. Must not be NULL. |
Definition at line 374 of file device.c.
References sr_dev_driver::dev_clear, and SR_OK.
int sr_dev_close | ( | struct sr_dev_inst * | sdi | ) |
Close the specified device.
sdi | Device instance to use. Must not be NULL. |
Definition at line 412 of file device.c.
References sr_dev_driver::dev_close, sr_dev_inst::driver, and SR_ERR.
gboolean sr_dev_has_option | ( | const struct sr_dev_inst * | sdi, |
int | key | ||
) |
Determine whether the specified device instance has the specified capability.
sdi | Pointer to the device instance to be checked. Must not be NULL. If the device's 'driver' field is NULL (virtual device), this function will always return FALSE (virtual devices don't have a hardware capabilities list). |
key | The option that should be checked for support on the specified device. |
Definition at line 201 of file device.c.
References sr_dev_driver::config_list, sr_dev_inst::driver, SR_CONF_DEVICE_OPTIONS, and SR_OK.
Referenced by sr_session_save().
GSList* sr_dev_list | ( | const struct sr_dev_driver * | driver | ) |
Get the list of devices/instances of the specified driver.
driver | The driver to use. Must not be NULL. |
Definition at line 357 of file device.c.
References sr_dev_driver::dev_list.
int sr_dev_open | ( | struct sr_dev_inst * | sdi | ) |
Open the specified device.
sdi | Device instance to use. Must not be NULL. |
Definition at line 391 of file device.c.
References sr_dev_driver::dev_open, sr_dev_inst::driver, and SR_ERR.
Referenced by sr_session_load().
int sr_dev_probe_enable | ( | const struct sr_dev_inst * | sdi, |
int | probenum, | ||
gboolean | state | ||
) |
Enable or disable a probe on the specified device.
sdi | The device instance the probe is connected to. |
probenum | The probe number, starting from 0. |
state | TRUE to enable the probe, FALSE to disable. |
Definition at line 122 of file device.c.
References sr_probe::enabled, sr_probe::index, sr_dev_inst::probes, SR_ERR_ARG, and SR_OK.
Referenced by sr_session_load().
int sr_dev_probe_name_set | ( | const struct sr_dev_inst * | sdi, |
int | probenum, | ||
const char * | name | ||
) |
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.
sdi | The device instance the probe is connected to. |
probenum | The number of the probe whose name to set. Note that the probe numbers start at 0. |
name | The new name that the specified probe should get. A copy of the string is made. |
Definition at line 85 of file device.c.
References sr_probe::index, sr_probe::name, sr_dev_inst::probes, sr_err, SR_ERR_ARG, and SR_OK.
Referenced by sr_session_load().
int sr_dev_trigger_set | ( | const struct sr_dev_inst * | sdi, |
int | probenum, | ||
const char * | trigger | ||
) |
Add a trigger to the specified device (and the specified probe).
If the specified probe of this device already has a trigger, it will be silently replaced.
sdi | Must not be NULL. |
probenum | The probe number, starting from 0. |
trigger | Trigger string, in the format used by sigrok-cli |
Definition at line 159 of file device.c.
References sr_probe::index, sr_dev_inst::probes, SR_ERR_ARG, SR_OK, and sr_probe::trigger.
Referenced by sr_session_load().