guillaumezin / nvidiabl

/!\ Please note that I don't maintain this repository anymore, please have a look at forked projects. /!\
82 stars 82 forks source link

Can't Get F Keys To Work - Should They Like This? #90

Open ghost opened 10 years ago

ghost commented 10 years ago

Hi guillaumezin,

On my box acpi_listen and xev don't show any output when I press the F5 & F6, so what I did before for my keyboard lights was run; xmodmap -pke | less and then I used the keycodes I found for the keyboard;

keycode 237 = XF86KbdBrightnessDown NoSymbol XF86KbdBrightnessDown keycode 238 = XF86KbdBrightnessUp NoSymbol XF86KbdBrightnessUp

So I assumed I could do the same for my display and use these keycodes;

keycode 232 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown keycode 233 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp

I use Openbox, so inside the ~/.config/openbox/rc.xml fille I created an entry like this for the monitor;

keybind key="0xe9" action name="Execute" name monitor backlight up name command ~/.config/openbox/backlight-up.sh command action keybind

If you notice the keybind key="0xe9" is the HEX for the keycodes I got like this;

printf "0x%x\n" 237 hex output --> 0xed

printf "0x%x\n" 238 hex output --> 0xee

printf "0x%x\n" 232 hex output --> 0xe8

printf "0x%x\n" 233 hex output --> 0xe9

Then the commands go to a file like you saw above; 'backlight-up.sh' and this is one of the examples inside the file;

!/bin/bash

echo 3 | sudo tee /sys/class/backlight/nvidia_backlight/brightness

SInce this worked for the keyboard light by the kernel module, 'asus-nb-wmi', I assumed this nvidiabl.ko module would also work the same way assigned to the F keys like the keyboard backlight but it doesn't.

If the keyboard backlight worked by these keycodes with these hex numbers for the F keys why can't I get the nvidiabl to work this way too?

lspci -nn 00:00.0 Host bridge [0600]: Intel Corporation 3rd Gen Core processor DRAM Controller [8086:0154](rev 09) 00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port [8086:0151](rev 09) 00:14.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller [8086:1e31](rev 04) 00:16.0 Communication controller [0780]: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 [8086:1e3a](rev 04) 00:1a.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 [8086:1e2d](rev 04) 00:1b.0 Audio device [0403]: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller [8086:1e20](rev 04) 00:1c.0 PCI bridge [0604]: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 [8086:1e10](rev c4) 00:1c.1 PCI bridge [0604]: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 [8086:1e12](rev c4) 00:1c.3 PCI bridge [0604]: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 4 [8086:1e16](rev c4) 00:1d.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 [8086:1e26](rev 04) 00:1f.0 ISA bridge [0601]: Intel Corporation HM77 Express Chipset LPC Controller [8086:1e57](rev 04) 00:1f.2 SATA controller [0106]: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] [8086:1e03](rev 04) 00:1f.3 SMBus [0c05]: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller [8086:1e22](rev 04) 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK107M [GeForce GTX 660M] [10de:0fd4](rev a1) 01:00.1 Audio device [0403]: NVIDIA Corporation GK107 HDMI Audio Controller [10de:0e1b](rev a1) 03:00.0 Network controller [0280]: Atheros Communications Inc. AR9485 Wireless Network Adapter [168c:0032](rev 01) 04:00.0 Ethernet controller [0200]: Qualcomm Atheros AR8151 v2.0 Gigabit Ethernet [1969:1083](rev c0)

cat /sys/class/dmi/id/sys_vendor ASUSTeK COMPUTER INC.

cat /sys/class/dmi/id/product_name G75VW

thanks...

ghost commented 10 years ago

Hi guillaumezin,

Ok even though I couldn't figure out a way to make it work like the keyboard light with the keycodes I was able to make it work with xbindkeys;

http://www.nongnu.org/xbindkeys/xbindkeys.html

For anyone that might read this, or in case you want to list how others can do this, I"ll explain the steps.

1. install xbindkeys

2. make a default configuration running the cmd; xbindkeys --defaults > ~/.xbindkeysrc

3. run the cmd 'xbindkeys -k' without the quotes, and then press the key(s), for the F5 & F6 I did not press the FN key, only F5 & F6, this is the output below for those keys, of course on your laptop it might vary.

"(Scheme function)" m:0x0 + c:71 F5

"(Scheme function)" m:0x0 + c:72 F6

4. Take the nvidiablctl script and copy it to any location you like, for this example I copied it to my $HOME ~/.nvidiablctl

5. at the bottom of your .xbindkeysrc file add in settings similar to what you see below;


My keybindings

decrease brightness

"~/.nvidiablctl down" m:0x0 + c:71 F5

increase brightness

"~/.nvidiablctl up" m:0x0 + c:72 F6


6. Now depending on your distro make sure you have xbindkeys running at startup, then when you press only the F5 or F6 without the FN key, your brightness will change! :)

ENJOY