Skip to content

Commit b7651d8

Browse files
committed
pinctrl: Clarify the required privelege level
See: #135 Signed-off-by: Phil Elwell <[email protected]>
1 parent 06a39dd commit b7651d8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pinctrl/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
pinctrl is a more powerful replacement for raspi-gpio, a tool for displaying
55
and modifying the GPIO and pin muxing state of a system. It accesses the
6-
hardware directly, bypassing the kernel drivers, and as such requires root
7-
privilege (run with "sudo").
6+
hardware directly, bypassing the kernel drivers, and as such requires the
7+
necessary privilege. By default, root access is required (i.e. run with
8+
"sudo"), but with a suitable udev rule to change the ownership of
9+
/dev/gpiomem* (as found in RPiOS) this can be relaxed to group membership,
10+
e.g. group "gpio".
811

912
The improvements over raspi-gpio include:
1013

pinctrl/pinctrl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ static void usage(void)
6969
printf("Running %s with the help argument prints this help.\n", name);
7070
printf("%s can get and print the state of a GPIO (or all GPIOs)\n", name);
7171
printf("and can be used to set the function, pulls and value of a GPIO.\n");
72-
printf("%s must be run as root.\n", name);
72+
printf("%s must be run as root (or as a member of group 'gpio'\n", name);
73+
printf("on RPiOS).\n");
7374
printf("Use:\n");
7475
printf(" %s [-p] [-v] get [GPIO]\n", name);
7576
printf("OR\n");
@@ -674,7 +675,7 @@ int main(int argc, char *argv[])
674675
if (ret)
675676
{
676677
if (ret == EACCES && geteuid())
677-
printf("Must be root\n");
678+
printf("Must be root (or group 'gpio' on RPiOS)\n");
678679
else
679680
printf("Failed to mmap gpiolib - %s\n", strerror(ret));
680681
return -1;

0 commit comments

Comments
 (0)