libsigrok  0.2.0
sigrok hardware access and backend library
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Groups Pages
Functions
Devices

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)
 
int sr_dev_clear (const struct sr_dev_driver *driver)
 
int sr_dev_open (struct sr_dev_inst *sdi)
 
int sr_dev_close (struct sr_dev_inst *sdi)
 

Detailed Description

Device handling in libsigrok.

Function Documentation

int sr_dev_clear ( const struct sr_dev_driver driver)

Definition at line 356 of file device.c.

References sr_dev_driver::dev_clear, and SR_OK.

int sr_dev_close ( struct sr_dev_inst sdi)

Definition at line 376 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.

Parameters
sdiPointer 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).
keyThe option that should be checked for support on the specified device.
Returns
TRUE if the device has the specified option, FALSE otherwise. FALSE is also returned on invalid input parameters or other error conditions.
Since
0.1.0 (but the API changed in 0.2.0)

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().

+ Here is the caller graph for this function:

GSList* sr_dev_list ( const struct sr_dev_driver driver)

Definition at line 348 of file device.c.

References sr_dev_driver::dev_list.

int sr_dev_open ( struct sr_dev_inst sdi)

Definition at line 364 of file device.c.

References sr_dev_driver::dev_open, sr_dev_inst::driver, and SR_ERR.

Referenced by sr_session_load().

+ Here is the caller graph for this function:

int sr_dev_probe_enable ( const struct sr_dev_inst sdi,
int  probenum,
gboolean  state 
)

Enable or disable a probe on the specified device.

Parameters
sdiThe device instance the probe is connected to.
probenumThe probe number, starting from 0.
stateTRUE to enable the probe, FALSE to disable.
Returns
SR_OK on success, or SR_ERR_ARG on invalid arguments.
Since
0.2.0

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().

+ Here is the caller graph for this function:

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.

Parameters
sdiThe device instance the probe is connected to.
probenumThe number of the probe whose name to set. Note that the probe numbers start at 0.
nameThe new name that the specified probe should get. A copy of the string is made.
Returns
SR_OK on success, or SR_ERR_ARG on invalid arguments.
Since
0.1.0 (but the API changed in 0.2.0)

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().

+ Here is the caller graph for this function:

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.

Parameters
sdiMust not be NULL.
probenumThe probe number, starting from 0.
triggerTrigger string, in the format used by sigrok-cli
Returns
SR_OK on success, or SR_ERR_ARG on invalid arguments.
Since
0.1.0 (but the API changed in 0.2.0)

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().

+ Here is the caller graph for this function: