Mouse double click speed

Trouble like me with Mouse double click speed?

Google “lxde double click speed”, there is a hidden file named “.gtkrc-2.0” in your home directory. So if it does not exist, create it. If it does exit, read it before you proceed — it may advise you to use “.gtkrc-2.0.mine” instead.
Type these commands from the prompt, or inside LXTerminal.

sudo nano ~/.gtkrc-2.0

Add the following line:

gtk-double-click-time=1000

Press Ctrl – X, y and enter to save and quit the editor. Logout of the desktop and startx again for it to take effect.

RPI_HAL

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

Arduino on Raspberry

Install Arduino on Buster

  1. Arduino 1.8.12 (or higher) from arduino.cc – Software – Arduino ARM 32 bits
  2. Download to e.g. Downloads
  3. cd /Downloads
  4. tar -x -f arduino-1.8.5-linuxarm.tar.xz
  5. cd arduino-1.8.12
  6. sudo ./install.sh
  7. and Arduino appears in Home – Programming desktop

XRDP revisited

Shutdown menu not working:

You can get the Buttons working, just change the line ‘Logout=lxde-pi-shutdown-helper’ to ‘Logout=sudo lxde-pi-shutdown-helper’
in ‘/home/pi/.config/lxpanel/LXDE-pi/config’.

Install Freepascal/Lazarus again

For Buster see here!

Installed using instructions from several posts by Thaddy as follows:

1. Add stretch-backports to sources.list

Create:   sudo nano /etc/apt/sources.list.d/backports.list
Add:      deb http://ftp.debian.org/debian stretch-backports main

Update:   sudo apt-get update

Ignore complaints about not signed

2.  FPC 3.0.4 and Lazarus 1.8.4 are both in stretch-backports

Use apt or apt-get, need to install with the -t option.
Answer Y to install without verification.

sudo apt-get -t stretch-backports install fpc
sudo apt-get -t stretch-backports install lazarus

Ignore complaints about not verified

Shutdown Raspbian with a button

he simplest way to set up a “pushbutton to shut down” is to add “dtoverlay=gpio-shutdown” to /boot/config.txt and rig a NO momentary contact switch across pins 5 and 6. Push once to shut down the system. Push again to reboot it.

dtoverlay=gpio-shutdown,gpio_pin=3

To avoid I2c being unusable:GPIO26 is physical pin 37
dtoverlay=gpio-shutdown,gpio_pin=26

pi@raspberrypi:~ $ dtoverlay -h gpio-shutdown
Name:   gpio-shutdown

Info:   Initiates a shutdown when GPIO pin changes. The given GPIO pin
        is configured as an input key that generates KEY_POWER events.
        This event is handled by systemd-logind by initiating a
        shutdown. Systemd versions older than 225 need an udev rule
        enable listening to the input device:

                ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
                        SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
                        ATTRS{keys}=="116", TAG+="power-switch"

        This overlay only handles shutdown. After shutdown, the system
        can be powered up again by driving GPIO3 low. The default
        configuration uses GPIO3 with a pullup, so if you connect a
        button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
        you get a shutdown and power-up button.

Usage:  dtoverlay=gpio-shutdown,=

Params: gpio_pin                GPIO pin to trigger on (default 3)

        active_low              When this is 1 (active low), a falling
                                edge generates a key down event and a
                                rising edge generates a key up event.
                                When this is 0 (active high), this is
                                reversed. The default is 1 (active low).

        gpio_pull               Desired pull-up/down state (off, down, up)
                                Default is "up".

                                Note that the default pin (GPIO3) has an
                                external pullup.
The default GPIO is 3 (which appears on pin 5 of the 40-pin header). The pin is configured to pull high by default (which is also the SoC's default), and the GPIO is marked as active low (the opposite to the pull, for obvious reasons).

If you are having trouble, you can debug using raspi-gpio on Raspbian. Assuming for now that the overlay applied correctly (lsmod should show gpio-keys as being loaded), raspi-gpio get 3 will show the pin level (which should be 1) and function (INPUT). Now run it in a loop:

pi@raspberrypi:~ $ while true; do raspi-gpio get 3; done
Attach one end of a patch lead to pin 5 (GPIO3), and touch the other end on pin 6 (GND) - the Pi should shut down immediately, but if not you will see the pin level change to 0.