From: Daniel Ribeiro Date: Fri, 21 Jan 2011 20:04:09 +0000 (-0200) Subject: re-enable filter and datastore for DF_LOGIC X-Git-Tag: libsigrok-0.1.0~389 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=62eeeb171bd9a05d167990373e33bc1f956cbfee;p=libsigrok.git re-enable filter and datastore for DF_LOGIC This definitely isn't the proper fix, but it should allow DF_LOGIC and DF_ANALOG to coexist. --- diff --git a/device.c b/device.c index 84cf6d1f..752041d5 100644 --- a/device.c +++ b/device.c @@ -29,7 +29,7 @@ void device_scan(void) { GSList *plugins, *l; struct device_plugin *plugin; - int num_devices, num_probes, i; + int num_devices, num_probes, i, probe_type; plugins = list_hwplugins(); @@ -46,7 +46,13 @@ void device_scan(void) num_probes = (int)(unsigned long)plugin->get_device_info(i, DI_NUM_PROBES); - device_new(plugin, i, num_probes); + probe_type = (int)(unsigned long) + plugin->get_device_info(i, DI_PROBE_TYPE); + + if (probe_type != PROBE_TYPE_ANALOG) + probe_type = PROBE_TYPE_LOGIC; + + device_new(plugin, i, num_probes, probe_type); } } } @@ -69,7 +75,7 @@ GSList *device_list(void) } struct device *device_new(struct device_plugin *plugin, int plugin_index, - int num_probes) + int num_probes, int probe_type) { struct device *device; int i; @@ -78,6 +84,7 @@ struct device *device_new(struct device_plugin *plugin, int plugin_index, device = g_malloc0(sizeof(struct device)); device->plugin = plugin; device->plugin_index = plugin_index; + device->probe_type = probe_type; devices = g_slist_append(devices, device); for (i = 0; i < num_probes; i++) { diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index e117e6a5..06a22361 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -163,6 +163,11 @@ static void *hw_get_device_info(int device_index, int device_info_id) case DI_PATTERNMODES: info = &patternmodes; break; +#ifdef DEMO_ANALOG + case DI_PROBE_TYPE: + info = GINT_TO_POINTER(PROBE_TYPE_ANALOG); + break; +#endif } return info; diff --git a/input/input_binary.c b/input/input_binary.c index ef9bddcb..3957e769 100644 --- a/input/input_binary.c +++ b/input/input_binary.c @@ -51,7 +51,7 @@ static int init(struct input *in) num_probes = DEFAULT_NUM_PROBES; /* create a virtual device */ - in->vdevice = device_new(NULL, 0, num_probes); + in->vdevice = device_new(NULL, 0, num_probes, PROBE_TYPE_LOGIC); return SIGROK_OK; } diff --git a/sigrok-proto.h b/sigrok-proto.h index 1abdadd8..199599e1 100644 --- a/sigrok-proto.h +++ b/sigrok-proto.h @@ -38,7 +38,7 @@ void device_scan(void); void device_close_all(void); GSList *device_list(void); struct device *device_new(struct device_plugin *plugin, int plugin_index, - int num_probes); + int num_probes, int probe_type); void device_clear(struct device *device); void device_destroy(struct device *dev); diff --git a/sigrok.h b/sigrok.h index e3b6ac78..1ba03b63 100644 --- a/sigrok.h +++ b/sigrok.h @@ -190,6 +190,7 @@ struct device { struct device_plugin *plugin; /* A plugin may handle multiple devices of the same type */ int plugin_index; + uint8_t probe_type; /* List of struct probe* */ GSList *probes; /* Data acquired by this device, if any */ @@ -203,7 +204,6 @@ enum { struct probe { int index; - int type; gboolean enabled; char *name; char *trigger; @@ -297,6 +297,8 @@ enum { DI_CUR_SAMPLERATE, /* Supported pattern generator modes */ DI_PATTERNMODES, + /* Probes type, DF_ANALOG needs this to be PROBE_TYPE_ANALOG */ + DI_PROBE_TYPE, }; /*