View previous topic :: View next topic |
Author |
Message |
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Fri Sep 28, 2018 7:54 pm Post subject: lenovo X230 - ACPI -Fn+key- brightness control [SOLVED] |
|
|
EDIT: This is now solved. I wanted to also make note for other x230 owners out there as I know it is popular laptop..
I am running a lenovo thinkpad x230, with the older legendary x220 keyboard, I modded the bios to fix the keymapping, and with gentoo, all the keys and Fn+keys are functioning.
Hi
I am still fairly new to gentoo and linux in general.
I have everything up and running the only thing that doesnt work are my fn+keys, and special keys
my keys cannot control volume, brightness,
my laptop:
Lenovo ThinkPad X230, and i am running xmonad on it
when i run acpi_listen, i do get inputs for each keys, so it seems they are registering but not actually doing anything. They are all mismatched from the actual keyboard but its there nonetheless.
The only special function keys that work are the fn+f5 which toggles on and off the wifi, unfortunately this is the most uesless one out of all of them.
I followed this wiki to a T:
https://wiki.gentoo.org/wiki/ACPI/ThinkPad-special-buttons
Dmesg output:
https://paste.pound-python.org/show/djwn8Q3jvSkZlxdNuxTk/
thinkpad related config options:
https://paste.pound-python.org/show/kuqjUT4jcy4Mgy84PCgQ/
Last edited by OneNoteMan on Sat Sep 29, 2018 4:36 pm; edited 1 time in total |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Fri Sep 28, 2018 8:08 pm Post subject: |
|
|
do I need xbacklight though?
I already have the lenovo ACPI driver, its just not functioning properly |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Fri Sep 28, 2018 8:11 pm Post subject: |
|
|
That thread was more about how to set acpi to recognize things like the fn keys. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Fri Sep 28, 2018 8:47 pm Post subject: |
|
|
OneNoteMan wrote: | do I need xbacklight though? |
OneNoteMan ... no, all you need is a backlight script and inform acpid (via /etc/acpid/default.sh) that it should run this on recieving 'brightnessup' and 'brightnessdown'. The linked post should cover everything, but if you have any questions, ask.
best ... khay |
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Fri Sep 28, 2018 11:40 pm Post subject: |
|
|
I tried to modify the script but it still isnt working
my default.sh is here:
https://paste.pound-python.org/show/DfjVcXOI3pKBY7KW6fzl/
I have also done chmod +x on the scripts
I am not very experienced in bash, so im not sure if its correct. I installed linux to learn bash more.
not sure why it still isnt working.
I tried to run the script directly by typing
./backlight.sh down
but its saying command not found line 17
I copied and pasted the backlight script exact though |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Fri Sep 28, 2018 11:49 pm Post subject: |
|
|
what does "ls /sys/class/backlight/" return?
if it shows intel_backlight then what does "ls /sys/class/backlight/intel_backlight" return? _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Fri Sep 28, 2018 11:53 pm Post subject: |
|
|
Anon-E-moose wrote: | what does "ls /sys/class/backlight/" return?
if it shows intel_backlight then what does "ls /sys/class/backlight/intel_backlight" return? |
ls /sys/class/backlight/
gives:
intel_backlight
ls /sys/class/backlight/intel_backlight
gives:
actual_brightness
bl_power
brightness
device
max_brightness
power
subsystem
type
uevent |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Sat Sep 29, 2018 12:02 am Post subject: |
|
|
I don't see curr_brightness which is probably why it doesn't work. change it to actual_brightness in the brightness.sh script and see if it works _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Sat Sep 29, 2018 2:32 am Post subject: |
|
|
I tried to make the changes to the file but im getting an error
cp: cannot create regular file
it appears that i only have read permisson to anything in the folder
/sys/class/backlight/intel_backlight
this doesnt make sense because im trying yo make these modifications as root
of course i couldnt chmod it because even as root permission is denied
ls -a /sys/class/backlight/intel_backlight ..results here:
https://paste.pound-python.org/show/L5e8vjOWdwIdL8aNbUyb/
I suspect that this also may be the reason i am not able to change brightness, since I only have read permission?
im not sure why this is I certain my partitions are set up correctly, as it is exactly like the handbook specifies |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sat Sep 29, 2018 8:30 am Post subject: |
|
|
Anon-E-moose wrote: | I don't see curr_brightness which is probably why it doesn't work. change it to actual_brightness in the brightness.sh script and see if it works |
Anon-E-moose ... no, 'current_brightness' is a variable that reads in the contents of 'brightness' ... and that exists under /sys/class/backlight/intel_backlight.
OneNoteMan wrote: | I tried to make the changes to the file but im getting an error
Code: | cp: cannot create regular file |
|
You shouldn't need to make any changes to the script, but ok, from what command is that error produced? ... because the script doesn't include a 'cp', so that must come from elsewhere.
OneNoteMan wrote: | it appears that i only have read permisson to anything in the folder /sys/class/backlight/intel_backlight |
No, the files which are non-modifiable (ie, which contain a state ... such as 'actual_brightness' and 'max_brightness') are read only, but the file 'brightness', which is the only file modified by the script, is +rw.
So, just place an un-modified backlight.sh in /etc/acpi/actions with u+x, then fn+brightness down, and fn+brightnessup, that should work.
BTW, it's not "bash", the script is written in posix sh.
EDIT: actually, there is a problem there with the test condition ... try the following:
/etc/acpi/actions/backlight.sh: | #!/bin/sh
set -e
backlight_sys_dir="/sys/class/backlight/intel_backlight"
read -r max_brightness < "${backlight_sys_dir}/max_brightness"
read -r curr_brightness < "${backlight_sys_dir}/brightness"
case "$1" in
up) increment="+ 10" ;;
down) increment="- 10" ;;
*) exit 1 ;;
esac
new_brightness=$(($curr_brightness $increment))
if [ $new_brightness -lt 1 ] || [ $new_brightness -gt $max_brightness ]; then
exit 1
else
echo "$new_brightness" > ${backlight_sys_dir}/brightness
fi |
best ... khay |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Sat Sep 29, 2018 11:42 am Post subject: |
|
|
khayyam wrote: | Anon-E-moose ... no, 'current_brightness' is a variable that reads in the contents of 'brightness' ... and that exists under /sys/class/backlight/intel_backlight. |
Sorry I was already nodding off when I made that reply. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
josephg l33t
Joined: 10 Jan 2016 Posts: 783 Location: usually offline
|
Posted: Sat Sep 29, 2018 12:43 pm Post subject: |
|
|
OneNoteMan wrote: | I tried to run the script directly by typing
./backlight.sh down
but its saying command not found line 17 |
what is the output of
Code: | $ ls -lh ./backlight.sh |
_________________ "Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey |
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Sat Sep 29, 2018 2:37 pm Post subject: |
|
|
so there is nothing wrong with the permissions as per khayyam
i was trying to rename the actual_brightness by using cp and then rm, but that is not needed.
I have tried doing the adjustments as stated but still no luck
Oh I should also mention the power button led is off, it is generally on when my system is on, it still functions though. Maybe this is a clue, i am not sure. I dont care much for the leds, I just want the buttons to work.
I tried to redo the instructions:
https://wiki.gentoo.org/wiki/ACPI/ThinkPad-special-buttons
I tried logging in as both root and user, starting x and trying to control brightness to no avail
My file permissions for backlight.sh
-rwxr-xr-x
and other action scripts copied from the wiki are for brightness control:
-rwxr--r-- |
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Sat Sep 29, 2018 2:40 pm Post subject: |
|
|
also tried a different wm incase there was something going on with xmonad
still no brightness control |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Sat Sep 29, 2018 2:49 pm Post subject: |
|
|
what does "cat /sys/class/backlight/intel_backlight/brightness" return?
and what does "cat /sys/class/backlight/intel_backlight/max_brightness" return?
And are you trying to run the shell script as root? _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Sat Sep 29, 2018 3:59 pm Post subject: |
|
|
both return just the number 4437
I can only run the scripts as root, the user cannot run it
but even still I cant get the brightness to change as root or user.
I noticed that my power button led is now lighting up for some reason even though i did not change anything
I tried running the scripts in my /etc/acpi/actions
i ran as root
FnHome-brightnessup.sh
this script actually returns a decreasing number, and outputs that number twice
FnHome-brightnessup.sh
this script actually returns a increasing number, and outputs that number twice
Also the changes are reflected in the file /sys/class/backlight/intel_backlight/brightness
so the actions scripts are changing the value of the brightness, but only when I manually run the command, and not when the key is pressed
interestingly when i run the script
powerbtn.sh
it actually shuts of my computer
I restarted again and the led for my power button is off again |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Sat Sep 29, 2018 4:09 pm Post subject: |
|
|
Ok run this command as root
Code: | echo 2000 >/sys/class/backlight/intel_backlight/brightness |
does that change the brightness? _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Sat Sep 29, 2018 4:09 pm Post subject: |
|
|
I also realized something
I actually didnt do the portion from the wiki:
"...
By default some buttons are mapped to key codes that X can not handle or has no keysym for. So the following might be useful. It modifies the udev defaults slightly to fix the key combinations that otherwise would not work in X:
..."
the folder
/etc/udev/hwdb.d
did not exist is it necessary to make the folder and file? |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Sat Sep 29, 2018 4:16 pm Post subject: |
|
|
I don't think you need the folder
do this run acpi_listen and hit the fn+brightness up and down keys, and tell me what it returns. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
josephg l33t
Joined: 10 Jan 2016 Posts: 783 Location: usually offline
|
Posted: Sat Sep 29, 2018 4:18 pm Post subject: |
|
|
OneNoteMan wrote: | I tried to redo the instructions:
https://wiki.gentoo.org/wiki/ACPI/ThinkPad-special-buttons
I tried logging in as both root and user, starting x and trying to control brightness to no avail
My file permissions for backlight.sh
-rwxr-xr-x
and other action scripts copied from the wiki are for brightness control:
-rwxr--r-- |
I see no backlight.sh in that wiki page. Did you copy it from somewhere else? _________________ "Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Sat Sep 29, 2018 4:22 pm Post subject: |
|
|
josephg wrote: |
I see no backlight.sh in that wiki page. Did you copy it from somewhere else? |
I had modified the default.sh script for acpi, and khayyam (very nicely) created the backlight.sh script from that. It gets talked about in the earlier link I provided. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
OneNoteMan n00b
Joined: 28 Sep 2018 Posts: 11
|
Posted: Sat Sep 29, 2018 4:28 pm Post subject: |
|
|
so I did the following and now it works.
firstly it seems no modification is required to /etc/acpi/default.sh so I did not need the info from:
https://forums.gentoo.org/viewtopic-t-1085854-highlight-.html
I also still did not make the change specified in the wiki https://wiki.gentoo.org/wiki/ACPI/ThinkPad-special-buttons starting at the point where it says:
"...
By default some buttons are mapped to key codes that X can not handle or has no keysym for. So the following might be useful. It modifies the udev defaults slightly to fix the key combinations that otherwise would not work in X:..."
so these modifcations are unnecessary
I restarted acpid
I though it still wasnt working but surely something was happening because a decrements and increment were occurring when the script ran.
I rebooted by laptop. Still nothing.
I remegered acpid set it to default and did
dispatch-conf
and took the new (untouched) files from the reinstall and overwrite the old ones that I modified.
rebooted again.
now my keys combinations were registering fn+home and fn+end were changing the brightness level numerically but no changes appeared.
I manually changed the value of the brightness, in the brightness file using Anon-E-moose's suggested command:
echo 2000 >/sys/class/backlight/intel_backlight/brightness
and boom brightness dropped
I tried my fn key combos again and this time held if for an extended period, the brightness does go down but just slowly ..very slowly.
Everything works now, so hopefully the rest of the function keys should go smoothly |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Sat Sep 29, 2018 4:31 pm Post subject: |
|
|
So change the script increment value from 10 to something like 200 (both up and down)
I originally set it at 10 because in my case it goes from 0 - 100, in your case it goes from 0 - 4437, so 10 will take a long time to show anything. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
josephg l33t
Joined: 10 Jan 2016 Posts: 783 Location: usually offline
|
Posted: Sat Sep 29, 2018 4:37 pm Post subject: |
|
|
So it's working now but very slowly? Good. You need to experiment with the increment value to change brightness when you hit the Fn keys. It seems yours is in the 1000s. Once you find a value you're comfortable with, you need to update your acpi scripts with that value. _________________ "Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey |
|
Back to top |
|
|
|