OK.  Today dumb work decided that it would be great to have guys
installing new windows in the lab, and didn't tell anyone.  So here I am
in the foyer hacking Ubuntu to get away from the annoying sound of
masonry drills, instead of writing the code I'm meant to...

I've re-written jeannich's script to work with xbacklight.

To set up the file where brightness is stored, you have to
]$ mkdir /etc/acpi/var/
]$ cat 50 > /etc/acpi/var/brightness

There's only one snag, you have to run this during your xsession:
]$ sudo /etc/init.d/acpid restart

Also, GNOME appears to be totally ignorant of brightness, so no icon is echoed 
to the screen as brightness is adjusted.
A hybrid version of these scripts would be useful for those of us with both 
Intel 965 and nVidia 8400M GS cards (i.e all the recent SZ's) so that the Fn 
keys work in both SPEED or STAMINA modes

Save this script as /etc/acpi/sonybright.sh

#!/bin/bash
export DISPLAY=:0
function adjust
{
   BRIGHTNESS=$1
   if [ $BRIGHTNESS -ge 100 ]; then
      BRIGHTNESS=100
   fi

   if [ $BRIGHTNESS -le 0 ]; then
      BRIGHTNESS=0
   fi

   echo $BRIGHTNESS >/etc/acpi/var/brightness
   B=$BRIGHTNESS
   echo “adjusting brightness to $B”
   /usr/bin/xbacklight -set $B 2>/tmp/sonybright.log
}

BRIGHTNESS=$(cat /etc/acpi/var/brightness)

if [ "x$1" = "xdown" ]; then
   BRIGHTNESS=$(( $BRIGHTNESS - 10 ))
   adjust $BRIGHTNESS
elif [ "x$1" = "xup" ]; then
   BRIGHTNESS=$(( $BRIGHTNESS + 10 ))
   adjust $BRIGHTNESS
else
   echo >&2 Unknown argument $1
fi

** Description changed:

  Fn keys don't work for dimming the screen, though they do stimulate the
  sonybright.sh script.
  
  xbacklight works if the notebook has an Intel 965 (x3100) display
  adapter, but is subject to bug #176888 (won't work on Hardy, bad XRandR
  setting).
  
- There is no known method for setting the backlight on newer Vaios with
- nVidia GeForce 8 series adapters, though it is possible to pseudo-dim by
- making the LCD blacker (this unfortunately doesn't help with power-
- saving).
+ There is no known method for setting the LED backlight on newer Vaios
+ with nVidia GeForce 8 series adapters, though it is possible to pseudo-
+ dim by making the LCD blacker (this unfortunately doesn't help with
+ power-saving).
  
  There are 2 problems here:
  1)  The Vaio's LED screen is really very bright when burning at 100% and is 
hard to look at for any period
  2)  Battery life suffers
  
  Pretty much all the newer Vaios (2007 onwards) have some combination of
  these graphics adapters so this bug should be widespread (and much
- appreciated when fixed!).  I've tried hacking xbacklight into
- sonybright.sh but I'm not very competent at shell script.
- 
- The sony_laptop module is loaded:
- :~$ lsmod |grep -i sony
- sony_laptop            36520  0 
- 
- tail -f /var/log/acpid
- 
- Reduce screen brightness (sun -), Fn+F5
- 
- -------------------
- [Mon Dec  3 12:54:31 2007] received event "sony/hotkey SPIC 00000001 00000010"
- [Mon Dec  3 12:54:31 2007] notifying client 5304[107:116]
- [Mon Dec  3 12:54:31 2007] notifying client 5616[0:0]
- [Mon Dec  3 12:54:31 2007] notifying client 5616[0:0]
- [Mon Dec  3 12:54:31 2007] executing action "/etc/acpi/sonybright.sh down"
- [Mon Dec  3 12:54:31 2007] BEGIN HANDLER MESSAGES
- cat: /sys/class/backlight/sony/actual_brightness: No such file or directory
- /etc/acpi/sonybright.sh: line 5: [: : integer expression expected
- /etc/acpi/sonybright.sh: line 12: /sys/class/backlight/sony/brightness: No 
such file or directory
- [Mon Dec  3 12:54:31 2007] END HANDLER MESSAGES
- [Mon Dec  3 12:54:31 2007] action exited with status 1
- [Mon Dec  3 12:54:31 2007] completed event "sony/hotkey SPIC 00000001 
00000010"
- [Mon Dec  3 12:54:31 2007] received event "sony/hotkey SPIC 00000001 0000003b"
- [Mon Dec  3 12:54:31 2007] notifying client 5304[107:116]
- [Mon Dec  3 12:54:31 2007] notifying client 5616[0:0]
- [Mon Dec  3 12:54:31 2007] notifying client 5616[0:0][Mon Dec  3 12:54:33 
2007] received event "sony/hotkey SPIC 00000001 00000011"
- ------------------------------
- 
- Increase screen brightness (sun +), Fn+F6
- 
- ------------------------------
- [Mon Dec  3 12:54:33 2007] notifying client 5304[107:116]
- [Mon Dec  3 12:54:33 2007] notifying client 5616[0:0]
- [Mon Dec  3 12:54:33 2007] notifying client 5616[0:0]
- [Mon Dec  3 12:54:33 2007] executing action "/etc/acpi/sonybright.sh up"
- [Mon Dec  3 12:54:33 2007] BEGIN HANDLER MESSAGES
- cat: /sys/class/backlight/sony/actual_brightness: No such file or directory
- /etc/acpi/sonybright.sh: line 5: [: : integer expression expected
- /etc/acpi/sonybright.sh: line 21: /sys/class/backlight/sony/brightness: No 
such file or directory
- [Mon Dec  3 12:54:33 2007] END HANDLER MESSAGES
- [Mon Dec  3 12:54:33 2007] action exited with status 1
- [Mon Dec  3 12:54:33 2007] completed event "sony/hotkey SPIC 00000001 
00000011"
- [Mon Dec  3 12:54:33 2007] received event "sony/hotkey SPIC 00000001 0000003b"
- [Mon Dec  3 12:54:33 2007] notifying client 5304[107:116]
- [Mon Dec  3 12:54:33 2007] notifying client 5616[0:0]
- [Mon Dec  3 12:54:33 2007] notifying client 5616[0:0]
- [Mon Dec  3 12:54:33 2007] completed event "sony/hotkey SPIC 00000001 
0000003b"
- -------------------------------
- 
- uname -a
- Linux samantha 2.6.22-14-generic #1 SMP Sun Oct 14 21:45:15 GMT 2007 x86_64 
GNU/Linux
+ appreciated when fixed!).  A couple of script solutions have been
+ proposed in this bug report; please feel free to hack and make
+ suggestions.

-- 
unable to adjust screen brightness on recent Sony Vaio notebooks
https://bugs.launchpad.net/bugs/173652
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to