-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime exception when receiving event (genapiMalformed message - wrong magic 0 (42 expected)) #481
Comments
By locally modifying my genapi.py and add some header information I can get the event handling to work. But this is not a long term solution and not a nice solution. To solve the problem one would need to understand where the header is stripped and avoid stripping it: genapi.py#3038
My guess is that this is somewhere in GenAPI/ Python wrapping when the data is read, that instead of reading all data including the header only the payload is read. |
I am experiencing the exact same problem: Configuration:
And I can use more or less the same workaround/hack to fix it: genapi.py#3558 def deliver_message(self, msg):
#print(msg)
if msg[0] != b"\x42":
msg = b"\x42\x10\x00\xc0" + msg |
I believe switching from GEV to Generic EventAdapter in the code below is a more generic solution, than prepending a hardcoded header. core.py#1825 @staticmethod
def _get_event_adapter(*, tl_type: str, node_map: NodeMap):
if tl_type == 'U3V':
return EventAdapterU3V(node_map.pointer)
elif tl_type == 'GEV':
#return EventAdapterGEV(node_map.pointer)
return EventAdapterGeneric(node_map.pointer)
else:
return EventAdapterGeneric(node_map.pointer) |
Changing that does move past the event capturing point but the event data is not filled in correctly, at least not for me. So it results in an error later when trying to access the node_map of the remote device to access the event data (see log at bottom of the message). I think the error is already in the call to update_event_data, at #2289, here the base class is used instead of implementing a RemoteDevice specific function that keeps the header as expected by EventAdapterGEV.deliver_message.
|
Describe the Issue
I want to receive events from the camera, for example log events to be able to react on message from the camera.
To Reproduce
Steps to reproduce the behavior:
Sample Code
I can show a piece of code that demonstrates the reported phenomenon:
If yes, please provide a sample code:
If applicable, please paste the actual output (its whole traceback, etc) here:
Expected Behavior
I was expecting to get a callback and be able to react on that.
Configuration
Reproducibility
This phenomenon can be stably reproduced:
If applicable, please provide your observation about the reproducibility.
Actions You Have Taken
I have added some debug prints inside Harvesters, printing the data used @ core.py", line 2298 gives:
Printing the data @ genicam\genapi.py", line 3040, in deliver_message gives a buffer that can be read:
Here I got a clue, it looks like the header is missing, so I went to wireshark and inspected the message from the camera:
And it looks like the header contains the correct magic number, but somewhere on the way the header is stripped.
So is this a bug in Harvester that the header is stripped or am I doing something wrong?
The text was updated successfully, but these errors were encountered: