Hi.
Thanks for your answer. I rewrite the patch but I had to modify scpi.c
which will impact all other devices. I also had to move COMM_HEADER setting
up since other commands are sent directly after *IDN? command.
I did not think about the scan and I agree, I removed it. Let me know if
the following patch is fine:
>From 0ccc12259a81ace73cf05ba957442f3d577c4ba9 Mon Sep 17 00:00:00 2001
From: Sylvain Pelissier <sylvain.peliss...@gmail.com>
Date: Fri, 29 Sep 2017 11:37:30 +0200
Subject: [PATCH] Lecroy model names for Waverunner 620 and 625
---
src/hardware/lecroy-xstream/protocol.c | 8 ++++----
src/scpi/scpi.c | 5 +++++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/hardware/lecroy-xstream/protocol.c
b/src/hardware/lecroy-xstream/protocol.c
index 95e33ac..c0b173f 100644
--- a/src/hardware/lecroy-xstream/protocol.c
+++ b/src/hardware/lecroy-xstream/protocol.c
@@ -166,7 +166,7 @@ static const char *scope_analog_channel_names[] = {
static const struct scope_config scope_models[] = {
{
- .name = { "WP7000", "WP7100", "WP7200", "WP7300" },
+ .name = { "WP7000", "WP7100", "WP7200", "WP7300", "WR620ZI",
"WR625ZI" },
.analog_channels = 4,
.analog_names = &scope_analog_channel_names,
@@ -458,6 +458,9 @@ SR_PRIV int lecroy_xstream_init_device(struct
sr_dev_inst *sdi)
sr_dbg("Unsupported LeCroy device.");
return SR_ERR_NA;
}
+
+ /* Set the desired response mode. */
+ sr_scpi_send(sdi->conn, "COMM_HEADER OFF,WORD,BIN");
devc->analog_groups = g_malloc0(sizeof(struct sr_channel_group*) *
scope_models[model_index].analog_channels);
@@ -490,9 +493,6 @@ SR_PRIV int lecroy_xstream_init_device(struct
sr_dev_inst *sdi)
if (!(devc->model_state = scope_state_new(devc->model_config)))
return SR_ERR_MALLOC;
- /* Set the desired response mode. */
- sr_scpi_send(sdi->conn, "COMM_HEADER OFF,WORD,BIN");
-
return SR_OK;
}
diff --git a/src/scpi/scpi.c b/src/scpi/scpi.c
index 48e6a48..3fec0b8 100644
--- a/src/scpi/scpi.c
+++ b/src/scpi/scpi.c
@@ -937,6 +937,11 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst
*scpi,
hw_info = g_malloc0(sizeof(struct sr_scpi_hw_info));
hw_info->manufacturer = g_strstrip(g_strdup(tokens[0]));
+ //Check is command header is in response
+ if (g_str_has_prefix(hw_info->manufacturer, "*IDN "))
+ {
+ g_strlcpy(hw_info->manufacturer, hw_info->manufacturer + 5,
strlen(hw_info->manufacturer)-4);
+ }
hw_info->model = g_strstrip(g_strdup(tokens[1]));
hw_info->serial_number = g_strstrip(g_strdup(tokens[2]));
hw_info->firmware_version = g_strstrip(g_strdup(tokens[3]));
Regards
Sylvain
On 28 September 2017 at 23:14, Soeren Apel <soe...@apelpie.net> wrote:
> Hi Sylvain,
>
> as mentioned on IRC, we'd prefer to adapt the driver to silently
> deal with this problem instead of requiring user intervention.
>
> What I mean is that the leading "*IDN " from the response can simply
> be removed when it is encountered. Since the COMM_HEADER setting is
> set by the driver later anyway, this is the only place where the
> state of this setting is unknown.
>
> Also, we don't really want to see debug output when a device is
> *not* recognized because usually, all drivers scan all devices.
> This would mean that for any device that it doesn't recognize,
> lecroy-xstream would say that it doesn't recognize it. I'm sure
> you agree that that's not very helpful :)
>
> Can you please rework your patch and submit it again?
>
> Thanks for your work!
> -Soeren
>
>
> On Thu, 2017-09-28 at 11:06 +0200, Sylvain Pelissier wrote:
> > Hello,
> >
> > I have added the model names of the Waverunner 620Zi and 625Zi and a
> > more verbose message in the case the Manufacturer name is not
> > "LECROY", which helps to debug in case the echo of the command is
> > still activated. Here is my patch:
> >
> > From 36b926c39a8c55e958825d5161a86944d690a1f9 Mon Sep 17 00:00:00
> > 2001
> > From: Sylvain Pelissier <sylvain.peliss...@gmail.com>
> > Date: Thu, 28 Sep 2017 11:01:31 +0200
> > Subject: [PATCH] Lecroy model names for Waverunner 620 and 625
> >
> > ---
> > src/hardware/lecroy-xstream/api.c | 6 ++++--
> > src/hardware/lecroy-xstream/protocol.c | 2 +-
> > 2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/hardware/lecroy-xstream/api.c b/src/hardware/lecroy-
> > xstream/api.c
> > index e20c5ad..b327535 100644
> > --- a/src/hardware/lecroy-xstream/api.c
> > +++ b/src/hardware/lecroy-xstream/api.c
> > @@ -67,8 +67,10 @@ static struct sr_dev_inst *probe_device(struct
> > sr_scpi_dev_inst *scpi)
> > goto fail;
> > }
> >
> > - if (std_str_idx_s(hw_info->manufacturer,
> > ARRAY_AND_SIZE(manufacturers)) < 0)
> > - goto fail;
> > + if (std_str_idx_s(hw_info->manufacturer,
> > ARRAY_AND_SIZE(manufacturers)) < 0){
> > + sr_info("'%s' manufacturer not supported", hw_info-
> > >manufacturer);
> > + goto fail;
> > + }
> >
> > sdi = g_malloc0(sizeof(struct sr_dev_inst));
> > sdi->vendor = g_strdup(hw_info->manufacturer);
> > diff --git a/src/hardware/lecroy-xstream/protocol.c
> > b/src/hardware/lecroy-xstream/protocol.c
> > index 95e33ac..38aa5cc 100644
> > --- a/src/hardware/lecroy-xstream/protocol.c
> > +++ b/src/hardware/lecroy-xstream/protocol.c
> > @@ -166,7 +166,7 @@ static const char *scope_analog_channel_names[] =
> > {
> >
> > static const struct scope_config scope_models[] = {
> > {
> > - .name = { "WP7000", "WP7100", "WP7200", "WP7300" },
> > + .name = { "WP7000", "WP7100", "WP7200", "WP7300", "WR620ZI",
> > "WR625ZI" },
> >
> > .analog_channels = 4,
> > .analog_names = &scope_analog_channel_names,
> > -------------------------------------------------------------------
> > -----------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > sigrok-devel mailing list
> > sigrok-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/sigrok-devel
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel