rgs(1)

πŸ“¦
version 0.2.0.0 Β· 3 versions
, in ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

welcome to rgs(1) from the lg archive section bestie πŸ’– β€” this is the manual for rgs, and yes it's a whole vibe, and yes we're getting through all of it together, no skimming, no skipping. 🌸


πŸ’– NAME πŸ’–

rgs β€” a shell command to manipulate a remote SBC's GPIO. That's it, that's the whole thing, she's a shell command and she's coming for your GPIO from across the network. πŸ¦‹


✨ SYNOPSIS ✨

okay so first you gotta have the daemon running, then you talk to it:

rgpiod &

then

rgs {command}+

🌈 DESCRIPTION 🌈

rgs is a program that lets you remote-control the GPIO and other functions of Linux SBCs that are running the rgpiod daemon. So like, the daemon is the main character on the SBC, and rgs is you, texting it from your laptop. πŸ’…

The rgpiod daemon must be running on the SBCs you wish to control. No daemon, no vibes. Periodt.

πŸŽ€ Features πŸŽ€

she does a lot, actually:

  • reading and writing GPIO singly and in groups
  • software timed PWM and waves
  • GPIO callbacks
  • pipe notification of GPIO events
  • I2C wrapper
  • SPI wrapper
  • serial link wrapper
  • simple file handling
  • creating and running scripts on the rgpiod daemon

πŸ“ Usage πŸ“

rgs {command}+

rgs will show the result of the command on screen, right there, for you. πŸ‘‘

The rgs process returns an exit status (which you can display with the command echo $? β€” you know this one, bestie).

  • RGS_OK β€” 0
  • RGS_CONNECT_ERR β€” 255
  • RGS_OPTION_ERR β€” 254
  • RGS_SCRIPT_ERR β€” 253

If an error was detected a message will have been written to stderr. That message is likely to be more informative than the message returned by rgs, so like... actually read your stderr, she's trying to help you. 😭

Several commands may be entered on a line. If present, PROC and PARSE must be the last command on a line. (that's a rule, don't fight it)

πŸ¦‹ Notes πŸ¦‹

rgs does not show the status of successful commands unless the command itself returns data. The status (0) will be returned to rgs but will be discarded. she's quiet when she's winning, iconic behaviour tbh.

When a command takes a number as a parameter it may be entered as hex (precede by 0x), octal (precede by 0), or decimal.

E.g. 23 is 23 decimal, 0x100 is 256 decimal, 070 is 56 decimal.

Some commands can return a variable number of data bytes. By default this data is displayed as decimal. The rgs -a option can be used to force the display as ASCII and the rgs -x option can be used to force the display as hex.

E.g. assuming the transmitted serial data is the letters ABCDEONM

$ rgs serr 4 100 # assumes serial data available from handle 4
8 65 66 67 68 69 79 78 77

$ rgs -a serr 4 100
8 ABCDEONM

$ rgs -x serr 4 100
8 41 42 43 44 45 4f 4e 4d

look at her switching up formats on demand, she's so versatile πŸ’…

πŸ‘‘ Permissions πŸ‘‘

Generally, objects created on the rgpiod daemon exist for the duration of the socket connection.

  • For a Python script this will be for the duration of the script.
  • For a program linked with rgpio this will be for the duration of the program.
  • For rgs it is the command line.

Which means the following command will achieve little:

rgs go 0 # get handle to gpiochip 0

The daemon will delete the handle as soon as the rgs command has finished. like, gone. poof. πŸ™ˆ

To preserve the handle it must be shared.

A lot of the examples will show the command c 1 (use share id 1). This means the handle is preserved and may be used in subsequent commands.

rgs c 1 go 0 # get and preserve handle to gpiochip 0

If the LG_SHARE environment variable exists that share will be automatically used in rgs commands.

E.g. export LG_SHARE=12 will automatically use share id 12.

If a command is privileged it is indicated in the notes for the command. The examples given here assume the daemon access control system is not active (so any user can use privileged commands).

If the LG_USER environment variable exists that user will be automatically used in rgs commands. This only has an effect if the rgpiod daemon is running with access control enabled.

E.g. export LG_USER=joan will automatically use user joan.


⭐ OVERVIEW ⭐

πŸ’œ FILES πŸ’œ

  • FO file mode β€” File open
  • FC h β€” File close
  • FR h num β€” File read
  • FW h bvs β€” File write
  • FS h num from β€” File seek
  • FL pat num β€” File list

πŸ’œ GPIO πŸ’œ

  • GO gc β€” gpiochip open device
  • GC h β€” gpiochip close device
  • GIC h β€” gpiochip information
  • GIL h g β€” gpiochip line information
  • GMODE h g β€” GPIO get mode
  • GSI h g β€” GPIO claim for input (simple)
  • GSIX h lf g β€” GPIO claim for input
  • GSO h g β€” GPIO claim for output (simple)
  • GSOX h lf g v β€” GPIO claim for output
  • GSA h g nfyh β€” GPIO claim for alerts (simple)
  • GSAX h lf ef g nfyh β€” GPIO claim for alerts
  • GSF h g β€” GPIO free
  • GSGI h g* β€” GPIO group claim for inputs (simple)
  • GSGIX h lf g* β€” GPIO group claim for inputs
  • GSGO h g* β€” GPIO group claim for outputs (simple)
  • GSGOX h lf g* v* β€” GPIO group claim for outputs
  • GSGF h g β€” GPIO group free
  • GR h g β€” GPIO read
  • GW h g v β€” GPIO write
  • GGR h g β€” GPIO group read
  • GGW h g gbits β€” GPIO group write (simple)
  • GGWX h g gbits gmask β€” GPIO group write
  • GP h g mon moff β€” GPIO tx pulse (simple)
  • GPX h g mon moff off cyc β€” GPIO tx pulse
  • P h g pf pdc β€” GPIO tx PWM (simple)
  • PX h g pf pdc off cyc β€” GPIO tx PWM
  • S h g spw β€” GPIO tx servo pulses (simple)
  • SX h g spw sf off cyc β€” GPIO tx servo pulses
  • GWAVE h g p* β€” GPIO group tx wave
  • GBUSY h g k β€” GPIO or group tx busy
  • GROOM h g k β€” GPIO or group tx entries
  • GDEB h g us β€” GPIO debounce time
  • GWDOG h g us β€” GPIO watchdog time

πŸ’œ I2C πŸ’œ

  • I2CO ib id if β€” I2C open device
  • I2CC h β€” I2C close device
  • I2CWQ h bit β€” SMB Write Quick: write bit
  • I2CRS h β€” SMB Read Byte: read byte
  • I2CWS h bv β€” SMB Write Byte: write byte
  • I2CRB h r β€” SMB Read Byte Data: read byte from register
  • I2CWB h r bv β€” SMB Write Byte Data: write byte to register
  • I2CRW h r β€” SMB Read Word Data: read word from register
  • I2CWW h r wv β€” SMB Write Word Data: write word to register
  • I2CRK h r β€” SMB Read Block Data: read data from register
  • I2CWK h r bvs β€” SMB Write Block Data: write data to register
  • I2CWI h r bvs β€” SMB Write I2C Block Data
  • I2CRI h r num β€” SMB Read I2C Block Data: read bytes from register
  • I2CRD h num β€” I2C read device
  • I2CWD h bvs β€” I2C write device
  • I2CPC h r wv β€” SMB Process Call: exchange register with word
  • I2CPK h r bvs β€” SMB Block Process Call: exchange data bytes with register
  • I2CZ h bvs β€” I2C zip

πŸ’œ NOTIFICATIONS πŸ’œ

  • NO β€” Notification open
  • NC h β€” Notification close
  • NP h β€” Notification pause
  • NR h β€” Notification resume

πŸ’œ SCRIPTS πŸ’œ

  • PROC t β€” Script store
  • PROCR h pars β€” Script run
  • PROCU h pars β€” Script update parameters
  • PROCP h β€” Script get status and parameters
  • PROCS h β€” Script stop
  • PROCD h β€” Script delete
  • PARSE t β€” Script validate

πŸ’œ SERIAL πŸ’œ

  • SERO dev b sef β€” Serial open device
  • SERC h β€” Serial close device
  • SERRB β€” Serial read byte
  • SERWB h bv β€” Serial write byte
  • SERR h num β€” Serial read bytes
  • SERW h bvs β€” Serial write bytes
  • SERDA h β€” Serial data available

πŸ’œ SHELL πŸ’œ

  • SHELL name str β€” Execute a shell command

πŸ’œ SPI πŸ’œ

  • SPIO spd spc b spf β€” SPI open device
  • SPIC h β€” SPI close device
  • SPIR h num β€” SPI read bytes
  • SPIW h bvs β€” SPI write bytes
  • SPIX h bvs β€” SPI transfer bytes

πŸ’œ UTILITIES πŸ’œ

  • LGV β€” Get lg library version
  • SBC β€” Get SBC's host name
  • CGI cid β€” Get internal configuration setting
  • CSI cid v β€” Set internal configuration setting
  • T/TICK β€” Get nanoseconds since the epoch
  • MICS v β€” Microseconds delay
  • MILS v β€” Milliseconds delay
  • U/USER β€” Set user
  • C/SHARE β€” Set share
  • LCFG β€” Reload permits configuration file
  • PCD β€” Print daemon configuration directory
  • PWD β€” Print daemon working directory

🫢 COMMANDS 🫢

okay bestie, this is the big one. deep breaths. we're doing all of them.

🌸 FILES 🌸

FO file mode β€” File open 🌸

This is a privileged command. See permits.

This function returns a handle to a file opened in a specified mode.

Upon success a handle (>=0) is returned. On error a negative status code will be returned.

The mode may have the following values.

  • READ = 1 β€” open file for reading
  • WRITE = 2 β€” open file for writing
  • RW = 3 β€” open file for reading and writing

The following values may be or'd into the mode.

  • APPEND = 4 β€” All writes append data to the end of the file
  • CREATE = 8 β€” The file is created if it doesn't exist
  • TRUNC = 16 β€” The file is truncated

Newly created files are owned by the user that launched the daemon with permissions owner read and write.

Example

ls /ram/*.c
/ram/q.c     /ram/qdhtxx.c  /ram/q-errcod.c  /ram/q_t1.c
/ram/q-c1.c  /ram/Q-err.c   /ram/q-group.c   /ram/q_t2.c

$ rgs c 1 fo /ram/q.c 1  # read access
1

$ rgs c 1 fo /ram/new.c 1 # file does not exist
-58
ERROR: file open failed

$rgs c 1 fo /ram/new.c 9 # can not create file
-67
ERROR: no permission to access file

FC h β€” File close 🌸

This command closes a file previously opened by FO.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 fc 1 # First close okay.

$ rgs c 1 fc 1 # Second fails.
-5
ERROR: unknown handle

FR h num β€” File read 🌸

This command returns up to num bytes of data read from the file.

Upon success the count of returned bytes followed by the bytes themselves is returned. On error a negative status code will be returned.

Example

$ rgs c 1 fr 0 10
5 48 49 128 144 255

$ rgs c 1 fr 0 10
0

FW h bvs β€” File write 🌸

This command writes bvs bytes to the file.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 fw 0 23 45 67 89

FS h num from β€” File seek 🌸

This command seeks to a position within the file.

The number of bytes to move is num. Positive offsets move forward, negative offsets backwards. The move start position is determined by from as follows.

  • 0 β€” start
  • 1 β€” current position
  • 2 β€” end

Upon success the new byte position within the file (>=0) is returned. On error a negative status code will be returned.

Example

$ rgs c 1 fs 0 200 0 # Seek to start of file plus 200
200

$ rgs c 1 fs 0 0 1 # Return current position
200

$ rgs c 1 fs 0 0 2 # Seek to end of file, return size
296235

FL pat num β€” File list 🌸

This command returns a list of the files matching pat. Up to num bytes may be returned.

Upon success the count of returned bytes followed by the matching files is returned. On error a negative status code will be returned.

A newline (0x0a) character separates each file name.

This is a privileged command. See permits.

Example

$ rgs -a fl "/sys/bus/w1/devices/28*/w1_slave" 5000
90 /sys/bus/w1/devices/28-000005d34cd2/w1_slave
/sys/bus/w1/devices/28-001414abbeff/w1_slave

$ rgs -a fl "/sys/bus/*" 5000
ERROR: no permission to access file
-67

🌸 GPIO 🌸

GO gc β€” gpiochip open device 🌸

This is a privileged command. See permits.

This command opens a gpiochip.

Example

(...and that's exactly where this part of the page stops, bestie β€” the GO example is mid-sentence and there's so much more coming: GC, GIC, the whole GS family, I2C, SPI, scripts, all of it. don't go anywhere πŸ’–)

$ rgs c 1 go 0 # open /dev/gpiochip0
1
$ rgs c 1 go 23 # try to open /dev/gpiochip23
-78
ERROR: can not open gpiochip

πŸŽ€ GC h β€” gpiochip close device πŸŽ€

This one closes a gpiochip that you already opened with GO. bye bestie πŸ‘‹

Example

$ rgs c 1 gc 1 # first close ok
$ rgs c 1 gc 1 # already closed
-5
ERROR: unknown handle

✨ GIC h β€” gpiochip information ✨

Gets the deets on an opened gpiochip. Specifically it gets the number of GPIO on the gpiochip, its name, and its usage. the way it just tells you things πŸ’…

Example

$ rgs c 1 gic 1
54 "gpiochip0" "pinctrl-bcm2835"

🌸 GIL h g β€” gpiochip line information 🌸

Gets the info for GPIO g of an opened gpiochip. In particular it gets the GPIO number, line flags, its user, and its purpose. full profile, no filter 🫢

The meaning of the line flags bits is the same as the ones given for the mode by GMODE (scroll down, it's right there).

The user and purpose fields are filled in by the software which has claimed the GPIO and may be blank. so like… don't panic if they're empty, it's giving "nobody claimed me yet" energy 😭

Example

$ for ((i=2; i<10; i++)); do rgs c 1 gil 1 $i; done
2 65536 "SDA1" ""
3 65536 "SCL1" ""
4 65536 "GPIO_GCLK" ""
5 65536 "GPIO5" ""
6 65536 "GPIO6" ""
7 7 "SPI_CE1_N" "spi0 CS1"
8 7 "SPI_CE0_N" "spi0 CS0"
9 65536 "SPI_MISO" ""

πŸ”₯ GMODE h g β€” GPIO get mode πŸ”₯

Gets the mode for GPIO g of an opened gpiochip. and it comes with a whole bit menu, so let's get into it:

  • Bit 0 β€” Value 1 β€” Kernel: In use by the kernel
  • Bit 1 β€” Value 2 β€” Kernel: Output
  • Bit 2 β€” Value 4 β€” Kernel: Active low
  • Bit 3 β€” Value 8 β€” Kernel: Open drain
  • Bit 4 β€” Value 16 β€” Kernel: Open source
  • Bit 5 β€” Value 32 β€” Kernel: Pull up set
  • Bit 6 β€” Value 64 β€” Kernel: Pull down set
  • Bit 7 β€” Value 128 β€” Kernel: Pulls off set
  • Bit 8 β€” Value 256 β€” LG: Input
  • Bit 9 β€” Value 512 β€” LG: Output
  • Bit 10 β€” Value 1024 β€” LG: Alert
  • Bit 11 β€” Value 2048 β€” LG: Group
  • Bit 12 β€” Value 4096 β€” LG: ---
  • Bit 13 β€” Value 8192 β€” LG: ---
  • Bit 14 β€” Value 16384 β€” LG: ---
  • Bit 15 β€” Value 32768 β€” LG: ---
  • Bit 16 β€” Value 65536 β€” Kernel: Input
  • Bit 17 β€” Value 1<<17 β€” Kernel: Rising edge alert
  • Bit 18 β€” Value 1<<18 β€” Kernel: Falling edge alert
  • Bit 19 β€” Value 1<<19 β€” Kernel: Realtime clock alert
The LG bits are only set if the query was made by the process that owns the GPIO. so it's giving ✨exclusive access✨ iykyk

πŸ’œ GSI h g β€” GPIO claim for input (simple) πŸ’œ

Claims GPIO g for input. mine now πŸ™ˆ

Example

$ rgs c 1 gsi 1 23 # claim GPIO 23 for input.

πŸ¦‹ GSIX h lf g β€” GPIO claim for input πŸ¦‹

Claims GPIO g for input. same vibe, but with ✨options✨

The line flags lf may be used to set the GPIO as active low, open drain, open source, pull up, pull down, pull off.

Example

$ rgs c 1 gsi 1 0 23 # claim GPIO 23 for input.

⭐ GSO h g β€” GPIO claim for output (simple) ⭐

Claims GPIO g for output.

The GPIO will be initialised low. lowkey starting low and humble fr

Example

$ rgs c 1 gso 1 25 # claim GPIO 25 for low output.

πŸ‘‘ GSOX h lf g v β€” GPIO claim for output πŸ‘‘

Claims GPIO g for output.

The line flags lf may be used to set the GPIO as active low, open drain, open source, pull up, pull down, pull off.

If v is zero the GPIO will be initialised low. If any other value is used the GPIO will be initialised high. zero = low, anything else = high, that's the whole rule, periodt πŸ’…

Example

$ rgs c 1 gso 1 0 25 # claim GPIO 25 for high output.

πŸ“ GSA h g nfyh β€” GPIO claim for alerts (simple) πŸ“

Claims GPIO g for alerts.

Alerts will be generated for both edges. equal opportunity alerting honestly.

The alerts will be sent to a previously opened notification pipe nfyh.

🌈 GSAX h lf ef g nfyh β€” GPIO claim for alerts 🌈

Claims GPIO g for alerts.

The line flags lf may be used to set the GPIO as active low, open drain, open source, pull up, pull down, pull off.

The event flags ef specify whether alerts should be generated on a rising edge, a falling edge, or both edges.

The alerts will be sent to a previously opened notification pipe nfyh.

πŸ’€ GSF h g β€” GPIO free πŸ’€

Releases GPIO g. The GPIO may now be claimed by another user or for a different purpose. we're letting it go, it's not you it's the pin assignment 😭

🧚 GSGI h *g** β€” GPIO group claim for inputs (simple) 🧚

Claims a group of GPIO for inputs. squad goals.

*g** is a list of one or more GPIO. The first GPIO in the list is called the group leader and is used to reference the group as a whole. main character energy of the group ngl πŸ‘‘

Example

$ rgs c 1 gsgi 1 16 17 18 19 20 21

🫢 GSGIX h lf *g** β€” GPIO group claim for inputs 🫢

Claims a group of GPIO for inputs. All the GPIO share the same line flag setting. matching fits, love that for them πŸ’–

The line flags lf may be used to set the GPIO as active low, open drain, open source, pull up, pull down, pull off.

*g** is a list of one or more GPIO. The first GPIO in the list is called the group leader and is used to reference the group as a whole.

Example

$ rgs c 1 gsgix 1 0 16 17 18 19 20 21

🌟 GSGO h *g** β€” GPIO group claim for outputs (simple) 🌟

Claims a group of GPIO for outputs.

*g** is a list of one or more GPIO. The first GPIO in the list is called the group leader and is used to reference the group as a whole.

The GPIO will be initialised low.

Example

$ rgs c 1 gsgo 1 22 23 24 25

πŸŽ€ GSGOX h lf *g** *v** β€” GPIO group claim for outputs πŸŽ€

Claims a group of GPIO for outputs. All the GPIO and share the same line flag setting. besties who configure together stay together πŸ’…

The line flags lf may be used to set the GPIO as active low, open drain, open source, pull up, pull down, pull off.

*g** is a list of one or more GPIO. The first GPIO in the list is called the group leader and is used to reference the group as a whole.

*v** is a list of initialisation values for the GPIO. If a value is zero the corresponding GPIO will be initialised low. If any other value is used the corresponding GPIO will be initialised high.

Example

$ rgs c 1 gsgox 1 0 22 23 24 25 1 1 1 1

πŸ’œ GSGF h g β€” GPIO group free πŸ’œ

Releases the group of GPIO identified by the group leader g. The GPIO may now be claimed by another user or for a different purpose. the whole groupchat is disbanding 😭

Example

rgs c 1 gsgf 1 22

⚑ GR h g β€” GPIO read ⚑

Returns the current value (0 or 1) of GPIO g.

This command will work for any claimed GPIO (even if a member of a group). For an output GPIO the value returned will be that last written to the GPIO.

Example

$ rgs c 1 gr 1 22
1

πŸ”₯ GW h g v β€” GPIO write πŸ”₯

Sets the value (0 or 1) of GPIO g.

This command will work for any GPIO claimed as an output (even if a member of a group).

If v is zero the GPIO will be set low. If any other value is used the GPIO will be set high.

🌈 GGR h g β€” GPIO group read 🌈

Reads a group of GPIO identified by group leader g.

This command will work for an output group as well as an input group. For an output group the value returned will be that last written to the group GPIO. Note that this command will also work on an individual GPIO claimed as an input or output as that is treated as a group with one member. solo group, still a group, no gatekeeping here 🫢

Two values are returned. The first is the group size (the number of GPIO in the group). The second is the group bits as a decimal value.

Bit 0 is the level of the group leader. Bit 1 is the level of the second GPIO in the group. Bit g is the level of GPIO g+1 in the group.

Example

$ rgs c 1 gsgi 1 0 16 17 18 19 20 21
$ rgs c 1 ggr 1 16
6 49 # six GPIO, group leader (16) high, 17-19 low, 20-21 high

✨ GGW h g gbits β€” GPIO group write (simple) ✨

Writes a group of GPIO identified by group leader g.

The values of each GPIO of the group are set according to the bits of gbits.

Bit 0 sets the level of the group leader. Bit 1 sets the level of the second GPIO in the group. Bit g sets the level of GPIO g+1 in the group.

Example

$ rgs c 1 ggr 1 22
4 15
$ rgs c 1 ggw 1 22 5
$ rgs c 1 ggr 1 22
4 5
$ rgs c 1 ggw 1 22 10
$ rgs c 1 ggr 1 22
4 10

πŸŽ€ GGWX h g gbits gmask β€” GPIO group write πŸŽ€

Writes a group of GPIO identified by group leader g.

The values of each GPIO of the group are set according to the bits of gbits.

Bit 0 sets the level of the group leader. Bit 1 sets the level of the second GPIO in the group. Bit g sets the level of GPIO g+1 in the group.

However this may be modified by the gmask. A GPIO is only updated if the corresponding bit in the mask is 1. selective updating, we love a little permission slip πŸ’…

Example

$ rgs c 1 ggr 1 22
4 15
$ rgs c 1 ggw 1 22 5 15
$ rgs c 1 ggr 1 22
4 5
$ rgs c 1 ggw 1 22 10 0
$ rgs c 1 ggr 1 22
4 5
$ rgs c 1 ggw 1 22 10 15
$ rgs c 1 ggr 1 22
4 10

🌸 GP h g mon moff β€” GPIO tx pulse (simple) 🌸

Starts software timed pulses on GPIO g.

Each cycle consists of mon microseconds of GPIO high followed by moff microseconds of GPIO low.

PWM is characterised by two values, its frequency (number of cycles per second) and its duty cycle (percentage of high time per cycle).

The set frequency will be 1000000 / (mon + moff) Hz.

The set duty cycle will be mon / (mon + moff) * 100 %.

E.g. if mon is 50 and moff is 100 the frequency will be 6666.67 Hz and the duty cycle will be 33.33 %.

πŸ’œ GPX h g mon moff off cyc β€” GPIO tx pulse πŸ’œ

Starts software timed pulses on GPIO g.

cyc cycles are transmitted (0 means infinite). Each cycle consists of mon microseconds of GPIO high followed by moff microseconds of GPIO low.

PWM is characterised by two values, its frequency (number of cycles per second) and its duty cycle (percentage of high time per cycle).

The set frequency will be 1000000 / (mon + moff) Hz.

The set duty cycle will be mon / (mon + moff) * 100 %.

E.g. if mon is 50 and moff is 100 the frequency will be 6666.67 Hz and the duty cycle will be 33.33 %.

off is a microsecond offset from the natural start of the PWM cycle.

For instance if the PWM frequency is 10 Hz the natural start of each cycle is at seconds 0, then 0.1, 0.2, 0.3 etc. In this case if the offset is 20000 microseconds the cycle will start at seconds 0.02, 0.12, 0.22, 0.32 etc. shifting the whole thing over, iconic behaviour tbh ✨

Another command may be issued to the GPIO before the last has finished. yes really, it's giving overlap, it's giving multitasking, it's giving chaos πŸ’€

If the last command had infinite cycles (cyc of 0) then it will be replaced by the new settings at the end of the current cycle. Otherwise it will be replaced by the new settings at the end of cyc cycles.

Multiple pulse settings may be queued in this way. ✨


🌸 P h g pf pdc β€” GPIO tx PWM (simple)

This command starts software timed PWM on GPIO g. πŸŽ€

PWM is characterised by two values, its frequency (number of cycles per second) and its duty cycle (percentage of high time per cycle).

πŸ¦‹ PX h g pf pdc off cyc β€” GPIO tx PWM

This command starts software timed PWM on GPIO g. πŸ’–

PWM is characterised by two values, its frequency (number of cycles per second) and its duty cycle (percentage of high time per cycle).

off is a microsecond offset from the natural start of the PWM cycle.

For instance if the PWM frequency is 10 Hz the natural start of each cycle is at seconds 0, then 0.1, 0.2, 0.3 etc. In this case if the offset is 20000 microseconds the cycle will start at seconds 0.02, 0.12, 0.22, 0.32 etc. πŸ•

Another PWM command may be issued to the GPIO before the last has finished.

If the last PWM had infinite cycles (cyc of 0) then it will be replaced by the new settings at the end of the current cycle. Otherwise it will be replaced by the new settings at the end of cyc cycles.

Multiple PWM settings may be queued in this way. πŸ’…

⭐ S h g spw β€” GPIO tx servo pulses (simple)

This command starts software timed servo pulses on GPIO g. 🌸

I would only use software timed servo pulses for testing purposes. The timing jitter will cause the servo to fidget. This may cause it to overheat and wear out prematurely. 😭

πŸ’œ SX h g spw sf off cyc β€” GPIO tx servo pulses

This command starts software timed servo pulses on GPIO g. πŸŽ€

I would only use software timed servo pulses for testing purposes. The timing jitter will cause the servo to fidget. This may cause it to overheat and wear out prematurely. 😭

Another servo command may be issued to the GPIO before the last has finished.

If the last command had infinite cycles (cyc of 0) then it will be replaced by the new settings at the end of the current cycle. Otherwise it will be replaced by the new settings at the end of cyc cycles.

Multiple servo settings may be queued in this way. ✨

🌈 GWAVE h g p* β€” GPIO group tx wave

This command starts a wave on GPIO group g. 🌊

p is a series of pulses to be transmitted on the GPIO group.

Each pulse is defined by the following triplet:

  • gbits β€” the levels to set for the selected GPIO
  • gmask β€” the GPIO to select
  • us β€” the delay in microseconds before the next pulse

Another wave command may be issued to the GPIO group before the last has finished transmission.

Multiple waves may be queued in this way. πŸ’«

🧚 GBUSY h g k β€” GPIO or group tx busy

This command checks to see if a specified kind k of transmission is ongoing on a GPIO or GPIO group g.

The command returns 1 if transmission is ongoing, otherwise 0. πŸ‘‘

πŸ“ GROOM h g k β€” GPIO or group tx entries

This returns the number of slots there are to queue further transmissions of a specified kind k in the tx queue for GPIO or GPIO group g.

The command returns the number of free slots (0 for no free slots). 🎯

πŸ’– GDEB h g us β€” GPIO debounce time

This command sets the debounce time for GPIO g to us microseconds.

This command is only effective when the GPIO is being used as a source of alerts. ⚠️

Any level changes shorter than the debounce setting will be discarded, i.e. they will not generate an alert.

Reported level changes will be timestamped us microseconds after the level change. ⏱️

πŸ”₯ GWDOG h g us β€” GPIO watchdog time

This command sets the watchdog time for GPIO g to us microseconds.

This only affects alerts.

A watchdog alert will be sent if no edge alert has been issued for that GPIO in the previous watchdog microseconds.

Note that only one watchdog alert will be sent per stream of edge alerts. The watchdog is reset by the sending of a new edge alert.

The level is set to 2 for a watchdog alert. πŸ•


πŸ’œ I2C πŸ’œ

πŸŽ€ I2CO ib id if β€” I2C open device

This is a privileged command. See permits. πŸ”

This command returns a handle to access device id on I2C bus ib. The device is opened with flags if.

No flags are currently defined. The parameter if should be 0.

Upon success the next free handle (>=0) is returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2co 1 0x70 0 # Bus 1, device 0x70, flags 0.
0

$ rgs c 1 i2co 1 0x53 0 # Bus 1, device 0x53, flags 0.
1

πŸ¦‹ I2CC h β€” I2C close device

This command closes an I2C device previously opened by I2CO.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2cc 0 # First close okay.

$ rgs c 1 i2cc 0 # Second fails.
-25
ERROR: unknown handle

🌸 I2CWQ h bit β€” SMB Write Quick: write bit

This command writes a single bit to the I2C device.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2cwq 0 1

⭐ I2CRS h β€” SMB Read Byte: read byte

This command returns a single byte read from the I2C device.

Upon success a value between 0 and 255 will be returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2crs 0
0

πŸ’… I2CWS h bv β€” SMB Write Byte: write byte

This command writes a single byte bv to the I2C device.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2cws 0 0x12

$ rgs c 1 i2cws 0 0xff
-82
ERROR: I2C write failed

πŸŽ€ I2CRB h r β€” SMB Read Byte Data: read byte from register

This command returns a single byte read from register r of the I2C device.

Upon success a value between 0 and 255 will be returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2crb 0 0
6

πŸ¦‹ I2CWB h r bv β€” SMB Write Byte Data: write byte to register

This command writes a single byte bv to register r of the I2C device.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2cwb 0 10 0x54

🌈 I2CRW h r β€” SMB Read Word Data: read word from register

This command returns a single 16 bit word read from register r of the I2C device.

Upon success a value between 0 and 65535 will be returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2crw 0 0
6150

πŸ”₯ I2CWW h r wv β€” SMB Write Word Data: write word to register

This command writes a single 16 bit word wv to register r of the I2C device.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2cww 0 0 0xffff

πŸ’œ I2CRK h r β€” SMB Read Block Data: read data from register

This command returns between 1 and 32 bytes read from register r of the I2C device.

Upon success the count of returned bytes followed by the bytes themselves is returned. On error a negative status code will be returned.

The number of bytes of returned data is specific to the device and register.

Example

$ rgs c 1 i2crk 0 0
6 0 0 0 0 0 0

$ rgs c 1 i2crk 0 1
24 0 0 0 0 0 0 0 0 0 0 0 0 120 222 105 215 128 87 195 217 0 0 0 0

πŸ“ I2CWK h r bvs β€” SMB Write Block Data: write data to register

This command writes between 1 and 32 bytes bvs to register r of the I2C device.

Upon success nothing is returned. On error a negative status code will be returned.

Example

rgs c 1 i2cwk 0 4 0x01 0x04 0xc0

🧚 I2CRI h r num β€” SMB Read I2C Block Data: read bytes from register

This command returns num bytes from register r of the I2C device.

Upon success the count of returned bytes followed by the bytes themselves is returned. On error a negative status code will be returned.

The parameter num may be 1-32.

Example

$ rgs c 1 i2cri 0 0 16
16 237 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155

🌸 I2CWI h r bvs β€” SMB Write I2C Block Data

This command writes between 1 and 32 bytes bvs to register r of the I2C device.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2cwi 0 4 0x01 0x04 0xc0

⭐ I2CRD h num β€” I2C read device

This command returns num bytes read from the I2C device.

Upon success the count of returned bytes followed by the bytes themselves is returned. On error a negative status code will be returned.

This command operates on the raw I2C device. The maximum value of the parameter num is dependent on the I2C drivers and the device itself. rgs imposes a limit of about 8000 bytes.

Example

$ rgs c 1 i2crd 0 16
16 6 24 0 0 0 0 0 0 0 0 0 0 0 0 32 78

πŸ’– I2CWD h bvs β€” I2C write device

This command writes a block of bytes bvs to the I2C device.

Upon success nothing is returned. On error a negative status code will be returned.

The number of bytes which may be written in one transaction is dependent on the I2C drivers and the device itself. rgs imposes a limit of about 500 bytes.

This command operates on the raw I2C device.

Example

$ rgs c 1 i2cwd 0 0x01 0x02 0x03 0x04

πŸŽ€ I2CPC h r wv β€” SMB Process Call: exchange register with word

This command writes wv to register r of the I2C device and returns a 16-bit word read from the device.

Upon success a value between 0 and 65535 will be returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2cpc 0 37 43210
39933

$ rgs c 1 i2cpc 0 256 43210
ERROR: bad i2c/spi/ser parameter
-81

πŸ¦‹ I2CPK h r bvs β€” SMB Block Process Call: exchange data bytes with register

This command writes the data bytes bvs to register r of the I2C device and returns a device specific number of bytes.

Upon success the count of returned bytes followed by the bytes themselves is returned. On error a negative status code will be returned.

Example

$ rgs c 1 i2cpk 0 0 0x11 0x12
6 0 0 0 0 0 0

I2CZ h bvs - I2C zip πŸ¦‹

Okay so this one is literally a whole queue of I2C operations bundled into one command, and it's giving efficiency ✨. The operations to be performed are specified by the contents of bvs, which holds the concatenated command codes plus their associated data.

Here are the command codes you get to play with:

  • End β€” 0 β€” no more commands, we're done, periodt πŸ’…
  • Escape β€” 1 β€” the next P is two bytes
  • Address β€” 2 P β€” set the I2C address to P
  • Flags β€” 3 lsb msb β€” set the I2C flags to lsb + (msb << 8)
  • Read β€” 4 P β€” read P bytes of data
  • Write β€” 5 P ... β€” write P bytes of data

The address, read, and write commands all take a parameter P. Normally P is one byte (0-255). But if the command is preceded by the Escape command, then P is two bytes (0-65535, least significant byte first) β€” glow up 🌈.

The address defaults to the one associated with the handle h. The flags default to 0. And heads up bestie: the address and flags keep their previous value until updated, so they just stay sticky like that 🫢.

Example β€” set address 0x53, write 0x32, read 6 bytes; set address 0x1E, write 0x03, read 6 bytes; set address 0x68, write 0x1B, read 8 bytes; end:

2 0x53  5 1 0x32  4 6
2 0x1E  5 1 0x03  4 6
2 0x68  5 1 0x1B  4 8
0

πŸ”” NOTIFICATIONS πŸ””

NO - Notification open πŸ‘‘

This is a privileged command. See permits.

This command requests a free notification handle.

A notification is a method for being notified of GPIO state changes via a pipe. So like, the GPIO changes and it tells you through a pipe. Very main character of it πŸ’–.

Upon success the command returns a handle greater than or equal to zero. On error a negative status code will be returned.

The pipes are created in the daemon's working directory (the command pwd will show the working directory).

Notifications for handle x will be available at the pipe named .lgd-nfyx (where x is the handle number).

E.g. if the command returns 15 then the notifications must be read from .lgd-nfy15.

Example

$ rgs c 1 no
0

NC h - Notification close πŸŽ€

This command closes a notification previously opened by NO.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 nc 0 # First call succeeds.

$ rgs c 1 nc 1 # Second call fails.
-5
ERROR: unknown handle

NP h - Notification pause ⏸️

This command pauses notifications.

Upon success nothing is returned. On error a negative status code will be returned.

Notifications for the handle are paused until a NR command.

Example

$ rgs c 1 np 0

NR h - Notification resume ▢️

This command resumes notifications.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs c 1 nr 0

$ rgs c 1 nr 1
-5
ERROR: unknown handle

πŸ“œ SCRIPTS πŸ“œ

PROC t - Script store πŸ’Ύ

This is a privileged command. See permits.

This command stores a script t for later execution.

If the script is valid a handle (>=0) is returned which is passed to the other script commands. On error a negative status code will be returned.

Example

$ rgs proc tag 123 w 4 0 mils 200 w 4 1 mils 300 dcr p0 jp 123
0

$ rgs proc tag 123 w 4 0 mils 5 w 4 1 mils 5 jmp 12
ERROR: script has unresolved tag
-63

PROCR h pars - Script run πŸƒβ€β™€οΈ

This command runs stored script h passing it up to 10 optional parameters.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs proc tag 123 w 4 0 mils 200 w 4 1 mils 300 dcr p0 jp 123
0

$ rgs procr 0 50 # Run script 0 with parameter 0 of 50.

$ rgs procp 0
2 44 0 0 0 0 0 0 0 0 0
$ rgs procp 0
2 37 0 0 0 0 0 0 0 0 0
$ rgs procp 0
2 10 0 0 0 0 0 0 0 0 0
$ rgs procp 0
2 5 0 0 0 0 0 0 0 0 0
$ rgs procp 0
2 2 0 0 0 0 0 0 0 0 0
$ rgs procp 0
1 -1 0 0 0 0 0 0 0 0 0

PROCU h pars - Script update parameters πŸ”„

This command sets the parameters of a stored script h passing it up to 10 parameters.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs proc tag 0 hp 18 p0 p1 mils 1000 jmp 0
0
$ rgs procu 0 50 500000
$ rgs procr 0
$ rgs procu 0 100
$ rgs procu 0 200
$ rgs procu 0 200 100000

PROCP h - Script get status and parameters πŸ‘€

This command returns the status of script h as well as the current value of its 10 parameters.

Upon success the script status and parameters are returned. On error a negative status code will be returned.

The script status may be one of:

  • 0 β€” being initialised
  • 1 β€” ready
  • 2 β€” running
  • 3 β€” waiting
  • 4 β€” ended
  • 5 β€” halted
  • 6 β€” failed πŸ’€

Example

$ rgs procp 0
1 0 0 0 0 0 0 0 0 0 0

PROCS h - Script stop πŸ›‘

This command stops a running script h.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs procs 0

$ rgs procs 1
-5
ERROR: unknown handle

PROCD h - Script delete πŸ—‘οΈ

This command deletes script h.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs procd 1

$ rgs procd 1
ERROR: unknown handle
-5

PARSE t - Script validate 🧐

Validates the text t of a script without storing the script.

Upon success nothing is returned. On error a list of detected script errors will be given.

This command may be used to find script syntax faults β€” lowkey the linting bestie of this whole page ✨.

Example

$ rgs parse tag 100 w 22 1 mils 200 w 22 0 mils 800 jmp 100

$ rgs parse tag 0 w 22 1 mills 50 w 22 0 dcr p10 jp 99
Unknown command: mills
Unknown command: 50
Bad parameter to dcr
Can't resolve tag 99

πŸ”Œ SERIAL πŸ”Œ

SERO dev b sef - Serial open device πŸ‘‘

This is a privileged command. See permits.

This command opens the serial dev at b bits per second.

No flags are currently defined. sef should be set to zero.

Upon success a handle (>=0) is returned. On error a negative status code will be returned.

The baud rate must be one of 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, or 230400.

Example

$ rgs sero /dev/ttyAMA0 9600 0
0

$ rgs sero /dev/tty1 38400 0
1

SERC h - Serial close device πŸšͺ

This command closes a serial device previously opened by SERO.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs serc 0 # First close okay.

$ rgs serc 0 # Second close gives error.
-25
ERROR: unknown handle

SERRB - Serial read byte πŸ“

This command returns a byte of data read from the serial device.

Upon success a number between 0 and 255 is returned. On error a negative status code will be returned.

Example

$ rgs serrb 0
23
$ rgs serrb 0
45

SERWB h bv - Serial write byte ✍️

This command writes a single byte bv to the serial device.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs serwb 0 23
$ rgs serwb 0 0xf0

SERR h num - Serial read bytes πŸ“š

This command returns up to num bytes of data read from the serial device.

Upon success the count of returned bytes followed by the bytes themselves is returned. On error a negative status code will be returned.

Example

$ rgs serr 0 10
5 48 49 128 144 255

$ rgs serr 0 10
0

SERW h bvs - Serial write bytes πŸ“¦

This command writes bytes bvs to the serial device.

Upon success nothing is returned. On error a negative status code will be returned.

Example

$ rgs serw 0 23 45 67 89

SERDA h - Serial data available πŸ“Ά

This command returns the number of bytes of data available to be read from the serial device.

Upon success the count of bytes available to be read is returned (which may be 0). On error a negative status code will be returned.

Example

$ rgs serda 0
0

🐚 SHELL 🐚

SHELL name str - Execute a shell command πŸ‘‘

This is a privileged command. See permits.

This command uses the system call to execute a shell script name with the given string str as its parameter.

Upon success the exit status of the system call is returned. On error a negative status code will be returned.

name must exist in a directory named cgi in the daemon's configuration directory and must be executable.

The returned exit status is normally 256 times that set by the shell script exit function. If the script can't be found 32512 will be returned.

Here are some example returned statuses, because the numbers are genuinely wild 😭:

  • Script exit status 1 β†’ returned system call status 256
  • Script exit status 5 β†’ returned system call status 1280
  • Script exit status 10 β†’ returned system call status 2560
  • Script exit status 200 β†’ returned system call status 51200
  • script not found β†’ returned system call status 32512

Example

# pass two parameters, hello and world
$ rgs shell scr1 hello world
256

# pass three parameters, hello, string with spaces, and world
$ rgs shell scr1 "hello 'string with spaces' world"
256

# pass one parameter, hello string with spaces world
$ rgs shell scr1 "
256

# non-existent script
$ rgs shell scr78 par1
32512

🌈 SPI 🌈

SPIO spd spc b spf - SPI open device πŸ‘‘

This is a privileged command. See permits.

Upon success a handle is returned. On error a negative status code will be returned.

Data will be transferred at b bits per second. The flags spf may be used to modify the default behaviour.

The flags consists of the least significant 2 bits.

1  0
m  m

mm defines the SPI mode.

Mode POL PHA
 0    0   0
 1    0   1
 2    1   0
 3    1   1

SPIC h - SPI close device πŸ”’

This command closes a SPI device previously opened by SPIO.

Upon success nothing is returned. On error a negative status code will be returned. πŸ’…

Example:

$ rgs spic 1

$ rgs spic 1
-25
ERROR: unknown handle

SPIR h num β€” SPI read bytes πŸ¦‹

Bestie, this one returns num bytes read from the SPI device.

Upon success the count of returned bytes followed by the bytes themselves is returned. On error a negative status code will be returned.

Example:

$ rgs spir 0 10 # Read 10 bytes from the SPI device.
10 0 0 0 0 0 0 0 0 0 0

SPIW h bvs β€” SPI write bytes ✨

This command writes bytes bvs to the SPI device.

Upon success nothing is returned. On error a negative status code will be returned.

Example:

$ rgs spiw 0 0x22 0x33 0xcc 0xff

SPIX h bvs β€” SPI transfer bytes πŸ”₯

This command writes bytes bvs to the SPI device.

It returns the same number of bytes read from the device.

Upon success the count of returned bytes followed by the bytes themselves is returned. On error a negative status code will be returned.

Example:

$ rgs spix 0 0x22 0x33 0xcc 0xff
4 0 0 0 0

πŸ› οΈ UTILITIES πŸ’–

LGV β€” get lg library version 🌸

This command returns the lg library version.

$ rgs lgv
lg_0.1.0.0

SBC β€” get SBC's host name πŸ‘‘

This command returns the rgpiod daemon server name.

$ rgs sbc
venus

CGI cid β€” get internal configuration setting πŸ”

This is a privileged command. See permits.

This command returns the value of an internal library configuration setting cid.

$ rgs cgi 0
1

CSI cid v β€” set internal configuration setting πŸŽ€

This is a privileged command. See permits.

This command sets the value of the internal library configuration setting cid to v.

$ rgs csi 0 3
$ rgs cgi 0
3

T/TICK β€” get nanoseconds since the epoch ⏱️

T and TICK are synonyms.

This command returns the number of nanoseconds since the epoch (start of 1970).

$ rgs t
1601838936723095901
$ rgs tick
1601838940792322758

MICS v β€” microseconds delay 🧚

This command delays execution for v microseconds.

Upon success nothing is returned. On error a negative status code will be returned.

The main use of this command is expected to be within scripts.

$ rgs mics 20      # Delay 20 microseconds.
$ rgs mics 1000000 # Delay 1 second.
$ rgs mics 5100000 # Delay 5.1 seconds.
-24
ERROR: bad MICS delay (too large)

MILS v β€” milliseconds delay πŸ’œ

This command delays execution for v milliseconds.

Upon success nothing is returned. On error a negative status code will be returned.

$ rgs mils   2000 # Delay 2 seconds.
$ rgs mils 301000 # Delay 301 seconds.
-25
ERROR: bad MILS delay (too large)

U/USER β€” set user 🫢

U and USER are synonyms.

This command sets the current user and associated permissions.

$ rgs u test1   # set user test1
$ rgs user test1 # set user test1
$ rgs u testx    # unknown user
-95
ERROR: bad secret for user

C/SHARE β€” set share 🌈

C and SHARE are synonyms.

This command sets the share for handles.

The command has two uses. Firstly it sets the share id for any subsequently created handles on the current command line. Secondly it sets the share id to use to access any previously created handles on this or earlier command lines.

rgs c 1       # use share id 1
rgs share 1   # use share id 1
rgs c 0       # switch off sharing
rgs share 867 # use share id 867

LCFG β€” reload permits configuration file πŸ”

This is a privileged command. See permits.

This command reloads the permits configuration file.

$ rgs lcfg
$ rgs lcfg
-93
ERROR: no permission to perform action
$ rgs lcfg
-93
ERROR: no permission to perform action

PCD β€” print daemon configuration directory πŸ“‚

This command prints the daemon configuration directory.

rgs pcd
/home/joan/LG/TEST

PWD β€” print daemon working directory πŸ“

This command prints the daemon working directory.

rgs pwd
/home/joan/LG

πŸ“š PARAMETERS πŸ“š

  • b: baud β€” the command expects the baud rate in bits per second for the transmission of serial data (I2C/SPI/serial link, waves).
  • bit: bit value (0-1) β€” the command expects 0 or 1.
  • bv: a byte value (0-255) β€” the command expects a byte value.
  • bvs: byte values (0-255) β€” the command expects one or more byte values.
  • cid β€” a number identifying an internal configuration item.
    • 0 β€” debug level
    • 1 β€” minimum transmission period for PWM and waves
  • cyc: >= 0 β€” the number of PWM pulses to generate. A value of 0 means infinite.
  • dev: a tty serial device β€” the command expects the name of a serial device, e.g.
    • /dev/ttyAMA0
    • /dev/ttyUSB0
    • /dev/tty0
    • /dev/serial0
  • ef: GPIO event flags β€” the following values may be or'd to form the event flags.
    • 1 β€” Rising edge
    • 2 β€” Falling edge
    • 3 β€” Both edges
  • file: a file name β€” the file name must match an entry in the [files] section of the permits file.
  • from: 0-2 β€” position to seek from FS.
    • 0 β€” start
    • 1 β€” current position
    • 2 β€” end
  • g: GPIO β€” the command expects a GPIO.
  • g* β€” a list of one or more GPIO.
  • gbits β€” this value is used to set the levels of a GPIO group.
    • Bit 0 represents the level of the group leader.
    • Bit 1 represents the level of the second GPIO in the group.
    • Bit g represents the level of GPIO g+1 in the group.
  • gc: gpiochip (>=0) β€” the command expects a gpiochip number.
  • gmask β€” this value is used to select GPIO from a GPIO group.
    • Bit 0 of the mask indicates item 1
    • Bit 1 of the mask indicates item 2
    • Bit g of the mask indicates item g+1
    • For example suppose the items are GPIO 5, 10, 23, 25, 11.
      • Bit 0 of the mask indicates GPIO 5
      • Bit 1 of the mask indicates GPIO 10
      • Bit 2 of the mask indicates GPIO 23
      • Bit 3 of the mask indicates GPIO 25
      • Bit 4 of the mask indicates GPIO 11
    • If a bit of the mask is high the corresponding GPIO will be selected.
    • E.g. in the above example if the mask has the value 17 GPIO 5 and GPIO 11 will be selected.
  • h: handle (>=0) β€” the command expects a handle.
    • A handle is a number referencing an object opened by one of FO, I2CO, NO, PROC, SERO, SPIO, GO.
  • ib: I2C bus (>=0) β€” the command expects an I2C bus number.
  • id: I2C device (0-0x7F) β€” the command expects the address of an I2C device.
  • if: I2C flags (0) β€” the command expects an I2C flags value. No flags are currently defined.
  • k β€” a kind of transmission.
    • 0 = PWM
    • 1 = WAVE
  • lf: GPIO line flags β€” the following values may be or'd to form the line flags.
    • 4 β€” Active low
    • 8 β€” Open drain
    • 16 β€” Open source
    • 32 β€” Pull up
    • 64 β€” Pull down
    • 128 β€” Pull none
  • mode: lgFile open mode β€” one of the following values.
    • READ = 1 β€” open file for reading
    • WRITE = 2 β€” open file for writing
    • RW = 3 β€” open file for reading and writing
    • The following values can be or'd into the mode.
      • APPEND = 4 β€” All writes append data to the end of the file
      • CREATE = 8 β€” The file is created if it doesn't exist
      • TRUNC = 16 β€” The file is truncated
  • moff: >= 0 β€” the off period for a PWM pulse in microseconds.
  • mon: >= 0 β€” the on period for a PWM pulse in microseconds.
  • name: the name of a script β€” only alphanumeric characters, - and _ are allowed in the name.
  • nfyh: >= 0 β€” this associates a notification with a GPIO event.
  • num: maximum number of bytes to return (1-) β€” the command expects the maximum number of bytes to return.
    • For the I2C and SPI commands the requested number of bytes will always be returned.
    • For the serial and file commands the smaller of the number of bytes available to be read (which may be zero) and num bytes will be returned.
  • off: >= 0 β€” the offset in microseconds from the nominal PWM pulse start.
  • p* β€” one or more triplets of gbits, gmask, and us microsecond delay.
  • pars: script parameters β€” the command expects 0 to 10 numbers as parameters to be passed to the script.
  • pat: a file name pattern β€” a file path which may contain wildcards. To be accessible the path must match an entry in the [files] section of the permits file.
  • pdc: % β€” PWM duty cycle between 0.0 % and 100 % inclusive.
  • pf: Hz β€” PWM frequency between 0.1 Hz and 10000 Hz inclusive. Use 0 for off.
  • r: register (0-255) β€” the command expects an I2C register number.
  • sef: serial flags (32 bits) β€” the command expects a flag value. No serial flags are currently defined.
  • sf: Hz (40-500) β€” servo frequency.
  • spc: SPI channel (>= 0) β€” the command expects a SPI channel.
  • spd: SPI device (>= 0) β€” the command expects a SPO device.
  • spf: SPI flags β€” see SPIO.
  • spw: 0=off, 500-2500 microseconds β€” servo pulse width.
  • str: a string β€” the command expects a string.
  • t: a string β€” the command expects a string.
  • us β€” the command expects a time interval measured in microseconds.
  • v: value β€” the command expects a number.
  • v* β€” a list of one or more values.
  • wv: word value (0-65535) β€” the command expects a word value.

πŸ‘€ SEE ALSO πŸ‘€

rgpiod(1), lgpio(3), rgpio(3)


okay bestie that's the whole entire page, you officially know rgs(1) now, no cap πŸ’– This one shipped for Linux, dated 2020-2021, and the page is rgs(1) β€” go forth and poke at your GPIOs, you absolute icon πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from