Skip to content

Commit b16ba7a

Browse files
authored
Merge pull request #1059 from fredzo/driver-supported-transports
SCPIInstrument API to list driver supported models and transports
2 parents 7294b33 + e550691 commit b16ba7a

29 files changed

Lines changed: 355 additions & 44 deletions

scopehal/AlientekPowerSupply.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -153,6 +153,12 @@ class AlientekPowerSupply
153153
public:
154154
static std::string GetDriverNameInternal();
155155
POWER_INITPROC(AlientekPowerSupply);
156+
static std::vector<SCPIInstrumentModel> GetDriverSupportedModels()
157+
{
158+
return {
159+
{"Alientek DP100", {{ SCPITransportType::TRANSPORT_HID, "2e3c:af01" }}}
160+
};
161+
}
156162
};
157163

158164
#endif

scopehal/DemoOscilloscope.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -197,8 +197,15 @@ class DemoOscilloscope : public virtual SCPIOscilloscope
197197

198198
public:
199199
static std::string GetDriverNameInternal();
200-
200+
static std::vector<SCPIInstrumentModel> GetDriverSupportedModels()
201+
{
202+
return {
203+
{"Demo Oscilloscope", {{ SCPITransportType::TRANSPORT_NULL, "" }}}
204+
};
205+
}
201206
OSCILLOSCOPE_INITPROC(DemoOscilloscope)
207+
208+
202209
};
203210

204211
#endif

scopehal/DemoPowerSupply.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -99,6 +99,12 @@ class DemoPowerSupply
9999

100100
public:
101101
static std::string GetDriverNameInternal();
102+
static std::vector<SCPIInstrumentModel> GetDriverSupportedModels()
103+
{
104+
return {
105+
{"Demo PSU", {{ SCPITransportType::TRANSPORT_NULL, "" }}}
106+
};
107+
}
102108
POWER_INITPROC(DemoPowerSupply)
103109
};
104110

scopehal/KuaiquPowerSupply.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -103,6 +103,22 @@ class KuaiquPowerSupply
103103
public:
104104
static std::string GetDriverNameInternal();
105105
POWER_INITPROC(KuaiquPowerSupply);
106+
static std::vector<SCPIInstrumentModel> GetDriverSupportedModels()
107+
{
108+
return {
109+
#ifdef _WIN32
110+
{"Kuaiqu SPPS-D", {{ SCPITransportType::TRANSPORT_UART, "COM<x>:9600" }}},
111+
{"Kuaiqu SPPS-S", {{ SCPITransportType::TRANSPORT_UART, "COM<x>:9600" }}},
112+
{"Kuaiqu SPPS*D", {{ SCPITransportType::TRANSPORT_UART, "COM<x>:9600" }}},
113+
{"Kuaiqu R-SPPS", {{ SCPITransportType::TRANSPORT_UART, "COM<x>:9600" }}}
114+
#else
115+
{"Kuaiqu SPPS-D", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB<x>:9600" }}},
116+
{"Kuaiqu SPPS-S", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB<x>:9600" }}},
117+
{"Kuaiqu SPPS*D", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB<x>:9600" }}},
118+
{"Kuaiqu R-SPPS", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB<x>:9600" }}}
119+
#endif
120+
};
121+
}
106122
};
107123

108124
#endif

scopehal/MagnovaOscilloscope.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -368,6 +368,16 @@ string MagnovaOscilloscope::GetDriverNameInternal()
368368
return "magnova";
369369
}
370370

371+
std::vector<SCPIInstrumentModel> MagnovaOscilloscope::GetDriverSupportedModels()
372+
{
373+
return {
374+
{"Magnova", {
375+
{ SCPITransportType::TRANSPORT_LAN, "<ip_address>:5025" },
376+
{ SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc<x>" },
377+
}}
378+
};
379+
}
380+
371381
OscilloscopeChannel* MagnovaOscilloscope::GetExternalTrigger()
372382
{
373383
return m_extTrigChannel;
@@ -679,7 +689,7 @@ double MagnovaOscilloscope::GetChannelAttenuation(size_t i)
679689
{
680690
protocolError("invalid channel attenuation value '%s'",reply.c_str());
681691
}
682-
return 1/d;
692+
return d;
683693
}
684694

685695
void MagnovaOscilloscope::SetChannelAttenuation(size_t i, double atten)

scopehal/MagnovaOscilloscope.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -493,5 +493,6 @@ class MagnovaOscilloscope : public virtual SCPIOscilloscope, public virtual SCP
493493
public:
494494
static std::string GetDriverNameInternal();
495495
OSCILLOSCOPE_INITPROC(MagnovaOscilloscope)
496+
static std::vector<SCPIInstrumentModel> GetDriverSupportedModels();
496497
};
497498
#endif

scopehal/NanoVNA.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -119,6 +119,16 @@ class NanoVNA : public virtual SCPIVNA, public virtual CommandLineDriver
119119

120120
public:
121121
static std::string GetDriverNameInternal();
122+
static std::vector<SCPIInstrumentModel> GetDriverSupportedModels()
123+
{
124+
return {
125+
#ifdef _WIN32
126+
{"NanoVNA", {{ SCPITransportType::TRANSPORT_UART, "COM<x>:115200:DTR" }}}
127+
#else
128+
{"NanoVNA", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB<x>:115200:DTR" }}}
129+
#endif
130+
};
131+
}
122132
VNA_INITPROC(NanoVNA)
123133
};
124134

scopehal/Oscilloscope.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2025 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -1010,6 +1010,6 @@ inline Oscilloscope* OscilloscopeChannel::GetScope()
10101010
virtual std::string GetDriverName() const override \
10111011
{ return GetDriverNameInternal(); }
10121012

1013-
#define AddDriverClass(T) Oscilloscope::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance)
1013+
#define AddDriverClass(T) Oscilloscope::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels)
10141014

10151015
#endif

scopehal/OwonXDGFunctionGenerator.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -81,6 +81,19 @@ class OwonXDGFunctionGenerator : public virtual SCPIFunctionGenerator
8181

8282
public:
8383
static std::string GetDriverNameInternal();
84+
static std::vector<SCPIInstrumentModel> GetDriverSupportedModels()
85+
{
86+
return {
87+
{"Owon XDG 2000", {
88+
{ SCPITransportType::TRANSPORT_LAN, "<ip_address>:3000" },
89+
{ SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc<x>" },
90+
}},
91+
{"Owon XDG 3000", {
92+
{ SCPITransportType::TRANSPORT_LAN, "<ip_address>:3000" },
93+
{ SCPITransportType::TRANSPORT_USBTMC, "/dev/usbtmc<x>" },
94+
}}
95+
};
96+
}
8497
GENERATOR_INITPROC(OwonXDGFunctionGenerator)
8598

8699
protected:

scopehal/OwonXDMMultimeter.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* libscopehal *
44
* *
5-
* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -81,6 +81,20 @@ class OwonXDMMultimeter
8181

8282
public:
8383
static std::string GetDriverNameInternal();
84+
static std::vector<SCPIInstrumentModel> GetDriverSupportedModels()
85+
{
86+
return {
87+
#ifdef _WIN32
88+
{"Owon XDM1041", {{ SCPITransportType::TRANSPORT_UART, "COM<x>" }}},
89+
{"Owon XDM1241", {{ SCPITransportType::TRANSPORT_UART, "COM<x>" }}},
90+
{"Owon XDM2041", {{ SCPITransportType::TRANSPORT_UART, "COM<x>" }}}
91+
#else
92+
{"Owon XDM1041", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB<x>" }}},
93+
{"Owon XDM1241", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB<x>" }}},
94+
{"Owon XDM2041", {{ SCPITransportType::TRANSPORT_UART, "/dev/ttyUSB<x>" }}}
95+
#endif
96+
};
97+
}
8498
METER_INITPROC(OwonXDMMultimeter)
8599
};
86100

0 commit comments

Comments
 (0)