Source: reTerminal Built-In Devices
Note: raw/reTerminal built-in devices 1.md is identical to this file.
Programmable Interfaces via /sys/
All programmable data on Linux is exposed as files. reTerminal built-in devices use this principle.
3 Programmable LEDs
| LED | Color |
|---|---|
usr_led0 | green |
usr_led1 | green |
usr_led2 | red or green (STA light) |
Control path: /sys/class/leds/<led_name>/brightness
Brightness values: 0 = off, 255 = full brightness
Buzzer
Path: /sys/class/leds/usr_buzzer/brightness
Value: 0 = off, any non-zero = on
Luminosity Sensor
Path: /sys/bus/iio/devices/iio:device0/in_illuminance_input
cat /sys/bus/iio/devices/iio:device0/in_illuminance_input
# Output: 2719 (value in Lux)Readable by all users (permissions: rw-r--r-- root root) — no sudo needed.
Permissions Problem (LEDs/Buzzer)
The /sys/class/leds/*/brightness files are root-owned, write-restricted:
-rw-r--r-- 1 root root 4096 Jan 26 brightness
These all FAIL:
echo 255 > /sys/class/leds/usr_led0/brightness # Permission denied
sudo echo 255 > /sys/class/leds/usr_led0/brightness # Still denied! (> runs as user)Why sudo echo > file fails: sudo applies to the echo command, not to the > redirect. The redirect runs as the current user, which lacks write permission.
Solution: sudo + tee
tee reads stdin and writes to both stdout AND files.
echo 255 | sudo tee /sys/class/leds/usr_led0/brightness # LED on
echo 0 | sudo tee /sys/class/leds/usr_led0/brightness # LED off
echo 1 | sudo tee /sys/class/leds/usr_buzzer/brightness # Buzzer on
echo 0 | sudo tee /sys/class/leds/usr_buzzer/brightness # Buzzer offsudo applies to tee, which has root permission to write to the file.
seeed-python-rpi Python Library
Install
pip install git+https://github.com/Seeed-Studio/Seeed_Python_RPi/
pip install RPi-GPIOUsage
import seeed_python_rpi.core as rt
import time
# Buzzer
rt.buzzer = True
time.sleep(1)
rt.buzzer = False
# LEDs (same pattern: rt.led0, rt.led1, etc.)Running with root (required for hardware access)
# Method 1: command substitution (recommended)
sudo $(which python) buzz.py
# Method 2: elevate shell first
sudo -i
python buzz.pyThe library is a wrapper around the /sys/ file operations.
Screen Orientation (kanshi + labwc)
To set landscape mode permanently:
- Edit
~/.config/kanshi/config— changetransformto270 - Edit
~/.config/labwc/rc.xml— add touch device mapping forseeed-tp
See Also
- GPIO and reTerminal topic
- Linux and Bash Commands topic (tee, sudo)