/sys/class/backlight/radeon_bl0/brightness
파일을 통해 모니터의 밝기를 변경하고 싶습니다 . 하지만 파일에는 -rw-r--r--.
권한이 있으므로 루트만 쓸 수 있습니다.이 기사권한을 변경하기 위해 udev 규칙을 구성할 수 있다고 말합니다. 이것은 작동하지 않습니다. 내 컴퓨터에 맞게 규칙을 약간 수정했습니다. 내 그래픽 카드는 입니다 radeon_b10
. , 그렇지 않습니다 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"
나는 모든 것을 시도했습니다. 모니터링 규칙을 사용 $ udevadm monitor
하고 트리거링 규칙을 사용합니다 # udevadm trigger --action=add /sys/class/backlight/radeon_bl0
. 규칙이 트리거되었지만 파일은 /sys/class/backlight/%k/brightness
여전히 다음과 같습니다.
-rw-r--r--. 1 root root 4096 Aug 1 16:09 brightness
(에서 출력 $ ll -a /sys/class/backlight/radeon_bl0/
)
udev가 명령문을 실행하지 않는 이유는 무엇입니까 RUN
?
내 시스템에 대한 정보:
[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==""
답변1
한 가지 가능한 이유는 변경할 파일이 아직 존재하지 않기 때문입니다.
chown 및 chmod 대신 대상이 존재하는지 확인하고 해당 정보를 로그 파일에 기록하는 스크립트를 실행하십시오.
답변2
change
대신 액션을 사용했는데 add
모든 것이 잘 작동했습니다.
ACTION=="change", SUBSYSTEM=="backlight", KERNEL=="radeon_b10", RUN+="/usr/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="change", SUBSYSTEM=="backlight", KERNEL=="radeon_b10", RUN+="/usr/bin/chmod g+w /sys/class/backlight/%k/brightness"