udev não quer executar chgrp e chmod

0

Eu quero alterar o brilho do meu monitor através do arquivo /sys/class/backlight/radeon_bl0/brightness . Mas o arquivo tem -rw-r--r--. de permissões, portanto, somente o root pode gravar nele. Este artigo diz que eu posso configurar uma regra do udev para alterar as permissões. Não funciona Eu pouco modifiquei a regra, para combinar com o meu computador. Meu cartão de gráficos é radeon_b10 , não acpi_video0 .

ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="radeon_b10", RUN+="/usr/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="radeon_b10", RUN+="/usr/bin/chmod g+w /sys/class/backlight/%k/brightness"

Eu tentei de tudo. Monitorando as regras usando $ udevadm monitor e acionando as regras usando # udevadm trigger --action=add /sys/class/backlight/radeon_bl0 . As regras são disparadas, mas o arquivo /sys/class/backlight/%k/brightness ainda é:

-rw-r--r--. 1 root root 4096 Aug  1 16:09 brightness

(saída de $ ll -a /sys/class/backlight/radeon_bl0/ )

Por que o udev não executa a instrução RUN ?

Informações sobre o meu sistema:

[marian@bagr ~]$ uname -a
Linux bagr 4.17.9-200.fc28.x86_64 #1 SMP Mon Jul 23 21:41:29 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[marian@bagr ~]$ ll -a /sys/class/backlight/radeon_bl0/
total 0
drwxr-xr-x. 3 root root    0 Aug  1  2018 .
drwxr-xr-x. 6 root root    0 Aug  1  2018 ..
-r--r--r--. 1 root root 4096 Aug  1 16:09 actual_brightness
-rw-r--r--. 1 root root 4096 Aug  1 16:09 bl_power
-rw-r--r--. 1 root root 4096 Aug  1 16:09 brightness
lrwxrwxrwx. 1 root root    0 Aug  1 16:09 device -> ../../card0-eDP-1
-r--r--r--. 1 root root 4096 Aug  1 16:09 max_brightness
drwxr-xr-x. 2 root root    0 Aug  1 16:09 power
lrwxrwxrwx. 1 root root    0 Aug  1  2018 subsystem -> ../../../../../../../class/backlight
-r--r--r--. 1 root root 4096 Aug  1 16:09 type
-rw-r--r--. 1 root root 4096 Aug  1 16:09 uevent
[marian@bagr ~]$ udevadm info -q all -a /sys/class/backlight/radeon_bl0
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:01.0/drm/card0/card0-eDP-1/radeon_bl0':
    KERNEL=="radeon_bl0"
    SUBSYSTEM=="backlight"
    DRIVER==""
    ATTR{actual_brightness}=="30"
    ATTR{bl_power}=="0"
    ATTR{brightness}=="30"
    ATTR{max_brightness}=="255"
    ATTR{type}=="raw"

  looking at parent device '/devices/pci0000:00/0000:00:01.0/drm/card0/card0-eDP-1':
    KERNELS=="card0-eDP-1"
    SUBSYSTEMS=="drm"
    DRIVERS==""
    ATTRS{dpms}=="On"
    ATTRS{edid}==""
    ATTRS{enabled}=="enabled"
    ATTRS{status}=="connected"

  looking at parent device '/devices/pci0000:00/0000:00:01.0/drm/card0':
    KERNELS=="card0"
    SUBSYSTEMS=="drm"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:01.0':
    KERNELS=="0000:00:01.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="radeon"
    ATTRS{ari_enabled}=="0"
    ATTRS{boot_vga}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x030000"
    ATTRS{consistent_dma_mask_bits}=="40"
    ATTRS{current_link_speed}=="Unknown speed"
    ATTRS{current_link_width}=="0"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0x9850"
    ATTRS{dma_mask_bits}=="40"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="1"
    ATTRS{irq}=="35"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{local_cpus}=="f"
    ATTRS{max_link_speed}=="Unknown speed"
    ATTRS{max_link_width}=="255"
    ATTRS{msi_bus}=="1"
    ATTRS{numa_node}=="-1"
    ATTRS{power_dpm_force_performance_level}=="auto"
    ATTRS{power_dpm_state}=="balanced"
    ATTRS{power_method}=="dpm"
    ATTRS{power_profile}=="default"
    ATTRS{revision}=="0x40"
    ATTRS{subsystem_device}=="0x81f5"
    ATTRS{subsystem_vendor}=="0x103c"
    ATTRS{vendor}=="0x1002"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
    
por Margotka000 01.08.2018 / 16:56

1 resposta

0

Um possível motivo é que o arquivo a ser alterado ainda não existe.

Execute um script em vez de chown e chmod que possa examinar se o destino existe e pode gravar informações em um arquivo de log.

    
por 02.08.2018 / 00:43

Tags