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

Fix for LG gram led keyboard 14ZB90Q #4

Open
wyattbiker opened this issue Jan 16, 2023 · 7 comments
Open

Fix for LG gram led keyboard 14ZB90Q #4

wyattbiker opened this issue Jan 16, 2023 · 7 comments

Comments

@wyattbiker
Copy link

This code works on LG gram 14ZB90Q. Turns kbd led on and off. 0 is off 255 is max.

lgkbdled.sh

DRIVER=" /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness"

if [ ! -f $DRIVER ]; then
  echo "LG driver $DRIVER file not found"
  exit -1
fi

TURN_ON=0
if [ $# -eq 0 ]; then
  PREV_VAL=`cat $DRIVER`

  if [[ $PREV_VAL == 0 ]]; then
    TURN_ON=255
  fi
else
  if [ "$1" == "off" ]; then
    TURN_ON=0
  else
    TURN_ON=255
  fi
fi

echo "Setting kbd LED to $TURN_ON"
sudo bash -c "echo $TURN_ON > $DRIVER"
@wyattbiker wyattbiker changed the title Fix for lg keyboard led Fix for LG gram led keyboard 14ZB90Q Jan 16, 2023
@leoomi
Copy link
Owner

leoomi commented Jan 16, 2023

This overall looks good to me. Could you please open a pull request with these changes?
I'd just like to comment that there is an extra whitespace after the quote for the DRIVER variable.

@leoomi
Copy link
Owner

leoomi commented Jan 16, 2023

An edit to the README removing what I wrote about this functionality would be appreciated as well.

@duckydee
Copy link

I'm on a 14T90N, and the script runs properly, but the keyboard backlight never updates. Is this a problem with the script or a driver I need?

@leoomi
Copy link
Owner

leoomi commented Jun 22, 2023

I'm on a 14T90N, and the script runs properly, but the keyboard backlight never updates. Is this a problem with the script or a driver I need?

I will be honest, I don't think I can help you directly here, but I do have a few questions. Are you trying to say that the script runs successfully (meaning, it doesn't print errors) but the backlight does not turn on or off?
Have you checked if the driver file exists ( /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness)? If so, try setting its value to 0 or 255. If it doesn't, it's very likely that it was changed in some kernel value, which happened with some other functions as well.
I would have hoped that @wyattbiker would've opened a pull request, as I'm not actively using my LG Gram anymore, but if you can investigate this a bit I can try to update the scripts.

@wyattbiker
Copy link
Author

If you look at the code, it updates the file below with either a 0 (for off) or 255 (for on)

#1 Check if the following file exists
ls -lsa /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness

#2 use the following command to turn the led ON
sudo bash -c "echo 255 > /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness"

#3 use the following command to turn led OFF
sudo bash -c "echo 0 > /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness"

Hope that works.

@duckydee
Copy link

duckydee commented Sep 6, 2023

If you look at the code, it updates the file below with either a 0 (for off) or 255 (for on)

#1 Check if the following file exists ls -lsa /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness

#2 use the following command to turn the led ON sudo bash -c "echo 255 > /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness"

#3 use the following command to turn led OFF sudo bash -c "echo 0 > /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness"

Hope that works.

#1: The file

ls -lsa /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness

does exist on the computer.

#2 & #3: Command does nothing.

I'm on a 14T90N, and the script runs properly, but the keyboard backlight never updates. Is this a problem with the script or a driver I need?

I will be honest, I don't think I can help you directly here, but I do have a few questions. Are you trying to say that the script runs successfully (meaning, it doesn't print errors) but the backlight does not turn on or off? Have you checked if the driver file exists ( /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness)? If so, try setting its value to 0 or 255. If it doesn't, it's very likely that it was changed in some kernel value, which happened with some other functions as well. I would have hoped that @wyattbiker would've opened a pull request, as I'm not actively using my LG Gram anymore, but if you can investigate this a bit I can try to update the scripts.

The file exists, and I can modify the value of the file, but the light doesn't change, and opening the file again shows the value just is stuck at 0.

@wyattbiker
Copy link
Author

You need to have root permissions. Please try this:

sudo nano /sys/devices/platform/lg-laptop/leds/kbd_backlight/brightness

and edit and save the file (I use ctrl-s and then ctrl-x to exit) but as soon as you save, the keyboard should change.

Also does your machine turn on/off the background manually using keyboard Fn-F8

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

No branches or pull requests

3 participants