Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e51a370257b9
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7f624ee4e2fe
Choose a head ref
  • 4 commits
  • 1 file changed
  • 2 contributors

Commits on Jun 2, 2020

  1. Copy the full SHA
    a73fdcc View commit details
  2. Copy the full SHA
    d99d069 View commit details
  3. Copy the full SHA
    b354f70 View commit details
  4. Merge pull request #133 from tomverbeure/fix_lxi_const_compilation

    Cast to non-const for interop with old liblxi.
    azonenberg authored Jun 2, 2020
    Copy the full SHA
    7f624ee View commit details
Showing with 15 additions and 3 deletions.
  1. +15 −3 scopehal/SCPILxiTransport.cpp
18 changes: 15 additions & 3 deletions scopehal/SCPILxiTransport.cpp
Original file line number Diff line number Diff line change
@@ -60,7 +60,14 @@ SCPILxiTransport::SCPILxiTransport(string args)

LogDebug("Connecting to SCPI oscilloscope over VXI-11 at %s:%d\n", m_hostname.c_str(), m_port);

m_device = lxi_connect(m_hostname.c_str(), m_port, "inst0", m_timeout, VXI11);
char *hostname_dup = new char[m_hostname.length()+1];
strcpy(hostname_dup, m_hostname.c_str());
char *instname_dup = new char[strlen("inst0")+1];
strcpy(instname_dup, "inst0");

m_device = lxi_connect(hostname_dup, m_port, instname_dup, m_timeout, VXI11);
delete hostname_dup;
delete instname_dup;

if (m_device == LXI_ERROR)
{
@@ -114,7 +121,9 @@ bool SCPILxiTransport::SendCommand(string cmd)
{
LogTrace("Sending %s\n", cmd.c_str());

int result = lxi_send(m_device, cmd.c_str(), cmd.length(), m_timeout);
char *cmd_dup = new char[cmd.length()+1];
strcpy(cmd_dup, cmd.c_str());
int result = lxi_send(m_device, cmd_dup, cmd.length(), m_timeout);

m_data_in_staging_buf = 0;
m_data_offset = 0;
@@ -149,7 +158,10 @@ string SCPILxiTransport::ReadReply()
void SCPILxiTransport::SendRawData(size_t len, const unsigned char* buf)
{
// XXX: Should this reset m_data_depleted just like SendCommmand?
lxi_send(m_device, (const char *)buf, len, m_timeout);

char *buf_dup = new char[len+1];
memcpy(buf_dup, buf, len);
lxi_send(m_device, buf_dup, len, m_timeout);
}

void SCPILxiTransport::ReadRawData(size_t len, unsigned char* buf)