ps2203 potential bug

Post general discussions on using our drivers to write your own software here
Post Reply
johnm1019
Newbie
Posts: 0
Joined: Mon Nov 08, 2010 10:15 am

ps2203 potential bug

Post by johnm1019 »

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.

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

Re: ps2203 potential bug

Post by Chris »

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.

johnm1019
Newbie
Posts: 0
Joined: Mon Nov 08, 2010 10:15 am

Re: ps2203 potential bug

Post by johnm1019 »

thank you, this fixed it.

Post Reply