Test and Measurement Forum

ps2203 potential bug

Post general discussions on using our drivers to write your own software here

ps2203 potential bug

Postby johnm1019 » Mon Apr 04, 2011 5:45 pm

With the latest SDK and a 2203, ps2000_get_unit_info is broken and the code just dies when stepping through this call. App immediately crashes. If I don't call get_unit_info the rest of the code runs fine and I can fast stream and read samples and everything is peachy.

Calling as follows
Code: Select all
#include "ps2000.h"
...
...
m_handle = ps2000_open_unit();

if (!m_handle)
{
   return false;
}


char infoString[30];
short infoLength = 0;
short desiredInfoLine;
desiredInfoLine = PS2000_DRIVER_VERSION;
ps2000_get_unit_info(m_handle, infoString, infoLength, desiredInfoLine);

Visual Studio 2010 SP1, Win32.

Steps to reproduce.
Create new c++ project.
copy and paste in the code I have above.
Insert breakpoint on the ps2000 line call.
step over that line and it stops execution and debug mode just returns.

For me, just before the call, handle is always 1.

Is there bad documentation for this call in the developers guide? (which doesn't mention that the caller is responsible for allocating the response string (as you can see, I am), and also doesn't mention what the limits on the size of that string should be)

I've really taken all paths to resolve this one and am clueless.
johnm1019
Newbie
 
Posts: 0
Joined: Mon Nov 08, 2010 10:15 am

Re: ps2203 potential bug

Postby Chris » Wed Apr 06, 2011 9:05 am

The 3rd parameter......string_length: the length of the character string buffer

If you change your call to
ps2000_get_unit_info(m_handle, infoString, sizeof(infoString), desiredInfoLine);

it will work.
Chris
Site Admin
Site Admin
 
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: ps2203 potential bug

Postby johnm1019 » Fri Aug 05, 2011 1:11 pm

thank you, this fixed it.
johnm1019
Newbie
 
Posts: 0
Joined: Mon Nov 08, 2010 10:15 am


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 0 guests