Once you've got powernap configured for sleep, it's only a few short steps to enable screen dimming that works in both the console and in X.
To do so, you'll need to use the two-tier powernap action method. Set the first action method (line 22 of /etc/powernap/config) to 0, or powersave. Set the second action (line 109) to 1, for suspend.
Then, head on over to /etc/pm/power.d. This is the directory for scripts that execute when powersave mode is invoked. Create a new file, called brightness, containing the following:
#!/bin/sh
case $1 in
true)
sudo /usr/local/bin/brightness-set 400
;;
false)
sudo /usr/local/bin/brightness-set 2700
;;
esac
[ Note: Substitute brightness-set for your favorite brightness CLI command, I use https://github.com/williballenthin/chrubuntu-brightness-controls.]
Once you've configured your ABSENT_SECONDS to your desired screen dimming timeout in powernap, you should be all set.
Enlightened Chrubuntu
Chromebook + Ubuntu + Enlightenment
Wednesday, February 26, 2014
Thursday, February 20, 2014
Suspend when Idle
E's power management features work well for the most part, but if you want your Chromebook to sleep when idle while working in the console (not running X), you're out of luck. One solution is powernap, which makes use of various "monitors" to determine whether the system is idle or not.
Next, head on over /etc/powernap. You'll see a file here called config. Open that up, and head over to the line that reads this:
[ConsoleMonitor]
ptmx = y
For whatever reason, /dev/ptmx doesn't work for monitoring console activity in Chrubuntu, so change this to /dev/pts, so it reads:
[ConsoleMonitor]
pts = yes
[ UPDATE: You actually need to edit the powernap python script itself to get this to work. Head on over to /usr/share/pyshared/powernap/monitors/ConsoleMonitor.py and open it up in your favorite text editor. Skip down to line 38 and change the words "keyboard" and "mouse" to "cros_ec_keyb" and "cyapa" respectively. Then sudo service powernap restart. Note that these device names may vary depending on your version of the kernel / Ubuntu, you can see the full device list in /proc/interrupts. It may not be obvious which device is which.)
Powernap supports a sort of escalation, but if you just simply want your Chromebook to sleep when idle, you can change ACTION_METHOD from 0 (powersave) to 1 (suspend), and it will sleep immediately after ACTION_SECONDS expires.
It doesn't work out of the box, but only a few simple edits are required.
After installing the package, first go edit /etc/default/powernap. You'll see these lines:
# start powernap at boot [yes|no]
START=no
Just change no to yes and save the file.
[ConsoleMonitor]
[ConsoleMonitor]
[ UPDATE: You actually need to edit the powernap python script itself to get this to work. Head on over to /usr/share/pyshared/powernap/monitors/ConsoleMonitor.py and open it up in your favorite text editor. Skip down to line 38 and change the words "keyboard" and "mouse" to "cros_ec_keyb" and "cyapa" respectively. Then sudo service powernap restart. Note that these device names may vary depending on your version of the kernel / Ubuntu, you can see the full device list in /proc/interrupts. It may not be obvious which device is which.)
You'll probably also want ACTION_SECONDS from the default 30 to something more reasonable like 300 (5 minutes) once you're sure everything is working.
The processor load monitor works fine when set to the default, but there's plenty of other monitors you can configure (disk activity, network activity, etc.) that ship inactive if you want more advanced idle detection.
Reboot to be safe, or you can try restarting the powernap service using sudo service powernap restart.
Reboot to be safe, or you can try restarting the powernap service using sudo service powernap restart.
Using this method, sleep/wake works perfectly fine from within X (with Enlightenment's auto blanking turned off) or the console alike. I might use the same technique for auto dimming, because I've found E's built-in auto dimming feature to be somewhat flakey.
Lid sleep on the Chromebook
This is a pretty easy one. Make sure you have acpid installed and add a file called lid to the /etc/acpi/events folder that contains the following:
event=button/lid
action=/etc/acpi/lid.sh
Then, add a script in your /etc/acpi folder that contains this:
#!/bin/bash
if [ -f /var/lock/lidsleep ]; then
rm /var/lock/lidsleep
else
touch /var/lock/lidsleep
/usr/sbin/pm-suspend
fi
You can also add lid-specific sleep commands here if you desire, but I'd use /etc/pm/sleep.d for global sleep commands. Be sure to see the prior post on disabling the trackpad during sleep, or your Chromebook is going to wake up if you even look at it wrong.
Reboot or restart acpid and lid sleep should be working.
event=button/lid
action=/etc/acpi/lid.sh
Then, add a script in your /etc/acpi folder that contains this:
#!/bin/bash
if [ -f /var/lock/lidsleep ]; then
rm /var/lock/lidsleep
else
touch /var/lock/lidsleep
/usr/sbin/pm-suspend
fi
You can also add lid-specific sleep commands here if you desire, but I'd use /etc/pm/sleep.d for global sleep commands. Be sure to see the prior post on disabling the trackpad during sleep, or your Chromebook is going to wake up if you even look at it wrong.
Reboot or restart acpid and lid sleep should be working.
Wednesday, February 19, 2014
Disable the trackpad during sleep without X
One of the biggest gripes Chromebook users have reported is that the Chromebook wakes up too easily because of the trackpad. There are multiple solutions for this if you're running CrOS or X11, but if you're often using just the console, tricks like xinput and Chrosh's tpcontrol don't work.
But all is not.. naught! You can use the same technique described here for USB devices. First you need the identifier for the trackpad, though, which doesn't show up using lsusb.
You'll find your trackpad's identifier under /sys/bus/i2c/drivers/cyapa -- there should be a directory there called something like 1-0067. That's the identifier:
root@calculon:/sys/bus/i2c/drivers/cyapa$ ls
1-0067 bind uevent unbind
Next, using the trick from the above post, create a new script in /etc/pm/sleep.d. The file should contain:
#!/bin/bash
But all is not.. naught! You can use the same technique described here for USB devices. First you need the identifier for the trackpad, though, which doesn't show up using lsusb.
You'll find your trackpad's identifier under /sys/bus/i2c/drivers/cyapa -- there should be a directory there called something like 1-0067. That's the identifier:
root@calculon:/sys/bus/i2c/drivers/cyapa$ ls
1-0067 bind uevent unbind
Next, using the trick from the above post, create a new script in /etc/pm/sleep.d. The file should contain:
#!/bin/bash
case $1 in
hibernate|suspend)
echo '1-0067' | tee /sys/bus/i2c/drivers/cyapa/unbind
;;
thaw|resume)
echo '1-0067' | tee /sys/bus/i2c/drivers/cyapa/bind
;;
*)
echo "Somebody is calling me totally wrong."
;;
esac
Moar battery life for all!
Chromebook + Enlightenment + Ubuntu: The Divine Trio
To better understand what makes the Samsung Chromebook such a great Linux sub-notebook/netbook, first a quick look at its merits:
- Dual core 1.7GHz Samsung Exynos ARM processor
- Mali T604 GPU (also used in the Samsung Galaxy Note)
- Terrific battery life (a true 6.5 hours)
- Lightweight (2.4 lbs)
- SD slot (be warned, the near-identical HP cousin loses the SD slot, but gains micro-usb charging)
- Incredibly loud stereo speakers (why can't Apple figure this out?)
- Chrubuntu - a tailor-made distribution of Ubuntu
- Netflix support (haven't gotten this working in Ubuntu yet, but you can boot into Chrome OS if the need arises)
- USB 3.0
- HDMI out
- No moving parts
I got my latest Chromebook as an open box for $150 at Best Buy, but you can get brand new ones at Amazon (prime) for just north of $200 as of this posting.
For storage, I've got a 32GB SDHC card that I cut to half height so it doesn't stick out. (Many modern SD cards are actually micro-USB sized inside, your mileage may vary.) There are also some flush half-height SD cards made for Macbooks which may work well.
The Chromebook's case is somewhat flimsy and marks easily, so I use the Pearl mCover hard case, which also comes with some handy flip-up keyboard-style feet. It snaps on and fits perfectly.
I won't go into the merits of Ubuntu, except that Chrubuntu makes installing it a snap. There are other distributions such as Bodhi and Arch Linux that you can also put on your Chromebook.
Now, the case for once-mythical Enlightenment (E17/E18/E19?) window manager:
- Extremely lightweight
- Fast, elegant desktop effects / eye candy
- 2D/3D hardware acceleration (using EGL/GLES, more on this in a future post)
- Very active development
Really, though, it's the snappiness, visuals and hardware acceleration that make Enlightenment such a great match for the Chromebook. The desktop effects are designed to make the most of limited CPU/GPU power and leave you with an experience that doesn't feel sluggish. An alternative would be Compiz with the more bloated Gnome/Unity or XFCE, but with all of these options you need to compile them yourself for GLES support (including Enlightenment), and some of them are more daunting than others.
So, there you have it. This trio makes a great, portable Linux notebook that provides a decent and highly portable Linux desktop experience.
First post!
I'm starting this blog to chronicle my (mis)adventures running E17/E18 (Enlightenment) on Ubuntu (Saucy) using a Samsung Chromebook. In the last six months, I've spent perhaps more time hacking on my Chromebook than I've spent with my girlfriend (we joke that the Chromebook is the love of my life--except she doesn't find it funny.) But there's something about the challenge of getting a 3D accelerated desktop running on a ARM-powered $200 notebook that has me hooked.
Much of what you read here is thanks to the hard work by people at Google and Samsung (and elsewhere) who seem equally obsessed at this prospect. It's possible (even likely) I am the only other person in the world trying to do this, in which case this will be a good log for me of what I've accomplished--and how.
I'm starting this blog to chronicle my (mis)adventures running E17/E18 (Enlightenment) on Ubuntu (Saucy) using a Samsung Chromebook. In the last six months, I've spent perhaps more time hacking on my Chromebook than I've spent with my girlfriend (we joke that the Chromebook is the love of my life--except she doesn't find it funny.) But there's something about the challenge of getting a 3D accelerated desktop running on a ARM-powered $200 notebook that has me hooked.
Much of what you read here is thanks to the hard work by people at Google and Samsung (and elsewhere) who seem equally obsessed at this prospect. It's possible (even likely) I am the only other person in the world trying to do this, in which case this will be a good log for me of what I've accomplished--and how.
Subscribe to:
Posts (Atom)