rpi_hal from https://github.com/rudiratlos/rpi-hal is an incredible rich and uptodate unit for Freepascal to use the I/O of the Raspberry.
From Freepascal programs all works as expected when run as root. Otherwise accessing /dev/mem is causing real problems.
The unit can be used from Lazarus also (avoid the test procedures with writeln’ š ) but also require root access and setting cthreads in the program heading.
For X appsĀ running as root is not possible with just sudo.
Seems I found a solution here:Ā https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root
I applied method 2:
sudo nano /etc/profile
and added this line as last line
export XAUTHORITY=/home/pi/.Xauthority
Now i can do
$ sudo ./testinit (my simple test program with only the init line of rpi_hal)
and this worked without error, init succeeded.
If you want debugging the app in Lazarus, start Lazarus as root (and ignore all the warnings)
xhost +localhost
sudo /usr/bin/startlazarus
Original text fromĀ https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root
Method 2: Globally in /etc/profile
Add the following line to /etc/profile:
export XAUTHORITY=/home/username/.Xauthority
This will permanently allow root to connect to a non-root user’s X server.
Or, merely specify a particular app:
XAUTHORITY=/home/username/.Xauthority appname
where appname is the name of the particular app. (e.g. kwrite
Related posts:
RasPiO Pro Hat is a small Raspberry Pi add-on which... protects the Pi's ports in case you make a wiri...
When surfing for information on 3.5 " TFT touchscreens for the Raspberry Pi, to improve the TinyLCD experience, I stumbl...
With all the different revisions and the two major supplier it will come as no surprise the packaging has varied quite a...
Starting with the announcement in 2011 and the fist available batch of B's in 2012 my collection of Pi's covers most rev...