return NULL;
struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst));
- if (!sdi) {
- sr_err("no possible to allocate sr_dev_inst");
- return NULL;
- }
-
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup("ipdbg.org");
sdi->model = g_strdup("IPDBG LA");
static int dev_open(struct sr_dev_inst *sdi)
{
- sdi->status = SR_ST_INACTIVE;
-
struct ipdbg_la_tcp *tcp = sdi->conn;
if (!tcp)
if (ipdbg_la_tcp_open(tcp) != SR_OK)
return SR_ERR;
- sdi->status = SR_ST_ACTIVE;
-
return SR_OK;
}
static int dev_close(struct sr_dev_inst *sdi)
{
- // Should be called before a new call to scan()
+ /* Should be called before a new call to scan(). */
struct ipdbg_la_tcp *tcp = sdi->conn;
if (tcp)
ipdbg_la_tcp_close(tcp);
sdi->conn = NULL;
- sdi->status = SR_ST_INACTIVE;
return SR_OK;
}
(void)cg;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
switch (key) {
case SR_CONF_CAPTURE_RATIO:
devc->capture_ratio = g_variant_get_uint64(data);
return SR_OK;
}
-static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
-{
- return std_init(di, sr_ctx);
-}
-
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
struct ipdbg_la_tcp *tcp = sdi->conn;
struct dev_context *devc = sdi->priv;
.name = "ipdbg-la",
.longname = "IPDBG LA",
.api_version = 1,
- .init = init,
+ .init = std_init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,