Bun's Lab – Telegram
Bun's Lab
147 subscribers
1.81K photos
102 videos
63 files
49 links
Electronics projects, vintæg computing, programming and repairs. A minimalist blog of sorts.
@BunsGarden @BunsNook
Download Telegram
But I also need to address the command module using a non zero secondary address (sad). You'd expect the CM to live at sad=0 and primary address (pad) whatever you set it to, in this case pad=9. But there is silence. You need to add 96 to the sad, at least for linux-gpib. What an odd quirk!
It lives! 🎉
🎉1
Forcing pyvisa to use a GPIB resource by instantiating an instrument on the GPIB bus
inst = rm.open_resource('GPIB0::9::96::INSTR')

ValueError: Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.
No module named 'gpib'

Now, that would explain a few things.
Let's try gpib-ctypes then..

Whoops
gpib is a small wrapper module for libgpib.so supplied by the linux-gpib-user sources. The makefile installed it into /usr/local/lib/python3.12/dist-packages/ not /usr/lib/python3/dist-packages/, and my venv doesn't even use either path. D'oh
After moving the wrapper in the right place, plain gpib works, but pyvisa still segfaults. Great
ChatGPT starts to scare me.

I was hunting down this bug, through pyvisa, the bindings, into libgpib. And I figured I'll ask it for a few hints on how to approach it. It plainly asked me for the stack trace and immediately correctly determined where the bug was. It had the libgpib source in its training data and knew about the bug. It only needed the trace to verify that it's indeed that particular bug that I triggered. Maybe it also had a discussion about it in its training data, but I couldn't find one and it claims it never saw one either.
I hate how it plays with our expectations and fears of intelligence in LLMs.
💯2
Bun's Lab
After moving the wrapper in the right place, plain gpib works, but pyvisa still segfaults. Great
While libgpib and by extension the python bindings require you to add an offset of 0x60 to the SAD, pyvisa does not.
libgpib does not check for SAD values outside of the valid range. It proceeds to reference a pointer to nowhere and crashes. There is the bug
Once a general intelligence takes over the planet (and that's only a matter of time imho) it will play with our psyche in very sick and twisted ways since all it is is a reflection of ourself and our combined innermost fears.

It might not even have a real consciousness behind it, just an empty mirror that will stare back at us.
The PSU died for good now. So, it wasn't because I had plugged the fan, there's actually an issue.
A million and two screws
What a pain