个人工具

UbuntuHelp:SonyVaioBrightness

来自Ubuntu中文

跳转至: 导航, 搜索

<<Include(Tag/StyleCleanup)>>

Introduction

This page is a quick and brief guide to adjusting the brightness on a Sony VAIO laptop using Ubuntu 6.06.

SONYPI Module

In order to adjust the brightness of a Sony VAIO laptop, the sonypi module needs to be loaded into the kernel.

Step 1: Checking for Module

At the command line issue the following command:

# grep -E "^sonypi" /proc/modules

If you receive a line of outpout, and it states that it is Live, then the module is loaded. If not, move on to step 2.

Step 2: Load the Module

At the command line issue the following commands:

# sudo echo "sonypi" >> /etc/modules
# sudo modprobe sonypi

The first command adds the module to the customizable list of modules to load at startup in addition to the ones normally loaded by the system. The second command loads the module. If the module is already loaded, using this command will harmlessly and pointlessly re-load it. Now test whether the module is loaded with the grep command used above. This time there should be a line of output.

Spicctrl Application

Spicctrl is an app that can be used to measure the battery life, and adjust the brightness of a Sony laptop. Spicctrl is known to work on some Sony laptops, but not all. If this method does not work, read the If Spicctrl Doesn't Work following these initial steps.

Step 1: Install Spicctrl

Issue the following command:

# sudo apt-get install spicctrl

Step 2: Run Spicctrl

Wait for the app to download and install. Once completed issue the following command:

# sudo spicctrl

This will output the options of the program. Issue the following command and read the output:

# sudo spicctrl -B

This should return a number between 0 and 255. Choose a number between 0 and 255 THAT IS DIFFERENT from the number outputed by the command. Replace the # symbol in the following command with that number:

# sudo spicctrl -b#

Once that command is completed, issue the following:

# sudo spicctrl -B

If the number has changed to the one you chose, then Spicctrl is working correctly. What you did, was manually change the number for the display's brightness control. You can change those brightness settings however you want to change the brightness. An added bonus is that Spicctrl can be sucessfully used by any user.

If Spicctrl Doesn't Work

If the previous steps did not work for you or your Sony VAIO, continue reading.

Manual Brightness Editing

NOTE: Changing the brightness or brightness_default file's data to anything other than a number between 1 and 8, could possibly prevent your linux system from succesfully interacting with the monitor, meaning no screen image at all. To change the brightness manually, issue the following command:

# sudo echo 4 > /proc/acpi/sony/brightness

You can replace the number 4 with any number between 1 and 8. The numbers 1 through 8 can be used to adjust the brightness. 1 == dim. 8 == bright. The 'brightness' file changes the current brightness to the level you want. The brightness will stay that way until you change it again or until you shut down the computer.

Retaining Manual Brightness Edits

The default level of brightness that Ubuntu uses whenever it boots up is stored in brightness_default. No matter what you change the brightness file entry to, the next time you start your computer, it's going to use the default brightness again. To change this default brightness to the level you want, issue the following command, replacing the # with any number between 1 and 8:

# sudo echo "#" > /proc/acpi/sony/brightness_default

Shortcuts

The following will aid you in creating shell scripts that will allow you to issue script command instead of typing out the entire command that would change the brightness.

Bright Script

The following code snipplets are to be copied and pasted into a command line. You can paste into a terminal command line by holding SHIFT and pressing the INSERT key on your keyboard. The following command will create a file in the /usr/sbin/ directory called bright. Copy and paste the following:

sudo echo -e '#!/bin/bash \n syntax="\\n \\t SYNTAX:  bright # \\n \\t Where # is any whole number from 1 to 8.\\n"; \n if [ 1$1 -gt 10 ]; \n then \n if [ 1$1 -lt 19 ]; \n then \n echo $1 > /proc/acpi/sony/brightness; \n else \n echo -e $syntax; \n fi; \n else \n echo -e $syntax; \n fi;' > /usr/sbin/bright; chmod a+x /usr/sbin/bright;

Brightdefault Script

Do the same as the Bright Script above. The following command will create a file in the usr/sbin/ directory called brightdefault. Copy and paste the following:

sudo echo -e '#!/bin/bash \n syntax="\\n \\t SYNTAX:  brightdefault # \\n \\t Where # is any whole number from 1 to 8.\\n"; \n if [ 1$1 -gt 10 ]; \n then \n if [ 1$1 -lt 19 ]; \n then \n echo $1 > /proc/acpi/sony/brightness_default; \n else \n echo -e $syntax; \n fi; \n else \n echo -e $syntax; \n fi;' > /usr/sbin/brightdefault; chmod a+x /usr/sbin/brightdefault;

Running the Scripts

Now, to run the Bright Script you can issue the following command:

# sudo bright 4

This will set the brightness temporarily to 4. You can replace the 4 with any number between 1 and 8. To run the Brightdefault Script to change the default brightness, issue the following command:

#sudo brightdefault 3

This will set the default brightness to 3. You can replace the 3 with any number between 1 and 8.