Thursday, November 7, 2013

Usability on My Samsung Chromebook: Chromium/Flash and Brightness

Introduction


In a previous post, I described how I was able to get Bodhi Linux installed on my Samsung Chromebook (armhf architecture). It is set up for a dual boot environment (with ChromeOS), although at this point I don't have plans to boot in ChromeOS.  Although the install process I used included a filesystem image specifically for the Chromebook, there were still additions and tweaks I needed to make to make it more usable.

Chromium Browser Plus Flash


One of the things that could make or break the usability of environment would be the ability to play Adobe Flash content.  Although YouTube has moved away from Flash, there are still many web sites that use Flash content.  Being unable to view Flash content within a web browser would be a pretty major limitation.  Fortunately, there is a solution at least for one browser. While there does not appear to be a version of the Adobe Flash player for armhf, there is a version of the Google Pepper Flash player plug-in (see discussion here) which works with the Chromium browser.

So the first issue would be installing the Chromium browser. When I previously ran Ubuntu in crouton on my Samsung Chromebook I simply installed chromium from the Ubuntu repositories. Unfortunately, for armhf architecture Bodhi is based on Debian, not Ubuntu. I tried grabbing the Chromium browser packages from Ubuntu 12.04 and installing them on Bodhi. Unfortunately, I ran into a lot of dependency issues.  Fortunately, there is a version of the Chromium browser built for the Raspberry Pi computer, which is also uses the armhf architecture. I found the packages in the raspian repository here.  I downloaded all the deb packages (except the ones with "-dbg" in the name) onto my system.  To install them, I used GDebi, which does dependency resolution when installing packages. After getting the Chromium browser installed, I ran into some error messages about nss when running it. To resolve these, I executed the command

sudo ln -s /usr/lib/arm-linux-gnueabihf/nss /usr/lib/nss

With chromium running properly, I needed to use the libpepflashplayer.so 

To get the library file I had previously within ChromeOS opened a terminal (Ctrl+alt+t) and executed the command:

cp /opt/google/chrome/pepper/libpepflashplayer.so ~/Downloads/

I then copied the file to a flash drive for use after installing Bodhi. Alternatively, you could upload it somewhere (for example Google Drive) and then download it after installing Bodhi. Once on the machine, I decided to copy it to /usr/lib.  To do so, you need to use sudo. For example, assuming you have a terminal open to the directory where you downloaded or copied libpepflashplayer.so, you would execute the command:

sudo cp libpepflashplayer.so /usr/lib

Then to test it, I executed the command:

/usr/bin/chromium --ppapi-flash-path=/usr/lib/libpepflashplayer.so --ppapi-flash-args=enable_hw_video_decode=0,enable_stagevideo_auto=0,enable_trace_to_console=0 --disable-flash-3d

You can put libpepflashplayer.so where you want, but I discovered that simply placing it in the plugins directory for the Chromium browser was not sufficient. I had to put it somewhere and specify its path when invoking /usr/bin/chromium.

Once I tested flash content within the Chromium Browser and saw it was working, I edited /usr/share/applications/chromium.desktop and changed the Exec line to:

Exec=/usr/bin/chromium --ppapi-flash-path=/usr/lib/libpepflashplayer.so --ppapi-flash-args=enable_hw_video_decode=0,enable_stagevideo_auto=0,enable_trace_to_console=0 --disable-flash-3d %U

Note, to edit the file you will need sudo. I use gedit to edit, but there are other options available. Once I updated the (launcher) file as described above, I was able invoke the Chromium Browser normally (via application menu for example) and have it process Flash content.

Adjusting Screen Brightness


The Samsung Chromebook has keys labelled for decreasing and increasing screen brightness. These are in the F6 and F7 positions on the keyboard.  Bodhi has a Backlight module providing a widget for controlling brightness, but this did not work for me. What I decided to do was use a simple script and invoke it from the aforementioned keys to control brightness.

I based my script on work done by hkoster1 on the Debian User Forums. First I had to find the brightness device file to send adjustments to.  By searching, I found it at /sys/devices/platform/s3c24xx-pwm.0/pwm-backlight.0/backlight/pwm-backlight.0/brightness.

The script, based on getting an argument of "u" (for up) or "d" (for down) increases or decreases the brightness respectively. It does this by first getting the value from the brightness file (should be an integer between 0 and 2800) and adjusting it up or down by 200.  The script will only set a value between 200 and 2800. If you want to allow a value down to zero, you could modify the script.

You can download my script (into a directory to which you have write access) via the command:

wget --no-check-certificate https://googledrive.com/host/0Bx4fuKmDTtwmZWJMeEtpRWZxY1E

Then execute the command:

mv 0Bx4fuKmDTtwmZWJMeEtpRWZxY1E brightness

followed by:

chmod +x brightness

and then:

sudo cp brightness /usr/local/bin

You can test it by executing:

/usr/local/bin/brightness u

to increase brightness

/usr/local/bin/brightness d

to decrease brightness

Next I needed to assign commands to the two brightness keys. First I had to get to the keybindings menu via "Settings->All->Input->Key Bindings". Since the key, F6, for brightness down was not defined, I had to add it by pressing the "Add" button and then hitting the key. Then on the right I scrolled down to Launch and selected "Command" and then entered into the "Action Params" textbox:

/usr/local/bin/brightness d

You can see a screenshot of this key binding here:




I hit the "Apply" button to make the setting stick. Next, I did the same for brightness up by hitting the "Add" button for F7 and entering the command:

/usr/local/bin/brightness u

and hit "Apply" again.

After this, I could control the screen brightness up and down with the 2 keys.





No comments:

Post a Comment