| Products > Test Equipment |
| Open source lxi-tools and liblxi v1.0 released for GNU/Linux |
| << < (5/67) > >> |
| RoGeorge:
Made a new build today and testing right now, so brace yourself for a lot of :blah: and :rant:, but no :clap:, even if you fully deserve all the appreciation. While my general impression about lxi-tools is a very good one :-+, and I highly appreciate what you already put there, in the next messages I will focus only on what I don't like, or on what didn't work as I expected. Many of them will rather be about my personal preferences and feature requests, maybe some misusage from my side, so not exactly a bug report. Didn't looked into the code yet. I will repeatedly post here while testing, but I will avoid discussing solutions during testing, so please don't get annoyed if I don't reply until tomorrow. |
| rhb:
--- Quote from: lundmar on November 05, 2017, 03:15:27 am ---I'm a professional SW engineer and I'm a big fan of POSIX and I use it extensively in most software that I write. However, for some applications, part of the software rely on system level features which are not covered by any of the available POSIX standards. In case of liblxi I'm relying on specific interfaces that allows me to discover and manage all available network interfaces to be used in the lxi discover feature. No such interfaces are available via POSIX. Hence I write that part of the code specifically for GNU/Linux systems because it is the most popular platform out there in the *nix world. --- End quote --- Other than not being portable to non-Gnu/Linux systems, I don't see what this does --- Quote ---int lxi_discover(struct lxi_info_t *info, int timeout) { struct sockaddr_in *broadcast_addr; struct ifaddrs *ifap; int status; // Go through available broadcast addresses if (getifaddrs(&ifap) == 0) { struct ifaddrs *ifap_p = ifap; while (ifap_p) { if ((ifap_p->ifa_addr) && (ifap_p->ifa_addr->sa_family == AF_INET)) { broadcast_addr = (struct sockaddr_in *) ifap_p->ifa_broadaddr; // Notify current broadcast address and network interface via callback if (info->broadcast != NULL) info->broadcast(inet_ntoa(broadcast_addr->sin_addr), ifap_p->ifa_name); // Find LXI devices via broadcast address status = discover_devices(broadcast_addr, info, timeout); } ifap_p = ifap_p->ifa_next; } freeifaddrs(ifap); } return LXI_OK; --- End quote --- that can't be done with this from POSIX.1 aka IEEE Std 1003.1 2004 --- Quote ---9964 NAME 19965 SYNOPSIS 19966 #include <net/if.h> if_nameindex — return all network interface names and indexes struct if_nameindex *if_nameindex(void); 19967 19968 DESCRIPTION 19969 The if_nameindex( ) function shall return an array of if_nameindex structures, one structure per 19970 interface. The end of the array is indicated by a structure with an if_index field of zero and an 19971 if_name field of NULL. 19972 Applications should call if_freenameindex( ) to release the memory that may be dynamically 19973 allocated by this function, after they have finished using it. 19974 RETURN VALUE 19975 An array of structures identifying local interfaces. A NULL pointer is returned upon an error, 19976 with errno set to indicate the error. 19977 ERRORS 19978 The if_nameindex( ) function may fail if: [ENOBUFS] 19979 Insufficient resources are available to complete the function. 19980 EXAMPLES 19981 None. 19982 APPLICATION USAGE 19983 None. 19984 RATIONALE 19985 None. 19986 FUTURE DIRECTIONS 19987 None. 19988 SEE ALSO 19989 getsockopt ( ), if_freenameindex( ), if_indextoname( ), if_nametoindex( ), setsockopt ( ), the Base 19990 Definitions volume of IEEE Std 1003.1-2001, <net/if.h> --- End quote --- It looks to me as if ifaddrs got written so someone could claim to be a Linux kernel contributor on their resume. Anger is not the correct word. Annoyed is more accurate. I hate seeing unportable code that could trivially have been written to be portable to any Unix system. I've had to fix far too much of it. Solaris is quite alive despite being So Larry's. Illumos (nee OpenSolaris) is actively developed and maintained by a number of small companies. And MacOS is Unix, as are FreeBSD, OpenBSD and NetBSD. If you don't understand the absurdity of autotools, then you don't grok the Unix tradition. In this particular instance, I probably will fix your code, starting with dumping autotools. An error generated by a compiler or linker is trivial to fix. An error generated by autotools is pretty much impossible. The Octave and autotools developers both blamed each other. |
| RoGeorge:
Just in case somebody else want to give it a try starting from the github sources, I built lxi-tools like this (on a Debian 8.9 jessie): --- Code: ---cd ~ mkdir lxi-tools cd lxi-tools/ git clone https://github.com/lxi/liblxi cd liblxi/ su apt-get update apt-get install automake apt-get install autogen autoconf libtool ./autogen.sh ./configure make make install cd .. git clone https://github.com/lxi/lxi-tools cd lxi-tools/ ./autogen.sh apt-get install libreadline-dev ./configure make make install exit cd .. # not required any more ??? # export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" lxi --- End code --- Test setup Debian 8 running inside VMware 12 Player running inside Windows 10 Three LXI instruments are connected to LAN: * 192.168.1.3 is a Rigol DS1054Z oscilloscope * 192.168.1.4 is a Rigol DP832 power supply * 192.168.1.5 is a Rigol DG4102 arbitrary waveform generator Tested commands 1. --- Code: ---rogeorge@debian80:~/lxi-tools$ lxi Usage: lxi [--version] [--help] <command> [<args>] -v, --version Display version -h, --help Display help Commands: discover [<options>] Search for LXI devices scpi [<options>] <scpi-command> Send SCPI command screenshot [<options>] [<filename>] Capture screenshot Discover options: -t, --timeout <seconds> Timeout (default: 3) Scpi options: -a, --address <ip> Device IP address -t, --timeout <seconds> Timeout (default: 3) -x, --dump-hex Print response in hexadecimal -f, --dump-file <filename> Save response to file -i, --interactive Enter interactive mode -s, --script <filename> Run script file -r, --raw Use raw/TCP -p, --raw-port <port> Use raw/TCP port (default: 5555) Screenshot options: -a, --address <ip> Device IP address -t, --timeout <seconds> Timeout (default: 15) -m, --model <name> Name of model -l, --list List supported models rogeorge@debian80:~/lxi-tools$ --- End code --- Passed 2. --- Code: ---rogeorge@debian80:~/lxi-tools$ lxi --version lxi v1.6 rogeorge@debian80:~/lxi-tools$ lxi -v lxi v1.6 rogeorge@debian80:~/lxi-tools$ lxi -h Usage: lxi [--version] [--help] <command> [<args>] -v, --version Display version -h, --help Display help Commands: discover [<options>] Search for LXI devices scpi [<options>] <scpi-command> Send SCPI command screenshot [<options>] [<filename>] Capture screenshot Discover options: -t, --timeout <seconds> Timeout (default: 3000) Scpi options: -a, --address <ip> Device IP address -t, --timeout <seconds> Timeout (default: 3000) -x, --dump-hex Print response in hexadecimal -f, --dump-file <filename> Save response to file -i, --interactive Enter interactive mode -s, --script <filename> Run script file -r, --raw Use raw/TCP -p, --raw-port <port> Use raw/TCP port (default: 5555) Screenshot options: -a, --address <ip> Device IP address -t, --timeout <seconds> Timeout (default: 15000) -m, --model <name> Name of model -l, --list List supported models rogeorge@debian80:~/lxi-tools$ lxi --help Usage: lxi [--version] [--help] <command> [<args>] -v, --version Display version -h, --help Display help Commands: discover [<options>] Search for LXI devices scpi [<options>] <scpi-command> Send SCPI command screenshot [<options>] [<filename>] Capture screenshot Discover options: -t, --timeout <seconds> Timeout (default: 3000) Scpi options: -a, --address <ip> Device IP address -t, --timeout <seconds> Timeout (default: 3000) -x, --dump-hex Print response in hexadecimal -f, --dump-file <filename> Save response to file -i, --interactive Enter interactive mode -s, --script <filename> Run script file -r, --raw Use raw/TCP -p, --raw-port <port> Use raw/TCP port (default: 5555) Screenshot options: -a, --address <ip> Device IP address -t, --timeout <seconds> Timeout (default: 15000) -m, --model <name> Name of model -l, --list List supported models rogeorge@debian80:~/lxi-tools$ --- End code --- Failed - Cosmetic Help syntax "Usage: lxi [--version] [--help] <command> [<args>]" suggests <command> is mandatory and the rest optional, but <command> is not mandatory i.e for help and version. Maybe consider "help" and "version" as commands instead of options, or change the help to something like "Usage: lxi --version | --help | <command> [<args>]" 3. --- Code: ---rogeorge@debian80:~/lxi-tools$ lxi discover Searching for LXI devices - please wait... Broadcasting on interface lo Broadcasting on interface eth0 Found "RIGOL TECHNOLOGIES,DS1104Z,DS1ZA16*,00.04.04.SP3" on address 192.168.1.3 Found "Rigol Technologies,DG4102,DG4E17*,00.01.12 4.SP3" on address 192.168.1.5 Found "RIGOL TECHNOLOGIES,DP832,DP8C16*,00.01.11 4.SP3" on address 192.168.1.4 Found 3 devices rogeorge@debian80:~/lxi-tools$ --- End code --- Failed - Major inconvenience Leftovers from the previous instrument description text to the next instrument description. This must be investigated, just to be sure there is no out of range memory addressing at runtime. The *IDN? answer for the last 2 instruments is: --- Code: ---rogeorge@debian80:~/lxi-tools$ lxi scpi -a 192.168.1.5 *IDN? Rigol Technologies,DG4102,DG4E17*,00.01.12 rogeorge@debian80:~/lxi-tools$ lxi scpi -a 192.168.1.4 *IDN? RIGOL TECHNOLOGIES,DP832,DP8C16*,00.01.11 rogeorge@debian80:~/lxi-tools$ --- End code --- |
| RoGeorge:
4. --- Code: ---rogeorge@debian80:~/lxi-tools$ lxi discovery Error: No IP address specified rogeorge@debian80:~/lxi-tools$ --- End code --- Failed - Minor inconvenience Misleading error message. There is a typo in the command name, "discovery" instead of "discover", not a missing IP. |
| glarsson:
--- Quote from: rhb on November 06, 2017, 05:10:30 pm ---I hate seeing unportable code that could trivially have been written to be portable to any Unix system. I've had to fix far too much of it. --- End quote --- Agree 100%. A common way to write code for Linux is to grep /usr/include until you find something. |O |
| Navigation |
| Message Index |
| Next page |
| Previous page |