Accessing piTest directly with C

Topics about the Software of Revolution Pi
Post Reply
KristinH
Posts: 20
Joined: 01 Nov 2024, 16:01

Accessing piTest directly with C

Post by KristinH »

I am trying access the IO directly withy piTest.

I have found the source code here: https://gitlab.com/revolutionpi/revpi-pitest

but when I try to build it I get these errors:

Code: Select all

pi@RevPi110811:~$ git clone --recurse-submodules https://gitlab.com/revolutionpi/revpi-pitest.git
cd revpi-pitest
mkdir build && cd build
sudo cmake ..
sudo cmake --build .
Cloning into 'revpi-pitest'...
remote: Enumerating objects: 578, done.
remote: Counting objects: 100% (455/455), done.
remote: Compressing objects: 100% (204/204), done.
remote: Total 578 (delta 241), reused 449 (delta 240), pack-reused 123 (from 1)
Receiving objects: 100% (578/578), 797.83 KiB | 3.37 MiB/s, done.
Resolving deltas: 100% (288/288), done.
Submodule 'lib/piControl' (https://gitlab.com/revolutionpi/piControl) registered for path 'lib/piControl'
Cloning into '/home/pi/revpi-pitest/lib/piControl'...
warning: redirecting to https://gitlab.com/revolutionpi/piControl.git/
remote: Enumerating objects: 2763, done.
remote: Counting objects: 100% (363/363), done.
remote: Compressing objects: 100% (129/129), done.
remote: Total 2763 (delta 232), reused 344 (delta 226), pack-reused 2400 (from 1)
Receiving objects: 100% (2763/2763), 1.09 MiB | 9.14 MiB/s, done.
Resolving deltas: 100% (1959/1959), done.
Submodule path 'lib/piControl': checked out '8e867a1f80ca85ca769844fe1177011e17efb471'
-- The C compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/revpi-pitest/build
[ 33%] Building C object src/CMakeFiles/piTest.dir/piTest.c.o
[ 66%] Building C object src/CMakeFiles/piTest.dir/piControlIf.c.o
[100%] Linking C executable piTest
[100%] Built target piTest
[100%] Built target piControlReset
/bin/sh: 1: scdoc: not found
gmake[2]: *** [doc/CMakeFiles/piTest.1.dir/build.make:70: doc/CMakeFiles/piTest.1] Error 127
gmake[1]: *** [CMakeFiles/Makefile2:170: doc/CMakeFiles/piTest.1.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
tboehler
KUNBUS
Posts: 7
Joined: 02 May 2023, 16:22

Re: Accessing piTest directly with C

Post by tboehler »

Hello!

piTest uses scdoc[1] to build the manual page doc/piTest.1.scd. This dependency was not found, which is what CMake is trying to say when it prints this error during the build:

Code: Select all

/bin/sh: 1: scdoc: not found
Building piTest without building the manual page isn't currently supported, so you have to install the dependency first:

Code: Select all

sudo apt install scdoc
Also note that using sudo is not required (or recommended) when building piTest from source.

If you're just trying to use piTest on the RevPi it should already be installed by default in our images and you can use it by just calling piTest on the console.

Good luck!

[1]: https://git.sr.ht/~sircmpwn/scdoc/
KristinH
Posts: 20
Joined: 01 Nov 2024, 16:01

Re: Accessing piTest directly with C

Post by KristinH »

Thank you,

I have installed scdoc and successfully built piTest.

I have been able to use piTest from the command line, but what I need to be able to do is use it from within C. I found a similar ask on this forum which pointed to using the piControl and piTest code as examples. So that is why i'm going down this particular rabbit-hole.

Do you have a C library interface to piControl and piTest without downloading and rebuilding code?
tboehler
KUNBUS
Posts: 7
Joined: 02 May 2023, 16:22

Re: Accessing piTest directly with C

Post by tboehler »

I'm afraid we don't have any C library that wraps the functionality of piTest or piControl. However, if you're not limited to a C library and are okay with using python, revpimodio is really what you should use: https://revpimodio.org/

piTest itself is interfacing with piControl, which does all the heavy work. The interface is a bunch of kernel ioctl's as I've previously described in another post here: viewtopic.php?p=16799#p16799. This is currently the only C interface that we have.
Post Reply