Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pycbsdk/cbhw/device/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(self, params: Params):
"proc_chans": 0,
"channel_infos": {},
"group_infos": {},
"group_nchans": {},
"sysfreq": None, # Should be 30_000 for legacy or 1e9 for Gemini PTP
}
# Init group_callbacks dict with an empty list for each supported smp grp (1-5:SMP; 6:RAW)
Expand Down
1 change: 1 addition & 0 deletions src/pycbsdk/cbhw/device/nsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ def _handle_groupinfo(self, pkt):
else:
chan_list = set()
self._config["group_infos"][pkt.group] = chan_list
self._config["group_nchans"][pkt.group] = len(chan_list)

def _handle_configall(self, pkt):
if pkt.header.dlen > 0:
Expand Down
8 changes: 8 additions & 0 deletions src/pycbsdk/cbhw/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ def run(self) -> None:
b_debug_unknown = True # If there are no callbacks and it's not a group or event packet, then debug.

# See if we have any callbacks registered for this type of packet.
b_grp = False
if chid & CBSpecialChan.CONFIGURATION:
callbacks = self._device.config_callbacks[pkt_type]
elif chid == CBSpecialChan.GROUP:
# This is a sample group packet. The pkt_type is actually the sample group id (1-6)
if pkt_type in self._device.group_callbacks:
b_grp = True
callbacks = self._device.group_callbacks[pkt_type]
else:
# Known bug https://blackrockengineering.atlassian.net/browse/CSCI-95
Expand All @@ -106,6 +108,12 @@ def run(self) -> None:
pkt = self._packet_factory.make_packet(
data, chid=chid, pkt_type=pkt_type, chantype=chantype
)
if b_grp:
# Note: pkt.data length is always a multiple of 4 bytes = 32 bits = 2 channels * 16 bits.
n_chans = self._device.config["group_nchans"][pkt_type]
if n_chans % 2 != 0:
# Odd number of channels enabled then we have an extra 16 bits of data.
pkt.data = pkt.data[:n_chans]
# Between the time the callbacks are grabbed above and the time we actually call them,
# it's possible for the client to unregister the callback.
# Thus it's very important that a callback is unregistered and some time is allowed to pass
Expand Down
Loading