VK2BEA / HP8753-Companion

Facilitate and enhance the functionality of the HP8753 Vector Network Analyzer
Apache License 2.0
15 stars 5 forks source link

Build issues (transferred from comment in discussion) #3

Closed VK2BEA closed 1 year ago

VK2BEA commented 1 year ago

I recently bought a HP8753C and two S-parameter test sets (50Ohm, 75Ohm). On my research, mainly on how to save and resend calibration data with my Linux-PC, I've discovered your HP8357 companion. At first: Thank you so much for providing us such a great tool, that increases the value of these old devices immensely!

When trying to build the companion, I've got some errors. So together with a friend we had a look on your source code and would like to contribute.

(1) Obviously, one variable in the "utility.c" is used uninitialized inside the function "void logVersion(void)". Plese see the error-log:

make all Making all in src make[1]: Verzeichnis „/home/dad/Downloads/Install/HP8753-Companion-main/build/src“ wird betreten CC hp8753-utility.o ../../src/utility.c: In function ‘logVersion’: ../../src/utility.c:298:5: error: ‘errno’ undeclared (first use in this function) 298 | errno = 0; | ^~~~~ ../../src/utility.c:33:1: note: ‘errno’ is defined in header ‘’; did you forget to ‘#include ’? 32 | #include <sys/utsname.h> +++ |+#include 33 | ../../src/utility.c:298:5: note: each undeclared identifier is reported only once for each function it appears in 298 | errno = 0; | ^~~~~ make[1]: [Makefile:668: hp8753-utility.o] Fehler 1 make[1]: Verzeichnis „/home/dad/Downloads/Install/HP8753-Companion-main/build/src“ wird verlassen make: [Makefile:412: all-recursive] Fehler 1

Changing "errno = 0;" to "int errno = 0;" in line #298 fixes this issue.

(2) Besides, there might be issues when using your software in European countries, as we use a different character set. Specificly, the dezimal separator differs. We use a ',' instead of a '.'. So all non integer numbers received over the GPIB deliver wrong results, when converted using the "sscanf()" function inside your "gint askHP8753C_dbl()" function as it cannot interprete a dot inside the string when beeing used with European language settings.

Starting your program with "LC_ALL=C ./hp8753" clears all region settings and your program works fine. I've done that with a little batch file, you could do that inside the source code as well.

Finally, I'd like to make a wish: Would it be possible to add the ability importing ".ckm" files for calibration kits, as the wine-compatible version of the HP cal-kit-manager-2 cannot generate ".xkt" files and most calibration kits are specified using the .ckm format. Or could you give me a hint how to get the current version "Keysight cal kit editor" running under wine?

Thanks a lot and best regards Dietmar

Originally posted by @ddenoth in https://github.com/VK2BEA/HP8753-Companion/discussions/1#discussioncomment-4874264

VK2BEA commented 1 year ago

What Linux system (flavor) and version are you compiling for?

Yes, utility.h should have included the header <errno.h>. I'm not sure why I didn't get an error but one of the includes on my system must also include errno.h. I've added that header to utility.c.

The problem relating to 3.14159 on (US) vs 3,14159 (European) should be addressed with the line in hp8753.c https://github.com/VK2BEA/HP8753-Companion/blob/c1dcb16a3944ffb241644001f7d3607922588fd2/src/hp8753.c#L470

again, I'm not sure why this did not work for you. I will do some further investigations. ** edit It looks like I need to add this line also when I start the GPIB comms thread. I'll fix that.

I could not find a description of the ckt format anywhere. The .xkt is easily reverse engineered and parsed which is why I chose to use that. If you have any documentation that describes the .ckt files please let me know! The HP8753 does not take either format file directly but one has to apply each parameter with a separate GPIB command. The latest version of the Keysight cal kit editor outputs .xkt files https://www.keysight.com/us/en/lib/software-detail/computer-software/pna-service-applications.html (also you could use an xml editor)

ddenoth commented 1 year ago

Thanks for the link. You're right, the XML-format is fine. I'm using xubuntu 20.04 linux. Here please find my locals that are common when using the German Ubuntu(s):

dad@HP-Z420:~$ locale LANG=de_DE.UTF-8 LANGUAGE=de_DE LC_CTYPE="de_DE.UTF-8" LC_NUMERIC="de_DE.UTF-8" LC_TIME="de_DE.UTF-8" LC_COLLATE="de_DE.UTF-8" LC_MONETARY="de_DE.UTF-8" LC_MESSAGES="de_DE.UTF-8" LC_PAPER="de_DE.UTF-8" LC_NAME="de_DE.UTF-8" LC_ADDRESS="de_DE.UTF-8" LC_TELEPHONE="de_DE.UTF-8" LC_MEASUREMENT="de_DE.UTF-8" LC_IDENTIFICATION="de_DE.UTF-8" LC_ALL= dad@HP-Z420:~$

VK2BEA commented 1 year ago

I found that I had to set the locale in the thread as well as the main program (which seems odd to me). I tested with the de_UTF8 locale and it works now (with the update).

thanks, Michael

On Sun, Feb 5, 2023 at 11:24 AM ddenoth @.***> wrote:

Thanks for the link. You're right, the XML-format is fine. I'm using xubuntu 20.04 linux. Here please find my locals that are common when using the German Ubuntu(s):

@.:$ locale LANG=de_DE.UTF-8 LANGUAGE=de_DE LC_CTYPE="de_DE.UTF-8" LC_NUMERIC="de_DE.UTF-8" LC_TIME="de_DE.UTF-8" LC_COLLATE="de_DE.UTF-8" LC_MONETARY="de_DE.UTF-8" LC_MESSAGES="de_DE.UTF-8" LC_PAPER="de_DE.UTF-8" LC_NAME="de_DE.UTF-8" LC_ADDRESS="de_DE.UTF-8" LC_TELEPHONE="de_DE.UTF-8" LC_MEASUREMENT="de_DE.UTF-8" LC_IDENTIFICATION="de_DE.UTF-8" LC_ALL= @.:$

— Reply to this email directly, view it on GitHub https://github.com/VK2BEA/HP8753-Companion/issues/3#issuecomment-1418113522, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA43MTV4NVWOCRFJOSGFUCLWV7H5PANCNFSM6AAAAAAUR2EIYY . You are receiving this because you authored the thread.Message ID: @.***>

-- |\ ,,,---,, Michael Katzmann /,.-'' -. ;-;;, NV3Z / VK2BEA / G4NYV |,4- ) )-,. ,\ ( '-' '---''(_/--'-'_)

ddenoth commented 1 year ago

Hi Michael, I've just tried to build your new version on my system and no errors, thanks. The problem with setting the locales still persists, because on my machine "en_US" is not installed in /usr/lib/locale/ per default.

dad@HP-Z420:/usr/lib/locale$ ll insgesamt 15928 drwxr-xr-x 3 root root 4096 Feb 9 2021 ./ drwxr-xr-x 139 root root 12288 Feb 5 16:30 ../ drwxr-xr-x 3 root root 4096 Feb 9 2021 C.UTF-8/ -rw-r--r-- 1 root root 16287648 Mär 17 2021 locale-archive dad@HP-Z420:/usr/lib/locale$

Changing the function call to setlocale(LC_ALL, "C"); in hp8753.c and GPIBcommsThread.c seems to work fine.

Cheers Dietmar

VK2BEA commented 1 year ago

OK thanks. I'll make that change.