Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI Permissions #23

Closed
p1r473 opened this issue Apr 24, 2020 · 5 comments
Closed

GUI Permissions #23

p1r473 opened this issue Apr 24, 2020 · 5 comments
Labels

Comments

@p1r473
Copy link
Contributor

p1r473 commented Apr 24, 2020

Hi Linus!
I have ran the following command:

echo 'SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power /sys/devices/platform/ff150000.i2c/i2c-3/3-0045/tinker_mcu_bl
"' | sudo tee -a /etc/udev/rules.d/backlight-permissions.rules

Note, I ran for both the TinkerBoard and the Pi files, as all files exist on my OS.
This does not fix the permissions for me.

Sidenote, I actually had to replace the %k with rpi_backlight:

echo 'SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/rpi_backlight/brightness /sys/class/backlight/rpi_backlight/bl_power /sys/devices/platform/ff150000.i2c/i2c-3/3-0045/tinker_mcu_bl
> "' | sudo tee -a /etc/udev/rules.d/backlight-permissions.rules

as I got:

chmod: cannot access '/sys/class/backlight/%k/brightness': No such file or directory
chmod: cannot access '/sys/class/backlight/%k/bl_power': No such file or directory

Just wondering if you have any idea why both the udev rule wouldn't work, nor the %k in that rule?

@p1r473
Copy link
Contributor Author

p1r473 commented Apr 25, 2020

I've created a workaround:

cat /etc/systemd/system/setbacklightpermissions.service

[Unit]
Description=Set backlight writable by everybody

[Service]
Type=simple
User=root
ExecStart=/bin/chmod 666 /sys/class/backlight/rpi_backlight/brightness /sys/class/backlight/rpi_backlight/bl_power /sys/devices/platform/ff150000.i2c/i2c-3/3-0045/tinker_mcu_bl

[Install]
WantedBy=multi-user.target

then ran:

$ sudo systemctl enable setbacklightpermissions.service
$ sudo systemctl start setbacklightpermissions.service
$ sudo systemctl status setbacklightpermissions.service

Seems to work. However, would still love your input.

@linusg
Copy link
Owner

linusg commented Apr 25, 2020

Hi @p1r473,

I'm afraid I have no idea what's going on there. %k should work as described in the udev manpage:

https://linux.die.net/man/8/udev
...
%k - The "kernel name" for the device.

Might be something specific to the Tinker Board OS? Never used it, can't investigate.

Using Systemd for this is a bad workaround IMO 😄
See if there are other rules on your system which do similar stuff, maybe you can spot differences.

This does not fix the permissions for me.

Did you try, without having the Systemd unit enabled, what happens after a reboot? Or sudo udevadm trigger?

@p1r473
Copy link
Contributor Author

p1r473 commented Apr 25, 2020

For the %k, my kernel name is rpi_backlight?
Because, it looks like %k is supposed to be rpi_backlight in order for your %k to fill.

Anyways,

 systemctl disable setbacklightpermissions

echo 'SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/rpi_backlight/brightness /sys/class/backlight/rpi_backlight/bl_power /sys/devices/platform/ff150000.i2c/i2c-3/3-0045/tinker_mcu_bl
> "' | sudo tee -a /etc/udev/rules.d/backlight-permissions.rules
reboot

No luck with GUI permissions
then:

sudo udevadm trigger

Still no luck. Is it possible that my subsystem is not called backlight, so this does not ever run?

Tried to find my subsystem name:

root@TinkerBoardS:~ # udevadm info -q all -a /dev/sdb
Unknown device, absolute path in /dev/ or /sys expected.
root@TinkerBoardS:~ # udevadm info -n /dev/sdb -q property | sed -n 's/SUBSYSTEM=//p'
device node not found
root@TinkerBoardS:~ # udevadm info -n /dev/sdb -q property | sed -n 's/SUBSYSTEM=//p'
device node not found
root@TinkerBoardS:~ # udevadm info -a -n /dev/sdb
device node not found

Also tried, but didn't fix permissions:

mv /etc/udev/rules.d/backlight-permissions.rules /lib/udev/rules.d/backlight-permissions.rules

Also tried chaning SUBSYSTEM to 'graphics' and renaming the rule to 999-backlight-permissions.rules to fit the other rules

@p1r473
Copy link
Contributor Author

p1r473 commented Apr 25, 2020

Not sure if it was a problem with the echo or the tee, but just manually creating the file seems to work:
/etc/udev/rules.d/backlight-permissions.rules:

SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power /sys/devices/platform/ff150000.i2c/i2c-3/3-0045/tinker_mcu_bl"

Thanks!

@p1r473 p1r473 closed this as completed Apr 25, 2020
@linusg
Copy link
Owner

linusg commented Apr 25, 2020

Weird! Glad you got it working though, thanks for reporting back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants