colinoflynn / pico-python

PicoScope Python Interface
Other
101 stars 80 forks source link

Issue with serial number length in ps6000a for enumerate units function #204

Open brianm92 opened 2 weeks ago

brianm92 commented 2 weeks ago

Currently, the ps6000a._lowLevelEnumerateUnits function does not successfully return the serial number of a connected Picoscope 6000 series (tested using model 6426E).

Minimum working example:

from picoscope import ps6000a

ps = ps6000a.PS6000a(connect=False)

allSerialNumbers = ps.enumerateUnits()

print("Found the following device serial numbers: ")
for serial in allSerialNumbers:
    print(serial + "\n")

No serial number is returned (and no error raised either).

It seems that the issue lies with the serialLth = c_int16(count.value * (8 + 2)) line in ps6000a._lowLevelEnumerateUnits. If I change this to 9+2 (or more) instead of 8+2, the serial number is successfully returned. My serial number is of the format "AB123/4567" which is at 10 characters of length. I cannot check that this change works with more than one scope connected, so I'm not sure what the correct buffer length per unit should be for this.

As a starting point, can anyone confirm if the serial number format of other Picoscope series are different to the 6000 series, i.e., they have something other than the format "AB123/4567"?