You are not logged in.

#1 2012-11-19 13:33:05

From: Stockholm
Registered: 2012-11-09
Posts: 53

Asus Laptop (G1, G2, G5, G70, G71) OLED display: Command line utility.

Yep. You did read the subject line properly. There is a new command line utility in town.
To be more exact, there are two small utilities that I have designed for this little OLED -display. (Links at the end of this post)
To anyone still in confusion, let me show you:

Some Asus laptops comes with this neat little status display, but few softwares around to utilize them.
Specially when it comes to the Linux operating system.

What I've made here, is a simple and easy to use command line utility that communicates with the display.
But it doesn't stay at "simple". It also has a few advanced features, which is described in detail in the README and their --help sections.
With this utility and a bunch of simple pixmap images, anyone can easily create messages, animations and transitions without the need of deep knowledge of the underlying system.

This makes it perfect for boot animations, event updates, status changes and alike.

Short video-demostration:

X11 Pixmap Format
To get starting, you need a set of pictures.
You should, and is encouraged to create these yourself, and if you do, please share your creations with us here. I will update a list of your creations in this post accordingly.
These utilities can, at the moment, only read xpm images. Most drawing programs can handle this today so hat shouldn't be a problem.
There is a preferred format, but other formats are possible:
*  Colordepth: 1 bit (Monocrome)
*  Height: 32 pixels
*  Width: 128 pixels (for G1 and G2) or 256 pixels (for G5, G70, G71 ...)

There are a few prepackaged XPM images that can be used any way you see fit.
GIMP is the tool I used to create the pictures and animations.

To install: Read INSTALL. Keep in mind: 'bin' and 'conf' folder relies on eachother, so they should stay together. I plan to improve this, but that's another story.
Permissions: Again. Read the 'INSTALL' file. You need rw-access to two class nodes:

  • /sys/class/asus_oled/oled_1/picture

  • /sys/class/asus_oled/oled_1/enabled

Doesn't exist??? ... did you read the INSTALL and README?... aw... well.. here's a hint:

# modprobe asus_oled && ls -l /sys/class/asus_oled/

The module should already exist, and if you're running Arch Linux on that laptop with the default kernel, it's already loaded.
The modules comes with the Linux kernel itself (Staging area). Nothing else needed to be done. Isn't that awesome? smile
If you happen to run a custom kernel, reconfigure it and activate 'asus_oled' as a module. Recompile, install and eat icecream.
(Icecream part is very important)

Once you created your awesome xpm image, you want it to live on the OLED display. This is the command:

$ asus_oled-ctl --static-picture My-Awesome-128x32-Pic.xpm 

Explanation: '--static-picture' just simply converts and loads a picture onto the display and exits. Nothing fancy really.

You haven't created a picture yet? .... horrible drawing skills? ...
Well ... *sigh* ... Try one of the prepacked pictures then. 128x32_archlinux-logo1.xpm should suffice.
You find it under pictures/logos/
Success? Yay! Have some more icecream!

Next thing you might be interested in, is animations.
Animations is pretty much just a series of static images inserted one after another in a rapid manner.
So get to it and convert the whole Star Wars saga to a series of 128x32 monocrome XPM pictures...
... or just make a short animation of your liking... and SHARE IT!
Need a neat command to show your animation skills on the display? Here it is:
(NOTE: There's a bug that causes this utility to have serious trouble with spaces in paths and files. I'm aware of it. Just avoid spaces for now... )

$ asus_oled-ctl --cycle 50,10 path/to/my/awesome/animation/* 

Explanation: '--cycle' cycles through all the pictures it's given. The argument '50,10' tells it to delay each frame 50 milliseconds, and loop through them 10 times.
If you instead wanted one loop instead of 10 and decrease the speed to 100 milliseconds per frame? Just change it accordingly:

$ asus_oled-ctl --cycle 100,1 path/to/my/awesome/animation/* 

Still a bit confused on how the animations should be set up?
Have a look at the prepacked examples found under pictures/animations/
Hey! why not test one of the examples out:

$ asus_oled-ctl --cycle 50,10 pictures/animations/Arch-ripple_loop/* 

Want it to be endless? Set the loop part to 0, and it will loop forever, or until you run out of power. (You can hit CTRL+C to interrupt)

$ asus_oled-ctl --cycle 50,0 pictures/animations/Arch-ripple_loop/* 

You might have noticed it took a few seconds before the animation started from the point you hit [Enter]. (And that it took some CPU to do it)
It's because the utility have to convert the images to a more fitting format before it goes ahead.
Fortunately, there's a remedy to that delay. It's called cached slots. What it means is that one can tell the utility to store the converted animation data in a storage slot for later use.
Here's how to do it:
Step 1: Convert your awesome animation, and store it into a named cache-slot called 'MyAwesomeAnimation'.

$ asus_oled-ctl --generate-cache MyAwesomeAnimation path/to/my/awesome/animation/* 

It will crunch your pictures for a few seconds, and then exit normally.
Wait.... WHAT??? ... You did convert Star Wars whole saga?... Wow!!!... That will take an eternity to crunch through... =O
Once it's done (Hopefully this site still lives when it is) we can now see what cache slots we have in the storage:

$ asus_oled-ctl --show-cache

There's your Star Wars saga... *erh*.. awesome animation. If you did a full install, you might notice a few other slots too. You can test em out if you'd like.

Now to play that cached animation:

$ asus_oled-ctl --cycle 50,5,MyAwesomeAnimation 

Notice how the animation starts almost instantly this time. That's what cache is for.

Want to delete any of thos annoying and horrible slots?

$ asus_oled-ctl --delete-cache MyAwesomeAnimation 

Now a few other commands to try out and discover what they do:

$ asus_oled-ctl --power off
$ asus_oled-ctl --power on
$ asus_oled-ctl --clear
$ asus_oled-ctl --static-picture pictures/devel/ASUS-logo_reversed.xpm
$ asus_oled-ctl --help
$ xpm2asus_oled pictures/logos/128x32_archlinux-logo1.xpm
$ xpm2asus_oled  --output ansi pictures/logos/128x32_archlinux-logo1.xpm
$ xpm2asus_oled --help

I hope that I've introduced the utilities for you and awaken your interest in this otherwise useless little display with a neat ASUS-logo on it.
Now get on to it and create some awesome logos and animations for us all to use.
I will update this utility every now and then, and hopefully include some of your animations with the package.

The community's contribution list:

  • ... *tumbleweed in the wind* ...


Read README for details. (It's named README for a reason)

Version 0.1.2 - Minor bugfixes.

Upcoming: 0.2 - Rewritten in python. Twice as fast.

Last edited by SysGhost (2012-11-23 14:51:16)

-"If the primates that we came from had known that someday politicians would come out of the gene pool, they'd have stayed up in the trees and written evolution off as a bad idea!"


Board footer

Powered by FluxBB