Add helper function for scan completion
A common task during device scan is to add the newly discovered devices to the instance list of the driver. Currently this is done by each driver on its own. This patch introduces a new helper function std_scan_complete() which takes care of this. The function should be called at the end of a driver's scan() callback before returning the device list. Doing this with a helper function provides guaranteed consistent behaviour among drivers and hopefully paves the way to moving more standard functionality directly into the sigrok core. Another common task that every driver has to do for each device instance is to initialize the device's driver field. So this is done in the new helper function as well. All drivers that can make use of the new helper are updated. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
566007e15e
commit
15a5bfe481
|
@ -73,7 +73,6 @@ static const struct agdmm_profile supported_agdmm[] = {
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
@ -82,8 +81,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
const char *conn, *serialcomm;
|
const char *conn, *serialcomm;
|
||||||
char *buf, **tokens;
|
char *buf, **tokens;
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
conn = serialcomm = NULL;
|
conn = serialcomm = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
|
@ -136,9 +133,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +145,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_serial_dev_inst_free(serial);
|
sr_serial_dev_inst_free(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -99,18 +99,16 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "T1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "T1");
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "T2");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "T2");
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
scan_cleanup:
|
scan_cleanup:
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -130,7 +130,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->vendor = g_strdup("Arachnid Labs");
|
sdi->vendor = g_strdup("Arachnid Labs");
|
||||||
sdi->model = g_strdup("Re:load Pro");
|
sdi->model = g_strdup("Re:load Pro");
|
||||||
sdi->version = g_strdup(buf + 8);
|
sdi->version = g_strdup(buf + 8);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
|
|
||||||
|
@ -146,14 +145,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_serial_dev_inst_free(serial);
|
sr_serial_dev_inst_free(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(uint32_t key, GVariant **data,
|
static int config_list(uint32_t key, GVariant **data,
|
||||||
|
|
|
@ -64,7 +64,6 @@ static int dev_clear(const struct sr_dev_driver *di)
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
struct ftdi_device_list *devlist;
|
struct ftdi_device_list *devlist;
|
||||||
|
@ -75,8 +74,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
(void)options;
|
(void)options;
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
|
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
|
@ -119,19 +116,17 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->status = SR_ST_INITIALIZING;
|
sdi->status = SR_ST_INITIALIZING;
|
||||||
sdi->vendor = g_strdup(USB_VENDOR_NAME);
|
sdi->vendor = g_strdup(USB_VENDOR_NAME);
|
||||||
sdi->model = g_strdup(USB_MODEL_NAME);
|
sdi->model = g_strdup(USB_MODEL_NAME);
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(channel_names); i++)
|
for (i = 0; i < ARRAY_SIZE(channel_names); i++)
|
||||||
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
|
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
|
||||||
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
/* We will open the device again when we need it. */
|
/* We will open the device again when we need it. */
|
||||||
ftdi_list_free(&devlist);
|
ftdi_list_free(&devlist);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
|
|
||||||
free:
|
free:
|
||||||
ftdi_deinit(&devc->ftdic);
|
ftdi_deinit(&devc->ftdic);
|
||||||
|
|
|
@ -158,7 +158,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->vendor = g_strdup("Atten");
|
sdi->vendor = g_strdup("Atten");
|
||||||
sdi->model = g_strdup(model->name);
|
sdi->model = g_strdup(model->name);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
for (i = 0; i < MAX_CHANNELS; i++) {
|
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||||
|
@ -176,14 +175,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
|
||||||
devc->config = g_malloc0(sizeof(struct per_channel_config) * model->num_channels);
|
devc->config = g_malloc0(sizeof(struct per_channel_config) * model->num_channels);
|
||||||
devc->delay_ms = delay_ms;
|
devc->delay_ms = delay_ms;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_serial_dev_inst_free(serial);
|
sr_serial_dev_inst_free(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *scan_3203(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan_3203(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
|
@ -53,7 +53,6 @@ static const uint64_t samplerates[] = {
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
|
@ -62,7 +61,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
(void)options;
|
(void)options;
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
|
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
|
@ -72,7 +70,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->vendor = g_strdup("BayLibre");
|
sdi->vendor = g_strdup("BayLibre");
|
||||||
sdi->model = g_strdup("ACME");
|
sdi->model = g_strdup("ACME");
|
||||||
sdi->driver = di;
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
status = bl_acme_is_sane();
|
status = bl_acme_is_sane();
|
||||||
|
@ -124,9 +121,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
g_free(devc);
|
g_free(devc);
|
||||||
|
|
|
@ -73,7 +73,6 @@ static struct dev_context *beaglelogic_devc_alloc(void)
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
|
||||||
GSList *devices, *l;
|
GSList *devices, *l;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
|
@ -81,7 +80,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
int i, maxch;
|
int i, maxch;
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
/* Probe for /dev/beaglelogic */
|
/* Probe for /dev/beaglelogic */
|
||||||
if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
|
if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
|
||||||
|
@ -91,7 +89,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->model = g_strdup("BeagleLogic");
|
sdi->model = g_strdup("BeagleLogic");
|
||||||
sdi->version = g_strdup("1.0");
|
sdi->version = g_strdup("1.0");
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
/* Unless explicitly specified, keep max channels to 8 only */
|
/* Unless explicitly specified, keep max channels to 8 only */
|
||||||
maxch = 8;
|
maxch = 8;
|
||||||
|
@ -131,10 +128,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
channel_names[i]);
|
channel_names[i]);
|
||||||
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -70,7 +70,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->model = g_strdup("BM869");
|
sdi->model = g_strdup("BM869");
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P2");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P2");
|
||||||
|
|
||||||
|
@ -79,11 +78,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
sr_sw_limits_init(&devc->sw_limits);
|
sr_sw_limits_init(&devc->sw_limits);
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -37,7 +37,6 @@ static GSList *brymen_scan(struct sr_dev_driver *di, const char *conn,
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -75,17 +74,14 @@ static GSList *brymen_scan(struct sr_dev_driver *di, const char *conn,
|
||||||
sr_sw_limits_init(&devc->sw_limits);
|
sr_sw_limits_init(&devc->sw_limits);
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
drvc = di->context;
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
scan_cleanup:
|
scan_cleanup:
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
|
@ -114,9 +114,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->conn = sr_serial_dev_inst_new(conn, SERIALCOMM);
|
sdi->conn = sr_serial_dev_inst_new(conn, SERIALCOMM);
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +124,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -60,7 +60,6 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
|
@ -70,7 +69,6 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
|
||||||
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
|
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
drvc = center_devs[idx].di->context;
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
serial_flush(serial);
|
serial_flush(serial);
|
||||||
|
|
||||||
|
@ -84,12 +82,10 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = center_devs[idx].di;
|
|
||||||
|
|
||||||
for (i = 0; i < center_devs[idx].num_channels; i++)
|
for (i = 0; i < center_devs[idx].num_channels; i++)
|
||||||
sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
|
sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
@ -126,7 +122,7 @@ static GSList *scan(GSList *options, int idx)
|
||||||
devices = center_scan(conn, center_devs[idx].conn, idx);
|
devices = center_scan(conn, center_devs[idx].conn, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(center_devs[idx].di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -61,20 +61,17 @@ static int dev_clear(const struct sr_dev_driver *di)
|
||||||
return std_dev_clear(di, clear_helper);
|
return std_dev_clear(di, clear_helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_device(struct sr_dev_driver *di, int model,
|
static int add_device(int model, struct libusb_device_descriptor *des,
|
||||||
struct libusb_device_descriptor *des, const char *serial_num,
|
const char *serial_num, const char *connection_id, libusb_device *usbdev,
|
||||||
const char *connection_id, libusb_device *usbdev, GSList **devices)
|
GSList **devices)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
/* Allocate memory for our private device context. */
|
/* Allocate memory for our private device context. */
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
|
|
||||||
|
@ -116,7 +113,6 @@ static int add_device(struct sr_dev_driver *di, int model,
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(usbdev),
|
sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(usbdev),
|
||||||
libusb_get_device_address(usbdev), NULL);
|
libusb_get_device_address(usbdev), NULL);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
for (i = 0; i < devc->prof->num_channels; i++)
|
for (i = 0; i < devc->prof->num_channels; i++)
|
||||||
|
@ -124,7 +120,6 @@ static int add_device(struct sr_dev_driver *di, int model,
|
||||||
cv_channel_names[i]);
|
cv_channel_names[i]);
|
||||||
|
|
||||||
*devices = g_slist_append(*devices, sdi);
|
*devices = g_slist_append(*devices, sdi);
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
|
|
||||||
if (ret == SR_OK)
|
if (ret == SR_OK)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
@ -224,7 +219,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
libusb_get_bus_number(devlist[i]),
|
libusb_get_bus_number(devlist[i]),
|
||||||
libusb_get_device_address(devlist[i]), connection_id);
|
libusb_get_device_address(devlist[i]), connection_id);
|
||||||
|
|
||||||
if ((ret = add_device(di, model, &des, serial_num, connection_id,
|
if ((ret = add_device(model, &des, serial_num, connection_id,
|
||||||
devlist[i], &devices)) < 0) {
|
devlist[i], &devices)) < 0) {
|
||||||
sr_dbg("Failed to add device: %d.", ret);
|
sr_dbg("Failed to add device: %d.", ret);
|
||||||
}
|
}
|
||||||
|
@ -233,7 +228,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
|
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -44,15 +44,12 @@ static const uint32_t devopts[] = {
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
GSList *devices, *l;
|
GSList *devices, *l;
|
||||||
const char *conn, *serialcomm;
|
const char *conn, *serialcomm;
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
|
|
||||||
conn = serialcomm = NULL;
|
conn = serialcomm = NULL;
|
||||||
|
@ -81,12 +78,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->conn = sr_serial_dev_inst_new(conn, serialcomm);
|
sdi->conn = sr_serial_dev_inst_new(conn, serialcomm);
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -90,12 +90,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->model = g_strdup("DIGI 35 CPU");
|
sdi->model = g_strdup("DIGI 35 CPU");
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = NULL;
|
sdi->priv = NULL;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -284,7 +284,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->model = g_strdup("Demo device");
|
sdi->model = g_strdup("Demo device");
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
devc->cur_samplerate = SR_KHZ(200);
|
devc->cur_samplerate = SR_KHZ(200);
|
||||||
|
@ -346,9 +345,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -25,16 +25,6 @@
|
||||||
#include <libsigrok/libsigrok.h>
|
#include <libsigrok/libsigrok.h>
|
||||||
#include "libsigrok-internal.h"
|
#include "libsigrok-internal.h"
|
||||||
|
|
||||||
static void std_dev_attach(struct sr_dev_driver *di, struct sr_dev_inst *sdi)
|
|
||||||
{
|
|
||||||
struct drv_context *drvc;
|
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
sdi->driver = di;
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define LOG_PREFIX "deree-de5000"
|
#define LOG_PREFIX "deree-de5000"
|
||||||
|
|
||||||
static int dev_clear(const struct sr_dev_driver *di)
|
static int dev_clear(const struct sr_dev_driver *di)
|
||||||
|
@ -49,9 +39,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
if (!(sdi = es51919_serial_scan(options, "DER EE", "DE-5000")))
|
if (!(sdi = es51919_serial_scan(options, "DER EE", "DE-5000")))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
std_dev_attach(di, sdi);
|
return std_scan_complete(di, g_slist_append(NULL, sdi));
|
||||||
|
|
||||||
return g_slist_append(NULL, sdi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sr_dev_driver deree_de5000_driver_info = {
|
static struct sr_dev_driver deree_de5000_driver_info = {
|
||||||
|
|
|
@ -124,9 +124,7 @@ static GSList *fluke_scan(struct sr_dev_driver *di, const char *conn,
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +138,7 @@ static GSList *fluke_scan(struct sr_dev_driver *di, const char *conn,
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_serial_dev_inst_free(serial);
|
sr_serial_dev_inst_free(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
|
@ -82,7 +82,7 @@ static const struct ftdi_chip_desc *chip_descs[] = {
|
||||||
&ft232r_desc,
|
&ft232r_desc,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void scan_device(struct sr_dev_driver *di, struct ftdi_context *ftdic,
|
static void scan_device(struct ftdi_context *ftdic,
|
||||||
struct libusb_device *dev, GSList **devices)
|
struct libusb_device *dev, GSList **devices)
|
||||||
{
|
{
|
||||||
struct libusb_device_descriptor usb_desc;
|
struct libusb_device_descriptor usb_desc;
|
||||||
|
@ -90,10 +90,8 @@ static void scan_device(struct sr_dev_driver *di, struct ftdi_context *ftdic,
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
char *vendor, *model, *serial_num;
|
char *vendor, *model, *serial_num;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
libusb_get_device_descriptor(dev, &usb_desc);
|
libusb_get_device_descriptor(dev, &usb_desc);
|
||||||
|
|
||||||
desc = NULL;
|
desc = NULL;
|
||||||
|
@ -143,7 +141,6 @@ static void scan_device(struct sr_dev_driver *di, struct ftdi_context *ftdic,
|
||||||
sdi->vendor = vendor;
|
sdi->vendor = vendor;
|
||||||
sdi->model = model;
|
sdi->model = model;
|
||||||
sdi->serial_num = serial_num;
|
sdi->serial_num = serial_num;
|
||||||
sdi->driver = di;
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->connection_id = g_strdup_printf("d:%u/%u",
|
sdi->connection_id = g_strdup_printf("d:%u/%u",
|
||||||
libusb_get_bus_number(dev), libusb_get_device_address(dev));
|
libusb_get_bus_number(dev), libusb_get_device_address(dev));
|
||||||
|
@ -153,7 +150,6 @@ static void scan_device(struct sr_dev_driver *di, struct ftdi_context *ftdic,
|
||||||
SR_CHANNEL_LOGIC, TRUE, *chan);
|
SR_CHANNEL_LOGIC, TRUE, *chan);
|
||||||
|
|
||||||
*devices = g_slist_append(*devices, sdi);
|
*devices = g_slist_append(*devices, sdi);
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err_free_strings:
|
err_free_strings:
|
||||||
|
@ -164,8 +160,7 @@ err_free_strings:
|
||||||
g_free(devc);
|
g_free(devc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *scan_all(struct ftdi_context *ftdic, struct sr_dev_driver *di,
|
static GSList *scan_all(struct ftdi_context *ftdic, GSList *options)
|
||||||
GSList *options)
|
|
||||||
{
|
{
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
struct ftdi_device_list *devlist = 0;
|
struct ftdi_device_list *devlist = 0;
|
||||||
|
@ -187,7 +182,7 @@ static GSList *scan_all(struct ftdi_context *ftdic, struct sr_dev_driver *di,
|
||||||
|
|
||||||
curdev = devlist;
|
curdev = devlist;
|
||||||
while (curdev) {
|
while (curdev) {
|
||||||
scan_device(di, ftdic, curdev->dev, &devices);
|
scan_device(ftdic, curdev->dev, &devices);
|
||||||
curdev = curdev->next;
|
curdev = curdev->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,17 +229,17 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
usb = l->data;
|
usb = l->data;
|
||||||
if (usb->bus == libusb_get_bus_number(devlist[i])
|
if (usb->bus == libusb_get_bus_number(devlist[i])
|
||||||
&& usb->address == libusb_get_device_address(devlist[i])) {
|
&& usb->address == libusb_get_device_address(devlist[i])) {
|
||||||
scan_device(di, ftdic, devlist[i], &devices);
|
scan_device(ftdic, devlist[i], &devices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
} else
|
} else
|
||||||
devices = scan_all(ftdic, di, options);
|
devices = scan_all(ftdic, options);
|
||||||
|
|
||||||
ftdi_free(ftdic);
|
ftdi_free(ftdic);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_helper(void *priv)
|
static void clear_helper(void *priv)
|
||||||
|
|
|
@ -323,7 +323,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->vendor = g_strdup(prof->vendor);
|
sdi->vendor = g_strdup(prof->vendor);
|
||||||
sdi->model = g_strdup(prof->model);
|
sdi->model = g_strdup(prof->model);
|
||||||
sdi->version = g_strdup(prof->model_version);
|
sdi->version = g_strdup(prof->model_version);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->serial_num = g_strdup(serial_num);
|
sdi->serial_num = g_strdup(serial_num);
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
|
|
||||||
|
@ -359,7 +358,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
if ((prof->dev_caps & DEV_CAPS_16BIT) || (prof->dev_caps & DEV_CAPS_AX_ANALOG))
|
if ((prof->dev_caps & DEV_CAPS_16BIT) || (prof->dev_caps & DEV_CAPS_AX_ANALOG))
|
||||||
devc->sample_wide = TRUE;
|
devc->sample_wide = TRUE;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
if (!strcmp(prof->model, "DSLogic")
|
if (!strcmp(prof->model, "DSLogic")
|
||||||
|
@ -403,7 +401,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
|
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_dev_context(void *priv)
|
static void clear_dev_context(void *priv)
|
||||||
|
|
|
@ -217,13 +217,11 @@ static GSList *scan_1x_2x_rs232(struct sr_dev_driver *di, GSList *options)
|
||||||
devc->settings_ok = FALSE;
|
devc->settings_ok = FALSE;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -310,9 +308,7 @@ static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->version = g_strdup_printf("Firmware %d.%d", devc->fw_ver_maj, devc->fw_ver_min);
|
sdi->version = g_strdup_printf("Firmware %d.%d", devc->fw_ver_maj, devc->fw_ver_min);
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||||
|
@ -327,7 +323,7 @@ static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options)
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
|
|
||||||
exit_err:
|
exit_err:
|
||||||
sr_info("scan_2x_bd232(): Error!");
|
sr_info("scan_2x_bd232(): Error!");
|
||||||
|
|
|
@ -78,13 +78,11 @@ static int read_channel(const struct sr_dev_inst *sdi, uint32_t amount);
|
||||||
|
|
||||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
static struct sr_dev_inst *hantek_6xxx_dev_new(struct sr_dev_driver *di,
|
static struct sr_dev_inst *hantek_6xxx_dev_new(const struct hantek_6xxx_profile *prof)
|
||||||
const struct hantek_6xxx_profile *prof)
|
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct sr_channel *ch;
|
struct sr_channel *ch;
|
||||||
struct sr_channel_group *cg;
|
struct sr_channel_group *cg;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -92,7 +90,6 @@ static struct sr_dev_inst *hantek_6xxx_dev_new(struct sr_dev_driver *di,
|
||||||
sdi->status = SR_ST_INITIALIZING;
|
sdi->status = SR_ST_INITIALIZING;
|
||||||
sdi->vendor = g_strdup(prof->vendor);
|
sdi->vendor = g_strdup(prof->vendor);
|
||||||
sdi->model = g_strdup(prof->model);
|
sdi->model = g_strdup(prof->model);
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
|
for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
|
||||||
ch = sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
|
ch = sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
|
||||||
|
@ -119,8 +116,6 @@ static struct sr_dev_inst *hantek_6xxx_dev_new(struct sr_dev_driver *di,
|
||||||
devc->samplerate = DEFAULT_SAMPLERATE;
|
devc->samplerate = DEFAULT_SAMPLERATE;
|
||||||
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
drvc = sdi->driver->context;
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
|
|
||||||
return sdi;
|
return sdi;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +217,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
/* Device matches the pre-firmware profile. */
|
/* Device matches the pre-firmware profile. */
|
||||||
prof = &dev_profiles[j];
|
prof = &dev_profiles[j];
|
||||||
sr_dbg("Found a %s %s.", prof->vendor, prof->model);
|
sr_dbg("Found a %s %s.", prof->vendor, prof->model);
|
||||||
sdi = hantek_6xxx_dev_new(di, prof);
|
sdi = hantek_6xxx_dev_new(prof);
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
@ -241,7 +236,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
/* Device matches the post-firmware profile. */
|
/* Device matches the post-firmware profile. */
|
||||||
prof = &dev_profiles[j];
|
prof = &dev_profiles[j];
|
||||||
sr_dbg("Found a %s %s.", prof->vendor, prof->model);
|
sr_dbg("Found a %s %s.", prof->vendor, prof->model);
|
||||||
sdi = hantek_6xxx_dev_new(di, prof);
|
sdi = hantek_6xxx_dev_new(prof);
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
@ -258,7 +253,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
}
|
}
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -162,13 +162,11 @@ static const char *coupling[] = {
|
||||||
|
|
||||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
static struct sr_dev_inst *dso_dev_new(struct sr_dev_driver *di,
|
static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
|
||||||
const struct dso_profile *prof)
|
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct sr_channel *ch;
|
struct sr_channel *ch;
|
||||||
struct sr_channel_group *cg;
|
struct sr_channel_group *cg;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -176,7 +174,6 @@ static struct sr_dev_inst *dso_dev_new(struct sr_dev_driver *di,
|
||||||
sdi->status = SR_ST_INITIALIZING;
|
sdi->status = SR_ST_INITIALIZING;
|
||||||
sdi->vendor = g_strdup(prof->vendor);
|
sdi->vendor = g_strdup(prof->vendor);
|
||||||
sdi->model = g_strdup(prof->model);
|
sdi->model = g_strdup(prof->model);
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add only the real channels -- EXT isn't a source of data, only
|
* Add only the real channels -- EXT isn't a source of data, only
|
||||||
|
@ -208,8 +205,6 @@ static struct sr_dev_inst *dso_dev_new(struct sr_dev_driver *di,
|
||||||
devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE);
|
devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE);
|
||||||
devc->triggerposition = DEFAULT_HORIZ_TRIGGERPOS;
|
devc->triggerposition = DEFAULT_HORIZ_TRIGGERPOS;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
drvc = di->context;
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
|
|
||||||
return sdi;
|
return sdi;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +308,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
/* Device matches the pre-firmware profile. */
|
/* Device matches the pre-firmware profile. */
|
||||||
prof = &dev_profiles[j];
|
prof = &dev_profiles[j];
|
||||||
sr_dbg("Found a %s %s.", prof->vendor, prof->model);
|
sr_dbg("Found a %s %s.", prof->vendor, prof->model);
|
||||||
sdi = dso_dev_new(di, prof);
|
sdi = dso_dev_new(prof);
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
@ -332,7 +327,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
/* Device matches the post-firmware profile. */
|
/* Device matches the post-firmware profile. */
|
||||||
prof = &dev_profiles[j];
|
prof = &dev_profiles[j];
|
||||||
sr_dbg("Found a %s %s.", prof->vendor, prof->model);
|
sr_dbg("Found a %s %s.", prof->vendor, prof->model);
|
||||||
sdi = dso_dev_new(di, prof);
|
sdi = dso_dev_new(prof);
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
@ -349,7 +344,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
}
|
}
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -102,14 +102,12 @@ static const uint8_t coupling_map[] = {
|
||||||
0x00, 0x08, 0x04
|
0x00, 0x08, 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
static GSList *scan_port(GSList *devices, struct sr_dev_driver *di,
|
static GSList *scan_port(GSList *devices, struct parport *port)
|
||||||
struct parport *port)
|
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct sr_channel *ch;
|
struct sr_channel *ch;
|
||||||
struct sr_channel_group *cg;
|
struct sr_channel_group *cg;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct drv_context *drvc;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ieee1284_open(port, 0, &i) != E1284_OK) {
|
if (ieee1284_open(port, 0, &i) != E1284_OK) {
|
||||||
|
@ -135,8 +133,6 @@ static GSList *scan_port(GSList *devices, struct sr_dev_driver *di,
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->vendor = g_strdup("Hung-Chang");
|
sdi->vendor = g_strdup("Hung-Chang");
|
||||||
sdi->model = g_strdup("DSO-2100");
|
sdi->model = g_strdup("DSO-2100");
|
||||||
sdi->driver = di;
|
|
||||||
drvc = di->context;
|
|
||||||
sdi->inst_type = 0; /* FIXME */
|
sdi->inst_type = 0; /* FIXME */
|
||||||
sdi->conn = port;
|
sdi->conn = port;
|
||||||
ieee1284_ref(port);
|
ieee1284_ref(port);
|
||||||
|
@ -169,7 +165,6 @@ static GSList *scan_port(GSList *devices, struct sr_dev_driver *di,
|
||||||
devc->last_step = 0; /* buffersize = 1000 */
|
devc->last_step = 0; /* buffersize = 1000 */
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
fail3:
|
fail3:
|
||||||
|
@ -209,7 +204,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
for (i = 0; i < ports.portc; i++)
|
for (i = 0; i < ports.portc; i++)
|
||||||
if (!strcmp(ports.portv[i]->name, conn)) {
|
if (!strcmp(ports.portv[i]->name, conn)) {
|
||||||
port_found = TRUE;
|
port_found = TRUE;
|
||||||
devices = scan_port(devices, di, ports.portv[i]);
|
devices = scan_port(devices, ports.portv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!port_found) {
|
if (!port_found) {
|
||||||
|
@ -220,7 +215,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
ieee1284_free_ports(&ports);
|
ieee1284_free_ports(&ports);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_private(void *priv)
|
static void clear_private(void *priv)
|
||||||
|
|
|
@ -106,7 +106,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->version = g_strdup_printf("%u.%u", dev_info.fw_ver_major, dev_info.fw_ver_minor);
|
sdi->version = g_strdup_printf("%u.%u", dev_info.fw_ver_major, dev_info.fw_ver_minor);
|
||||||
sdi->serial_num = g_strdup_printf("%d", dev_info.serial);
|
sdi->serial_num = g_strdup_printf("%d", dev_info.serial);
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sdi->inst_type = SR_INST_USB;
|
sdi->inst_type = SR_INST_USB;
|
||||||
sdi->conn = usb;
|
sdi->conn = usb;
|
||||||
|
|
||||||
|
@ -145,13 +144,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
devc->xfer_data_out = devc->xfer_buf_out +
|
devc->xfer_data_out = devc->xfer_buf_out +
|
||||||
LIBUSB_CONTROL_SETUP_SIZE;
|
LIBUSB_CONTROL_SETUP_SIZE;
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slist_free(usb_devices);
|
g_slist_free(usb_devices);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_dev_context(void *priv)
|
static void clear_dev_context(void *priv)
|
||||||
|
|
|
@ -115,19 +115,17 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->vendor = g_strdup(USB_VENDOR_NAME);
|
sdi->vendor = g_strdup(USB_VENDOR_NAME);
|
||||||
sdi->model = g_strdup(USB_MODEL_NAME);
|
sdi->model = g_strdup(USB_MODEL_NAME);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(channel_names); i++)
|
for (i = 0; i < ARRAY_SIZE(channel_names); i++)
|
||||||
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
|
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
|
||||||
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
|
|
||||||
/* Close device. We'll reopen it again when we need it. */
|
/* Close device. We'll reopen it again when we need it. */
|
||||||
scanaplus_close(devc);
|
scanaplus_close(devc);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
|
|
||||||
scanaplus_close(devc);
|
scanaplus_close(devc);
|
||||||
err_free_ftdic:
|
err_free_ftdic:
|
||||||
|
|
|
@ -124,7 +124,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->vendor = g_strdup(VENDOR);
|
sdi->vendor = g_strdup(VENDOR);
|
||||||
sdi->model = model; /* Already g_strndup()'d. */
|
sdi->model = model; /* Already g_strndup()'d. */
|
||||||
sdi->driver = di;
|
|
||||||
sdi->inst_type = SR_INST_USB;
|
sdi->inst_type = SR_INST_USB;
|
||||||
sdi->conn = l->data;
|
sdi->conn = l->data;
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL");
|
||||||
|
@ -142,14 +141,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
/* TODO: Set date/time? */
|
/* TODO: Set date/time? */
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
g_slist_free(usb_devices);
|
g_slist_free(usb_devices);
|
||||||
} else
|
} else
|
||||||
g_slist_free_full(usb_devices, g_free);
|
g_slist_free_full(usb_devices, g_free);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -43,7 +43,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
GSList *l, *devices;
|
GSList *l, *devices;
|
||||||
const char *conn, *serialcomm;
|
const char *conn, *serialcomm;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -77,7 +76,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
sr_info("Probing serial port %s.", conn);
|
sr_info("Probing serial port %s.", conn);
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
serial_flush(serial);
|
serial_flush(serial);
|
||||||
|
|
||||||
|
@ -104,15 +102,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "Mass");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "Mass");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
scan_cleanup:
|
scan_cleanup:
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -64,7 +64,6 @@ static const struct korad_kaxxxxp_model models[] = {
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GSList *devices, *l;
|
GSList *devices, *l;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
|
@ -78,7 +77,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
serialcomm = NULL;
|
serialcomm = NULL;
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
|
@ -140,7 +138,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->model = g_strdup(models[model_id].name);
|
sdi->model = g_strdup(models[model_id].name);
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
|
||||||
|
|
||||||
|
@ -154,14 +151,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
/* Get current status of device. */
|
/* Get current status of device. */
|
||||||
if (korad_kaxxxxp_get_all_values(serial, devc) < 0)
|
if (korad_kaxxxxp_get_all_values(serial, devc) < 0)
|
||||||
goto exit_err;
|
goto exit_err;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_serial_dev_inst_free(serial);
|
sr_serial_dev_inst_free(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
|
|
||||||
exit_err:
|
exit_err:
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
|
|
|
@ -72,14 +72,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
}
|
}
|
||||||
sdi->inst_type = SR_INST_USB;
|
sdi->inst_type = SR_INST_USB;
|
||||||
sdi->conn = usb;
|
sdi->conn = usb;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
g_slist_free(usb_devices);
|
g_slist_free(usb_devices);
|
||||||
} else
|
} else
|
||||||
g_slist_free_full(usb_devices, g_free);
|
g_slist_free_full(usb_devices, g_free);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -327,7 +327,6 @@ static struct sr_dev_inst *lascar_identify(unsigned char *config)
|
||||||
sdi->vendor = g_strdup(LASCAR_VENDOR);
|
sdi->vendor = g_strdup(LASCAR_VENDOR);
|
||||||
sdi->model = g_strdup(profile->modelname);
|
sdi->model = g_strdup(profile->modelname);
|
||||||
sdi->version = g_strdup(firmware);
|
sdi->version = g_strdup(firmware);
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
if (profile->logformat == LOG_TEMP_RH) {
|
if (profile->logformat == LOG_TEMP_RH) {
|
||||||
/* Model this as two channels: temperature and humidity. */
|
/* Model this as two channels: temperature and humidity. */
|
||||||
|
|
|
@ -71,9 +71,8 @@ static const uint64_t samplerates[] = {
|
||||||
SR_MHZ(500),
|
SR_MHZ(500),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sr_dev_inst *create_device(struct sr_dev_driver *di,
|
static struct sr_dev_inst *create_device(struct sr_usb_dev_inst *usb,
|
||||||
struct sr_usb_dev_inst *usb, enum sr_dev_inst_status status,
|
enum sr_dev_inst_status status, int64_t fw_updated)
|
||||||
int64_t fw_updated)
|
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
@ -84,7 +83,6 @@ static struct sr_dev_inst *create_device(struct sr_dev_driver *di,
|
||||||
sdi->status = status;
|
sdi->status = status;
|
||||||
sdi->vendor = g_strdup("LeCroy");
|
sdi->vendor = g_strdup("LeCroy");
|
||||||
sdi->model = g_strdup("LogicStudio16");
|
sdi->model = g_strdup("LogicStudio16");
|
||||||
sdi->driver = di;
|
|
||||||
sdi->inst_type = SR_INST_USB;
|
sdi->inst_type = SR_INST_USB;
|
||||||
sdi->conn = usb;
|
sdi->conn = usb;
|
||||||
|
|
||||||
|
@ -140,7 +138,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
usb = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
|
usb = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
|
||||||
libusb_get_device_address(devlist[i]), NULL);
|
libusb_get_device_address(devlist[i]), NULL);
|
||||||
|
|
||||||
sdi = create_device(di, usb, SR_ST_INACTIVE, 0);
|
sdi = create_device(usb, SR_ST_INACTIVE, 0);
|
||||||
break;
|
break;
|
||||||
case LOGICSTUDIO16_PID_LACK_FIRMWARE:
|
case LOGICSTUDIO16_PID_LACK_FIRMWARE:
|
||||||
r = ezusb_upload_firmware(drvc->sr_ctx, devlist[i],
|
r = ezusb_upload_firmware(drvc->sr_ctx, devlist[i],
|
||||||
|
@ -161,7 +159,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
usb = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
|
usb = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
|
||||||
UNKNOWN_ADDRESS, NULL);
|
UNKNOWN_ADDRESS, NULL);
|
||||||
|
|
||||||
sdi = create_device(di, usb, SR_ST_INITIALIZING,
|
sdi = create_device(usb, SR_ST_INITIALIZING,
|
||||||
g_get_monotonic_time());
|
g_get_monotonic_time());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -174,13 +172,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int open_device(struct sr_dev_inst *sdi)
|
static int open_device(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -159,21 +159,15 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->vendor = g_strdup(manufacturer);
|
sdi->vendor = g_strdup(manufacturer);
|
||||||
sdi->model = g_strdup(product);
|
sdi->model = g_strdup(product);
|
||||||
sdi->version = g_strdup(hwrev);
|
sdi->version = g_strdup(hwrev);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
|
for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
|
||||||
chtype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC;
|
chtype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC;
|
||||||
sr_channel_new(sdi, i, chtype, TRUE, channel_names[i]);
|
sr_channel_new(sdi, i, chtype, TRUE, channel_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add the driver
|
|
||||||
struct drv_context *drvc = di->context;
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -76,7 +76,6 @@ static const struct hcs_model models[] = {
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
int i, model_id;
|
int i, model_id;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
|
@ -85,7 +84,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
char reply[50], **tokens, *dummy;
|
char reply[50], **tokens, *dummy;
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
serialcomm = NULL;
|
serialcomm = NULL;
|
||||||
|
@ -146,7 +144,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->model = g_strdup(models[model_id].name);
|
sdi->model = g_strdup(models[model_id].name);
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
|
||||||
|
|
||||||
|
@ -177,14 +174,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
devc->voltage_max_device = g_strtod(tokens[0], &dummy) * devc->model->voltage[2];
|
devc->voltage_max_device = g_strtod(tokens[0], &dummy) * devc->model->voltage[2];
|
||||||
g_strfreev(tokens);
|
g_strfreev(tokens);
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_serial_dev_inst_free(serial);
|
sr_serial_dev_inst_free(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
|
|
||||||
exit_err:
|
exit_err:
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
|
|
|
@ -60,7 +60,6 @@ SR_PRIV const struct mic_dev_info mic_devs[] = {
|
||||||
static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
|
static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
|
@ -70,7 +69,6 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
|
||||||
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
|
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
drvc = mic_devs[idx].di->context;
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
serial_flush(serial);
|
serial_flush(serial);
|
||||||
|
|
||||||
|
@ -89,19 +87,17 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = mic_devs[idx].di;
|
|
||||||
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "Temperature");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "Temperature");
|
||||||
|
|
||||||
if (mic_devs[idx].has_humidity)
|
if (mic_devs[idx].has_humidity)
|
||||||
sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "Humidity");
|
sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "Humidity");
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(mic_devs[idx].di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *scan(GSList *options, int idx)
|
static GSList *scan(GSList *options, int idx)
|
||||||
|
|
|
@ -366,7 +366,6 @@ SR_PRIV int lps_read_reply(struct sr_serial_dev_inst *serial, char **buf, int *b
|
||||||
static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *options)
|
static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *options)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
struct sr_channel *ch;
|
struct sr_channel *ch;
|
||||||
|
@ -383,8 +382,6 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
|
||||||
conn = serialcomm = NULL;
|
conn = serialcomm = NULL;
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
|
|
||||||
drvc = drv->context;
|
|
||||||
|
|
||||||
sr_spew("scan() called!");
|
sr_spew("scan() called!");
|
||||||
|
|
||||||
/* Process and check options. */
|
/* Process and check options. */
|
||||||
|
@ -446,7 +443,6 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
|
||||||
sdi->vendor = g_strdup(VENDOR_MOTECH);
|
sdi->vendor = g_strdup(VENDOR_MOTECH);
|
||||||
sdi->model = g_strdup(models[modelid].modelstr);
|
sdi->model = g_strdup(models[modelid].modelstr);
|
||||||
sdi->version = g_strdup(verstr);
|
sdi->version = g_strdup(verstr);
|
||||||
sdi->driver = drv;
|
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
|
|
||||||
|
@ -472,7 +468,6 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
|
||||||
sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
|
sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
|
||||||
}
|
}
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
/* Query status */
|
/* Query status */
|
||||||
|
@ -483,7 +478,7 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_serial_dev_inst_free(serial);
|
sr_serial_dev_inst_free(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(drv, devices);
|
||||||
|
|
||||||
exit_err:
|
exit_err:
|
||||||
sr_info("%s: Error!", __func__);
|
sr_info("%s: Error!", __func__);
|
||||||
|
|
|
@ -68,7 +68,6 @@ static const char *get_typestr(int type, struct sr_dev_driver *drv)
|
||||||
static GSList *scan(struct sr_dev_driver *drv, GSList *options)
|
static GSList *scan(struct sr_dev_driver *drv, GSList *options)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
@ -79,7 +78,6 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
|
||||||
char req[10];
|
char req[10];
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
drvc = drv->context;
|
|
||||||
conn = serialcomm = NULL;
|
conn = serialcomm = NULL;
|
||||||
|
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
|
@ -138,9 +136,7 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
|
||||||
devc->version = g_strdup(&buf[9]);
|
devc->version = g_strdup(&buf[9]);
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = drv;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +159,7 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_serial_dev_inst_free(serial);
|
sr_serial_dev_inst_free(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(drv, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_close(struct sr_dev_inst *sdi)
|
static int dev_close(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -89,7 +89,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
GSList *l, *devices;
|
GSList *l, *devices;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -97,8 +96,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
const char *conn, *serialcomm;
|
const char *conn, *serialcomm;
|
||||||
char buf[8];
|
char buf[8];
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
|
|
||||||
conn = serialcomm = NULL;
|
conn = serialcomm = NULL;
|
||||||
|
@ -182,7 +179,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->vendor = g_strdup("Sump");
|
sdi->vendor = g_strdup("Sump");
|
||||||
sdi->model = g_strdup("Logic Analyzer");
|
sdi->model = g_strdup("Logic Analyzer");
|
||||||
sdi->version = g_strdup("v1.0");
|
sdi->version = g_strdup("v1.0");
|
||||||
sdi->driver = di;
|
|
||||||
for (i = 0; i < ARRAY_SIZE(ols_channel_names); i++)
|
for (i = 0; i < ARRAY_SIZE(ols_channel_names); i++)
|
||||||
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
|
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
|
||||||
ols_channel_names[i]);
|
ols_channel_names[i]);
|
||||||
|
@ -195,12 +191,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
|
@ -570,7 +565,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_driver ols_driver_info = {
|
static struct sr_dev_driver ols_driver_info = {
|
||||||
.name = "ols",
|
.name = "ols",
|
||||||
.longname = "Openbench Logic Sniffer",
|
.longname = "Openbench Logic Sniffer",
|
||||||
.api_version = 1,
|
.api_version = 1,
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
extern SR_PRIV struct sr_dev_driver ols_driver_info;
|
|
||||||
|
|
||||||
SR_PRIV int send_shortcommand(struct sr_serial_dev_inst *serial,
|
SR_PRIV int send_shortcommand(struct sr_serial_dev_inst *serial,
|
||||||
uint8_t command)
|
uint8_t command)
|
||||||
{
|
{
|
||||||
|
@ -149,7 +147,6 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
|
||||||
|
|
||||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->driver = &ols_driver_info;
|
|
||||||
devc = ols_dev_new();
|
devc = ols_dev_new();
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ static const uint64_t meas_ranges[][2] = {
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
@ -82,7 +81,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
@ -93,14 +91,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->conn = sr_serial_dev_inst_new(conn, SERIALCOMM);
|
sdi->conn = sr_serial_dev_inst_new(conn, SERIALCOMM);
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_clear(const struct sr_dev_driver *di)
|
static int dev_clear(const struct sr_dev_driver *di)
|
||||||
|
|
|
@ -78,7 +78,6 @@ static const uint64_t samplerates[] = {
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
@ -87,8 +86,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
(void)options;
|
(void)options;
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
|
|
||||||
/* Allocate memory for our private device context. */
|
/* Allocate memory for our private device context. */
|
||||||
|
@ -177,10 +174,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sr_dbg("Failed to set default samplerate (%"PRIu64").",
|
sr_dbg("Failed to set default samplerate (%"PRIu64").",
|
||||||
DEFAULT_SAMPLERATE);
|
DEFAULT_SAMPLERATE);
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
|
|
||||||
err_close_ftdic:
|
err_close_ftdic:
|
||||||
p_ols_close(devc);
|
p_ols_close(devc);
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
extern SR_PRIV struct sr_dev_driver p_ols_driver_info;
|
|
||||||
|
|
||||||
SR_PRIV int write_shortcommand(struct dev_context *devc, uint8_t command)
|
SR_PRIV int write_shortcommand(struct dev_context *devc, uint8_t command)
|
||||||
{
|
{
|
||||||
uint8_t buf[1];
|
uint8_t buf[1];
|
||||||
|
@ -227,7 +225,6 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str
|
||||||
|
|
||||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->driver = &p_ols_driver_info;
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
devname = g_string_new("");
|
devname = g_string_new("");
|
||||||
|
|
|
@ -191,7 +191,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->status = SR_ST_INITIALIZING;
|
sdi->status = SR_ST_INITIALIZING;
|
||||||
sdi->vendor = g_strdup("Saleae");
|
sdi->vendor = g_strdup("Saleae");
|
||||||
sdi->model = g_strdup("Logic16");
|
sdi->model = g_strdup("Logic16");
|
||||||
sdi->driver = di;
|
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
|
|
||||||
for (j = 0; j < ARRAY_SIZE(channel_names); j++)
|
for (j = 0; j < ARRAY_SIZE(channel_names); j++)
|
||||||
|
@ -201,7 +200,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
devc->selected_voltage_range = VOLTAGE_RANGE_18_33_V;
|
devc->selected_voltage_range = VOLTAGE_RANGE_18_33_V;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
if (check_conf_profile(devlist[i])) {
|
if (check_conf_profile(devlist[i])) {
|
||||||
|
@ -227,7 +225,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
|
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int logic16_dev_open(struct sr_dev_inst *sdi)
|
static int logic16_dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -48,7 +48,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
GSList *l, *devices;
|
GSList *l, *devices;
|
||||||
const char *conn, *serialcomm;
|
const char *conn, *serialcomm;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
int dropped, ret;
|
int dropped, ret;
|
||||||
|
@ -82,7 +81,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
sr_info("Probing serial port %s.", conn);
|
sr_info("Probing serial port %s.", conn);
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
serial_flush(serial);
|
serial_flush(serial);
|
||||||
|
|
||||||
|
@ -130,15 +128,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
scan_cleanup:
|
scan_cleanup:
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -194,15 +194,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
continue; /* no match */
|
continue; /* no match */
|
||||||
|
|
||||||
/* Register device instance with driver. */
|
/* Register device instance with driver. */
|
||||||
sdi->driver = di;
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
g_slist_free_full(conn_devices, (GDestroyNotify)&sr_usb_dev_inst_free);
|
g_slist_free_full(conn_devices, (GDestroyNotify)&sr_usb_dev_inst_free);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy the private device context.
|
/* Destroy the private device context.
|
||||||
|
|
|
@ -38,7 +38,6 @@ static const uint32_t devopts[] = {
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
|
@ -73,7 +72,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
sr_info("Probing serial port %s.", conn);
|
sr_info("Probing serial port %s.", conn);
|
||||||
|
|
||||||
drvc = di->context;
|
|
||||||
serial_flush(serial);
|
serial_flush(serial);
|
||||||
|
|
||||||
/* Let's get a bit of data and see if we can find a packet. */
|
/* Let's get a bit of data and see if we can find a packet. */
|
||||||
|
@ -92,7 +90,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->inst_type = SR_INST_SERIAL;
|
sdi->inst_type = SR_INST_SERIAL;
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P");
|
||||||
|
|
||||||
|
@ -116,13 +113,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "IINST");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "IINST");
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "PAPP");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "PAPP");
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
scan_cleanup:
|
scan_cleanup:
|
||||||
serial_close(serial);
|
serial_close(serial);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -128,13 +128,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
if (testo_probe_channels(sdi) != SR_OK)
|
if (testo_probe_channels(sdi) != SR_OK)
|
||||||
continue;
|
continue;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
|
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -92,12 +92,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->conn = serial;
|
sdi->conn = serial;
|
||||||
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
|
@ -87,15 +87,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->vendor = g_strdup(dmm->vendor);
|
sdi->vendor = g_strdup(dmm->vendor);
|
||||||
sdi->model = g_strdup(dmm->device);
|
sdi->model = g_strdup(dmm->device);
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
|
||||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
|
||||||
sdi->inst_type = SR_INST_USB;
|
sdi->inst_type = SR_INST_USB;
|
||||||
sdi->conn = usb;
|
sdi->conn = usb;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -70,7 +70,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->vendor = g_strdup(VENDOR);
|
sdi->vendor = g_strdup(VENDOR);
|
||||||
sdi->model = g_strdup(MODEL);
|
sdi->model = g_strdup(MODEL);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->inst_type = SR_INST_USB;
|
sdi->inst_type = SR_INST_USB;
|
||||||
sdi->conn = l->data;
|
sdi->conn = l->data;
|
||||||
for (i = 0; i < ARRAY_SIZE(channel_names); i++)
|
for (i = 0; i < ARRAY_SIZE(channel_names); i++)
|
||||||
|
@ -80,14 +79,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
devc->limit_samples = 0;
|
devc->limit_samples = 0;
|
||||||
devc->data_source = DEFAULT_DATA_SOURCE;
|
devc->data_source = DEFAULT_DATA_SOURCE;
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
g_slist_free(usb_devices);
|
g_slist_free(usb_devices);
|
||||||
} else
|
} else
|
||||||
g_slist_free_full(usb_devices, g_free);
|
g_slist_free_full(usb_devices, g_free);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -76,7 +76,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->vendor = g_strdup(VICTOR_VENDOR);
|
sdi->vendor = g_strdup(VICTOR_VENDOR);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
sr_sw_limits_init(&devc->limits);
|
sr_sw_limits_init(&devc->limits);
|
||||||
|
@ -87,12 +86,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
libusb_get_device_address(devlist[i]), NULL);
|
libusb_get_device_address(devlist[i]), NULL);
|
||||||
sdi->inst_type = SR_INST_USB;
|
sdi->inst_type = SR_INST_USB;
|
||||||
|
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
}
|
}
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -212,7 +212,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
sdi->vendor = g_strdup(VENDOR_NAME);
|
sdi->vendor = g_strdup(VENDOR_NAME);
|
||||||
sdi->model = g_strdup(prof->model_name);
|
sdi->model = g_strdup(prof->model_name);
|
||||||
sdi->driver = di;
|
|
||||||
sdi->serial_num = g_strdup(serial_num);
|
sdi->serial_num = g_strdup(serial_num);
|
||||||
sdi->connection_id = g_strdup(connection_id);
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
|
|
||||||
|
@ -238,7 +237,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
channel_names[j]);
|
channel_names[j]);
|
||||||
|
|
||||||
devices = g_slist_append(devices, sdi);
|
devices = g_slist_append(devices, sdi);
|
||||||
drvc->instances = g_slist_append(drvc->instances, sdi);
|
|
||||||
sdi->inst_type = SR_INST_USB;
|
sdi->inst_type = SR_INST_USB;
|
||||||
sdi->conn = sr_usb_dev_inst_new(
|
sdi->conn = sr_usb_dev_inst_new(
|
||||||
libusb_get_bus_number(devlist[i]),
|
libusb_get_bus_number(devlist[i]),
|
||||||
|
@ -246,7 +244,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
}
|
}
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
|
|
||||||
return devices;
|
return std_scan_complete(di, devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
|
@ -938,6 +938,7 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
|
||||||
std_dev_clear_callback clear_private);
|
std_dev_clear_callback clear_private);
|
||||||
SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di);
|
SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di);
|
||||||
SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi);
|
SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi);
|
||||||
|
SR_PRIV GSList *std_scan_complete(struct sr_dev_driver *di, GSList *devices);
|
||||||
|
|
||||||
/*--- resource.c ------------------------------------------------------------*/
|
/*--- resource.c ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
48
src/std.c
48
src/std.c
|
@ -349,3 +349,51 @@ SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di)
|
||||||
|
|
||||||
return drvc->instances;
|
return drvc->instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standard scan() callback API helper.
|
||||||
|
*
|
||||||
|
* This function can be used to perform common tasks required by a driver's
|
||||||
|
* scan() callback. It will initialize the driver for each device on the list
|
||||||
|
* and add the devices on the list to the driver's device instance list.
|
||||||
|
* Usually it should be used as the last step in the scan() callback, right
|
||||||
|
* before returning.
|
||||||
|
*
|
||||||
|
* Note: This function can only be used if std_init() has been called
|
||||||
|
* previously by the driver.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code{c}
|
||||||
|
* static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
* {
|
||||||
|
* struct GSList *device;
|
||||||
|
* struct sr_dev_inst *sdi;
|
||||||
|
*
|
||||||
|
* sdi = g_new0(sr_dev_inst, 1);
|
||||||
|
* sdi->vendor = ...;
|
||||||
|
* ...
|
||||||
|
* devices = g_slist_append(devices, sdi);
|
||||||
|
* ...
|
||||||
|
* return std_scan_complete(di, devices);
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param di The driver instance to use.
|
||||||
|
* @param devices List of newly discovered devices (struct sr_dev_inst).
|
||||||
|
*
|
||||||
|
* @return The @p devices list.
|
||||||
|
*/
|
||||||
|
SR_PRIV GSList *std_scan_complete(struct sr_dev_driver *di, GSList *devices)
|
||||||
|
{
|
||||||
|
struct drv_context *drvc = di->context;
|
||||||
|
GSList *l;
|
||||||
|
|
||||||
|
for (l = devices; l; l = l->next) {
|
||||||
|
struct sr_dev_inst *sdi = l->data;
|
||||||
|
sdi->driver = di;
|
||||||
|
}
|
||||||
|
|
||||||
|
drvc->instances = g_slist_concat(drvc->instances, g_slist_copy(devices));
|
||||||
|
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue