Asus OLED driver

 


Project page    SVN access    Bugs   


 

Asus_OLED is a driver for small OLED display device present in some Asus laptops. The code controlling the display (interface of the device) is based on 'asusoled' program found here: https://launchpad.net/asusoled. The program can not be used together with usbhid driver (unless it is a patched version), which means no USB mouse/keyboard when controlling OLED display. It also needs asus_acpi module, so asus-laptop can't be loaded. This driver works nicely with original, unpatched version of usbhid (if asus_oled is loaded first) and with asus-laptop instead of asus_acpi.

This is my first driver, so bad things may happen. It also may be written poorly, but it works fine on my Asus G1 and it didn't cause any disasters (yet) ;) I hope that it will be useful, but can't give any promises :)

UPDATE: SVN version of Asus_OLED now supports also larger (256x32) OLED displays found in new G50 and G70 models - thanks to Costin Grigoras!
So the list of supported models contains G1, G2, G50, G70 and their variants :) To get it, just run:

		svn co svn://svn.berlios.de/lapsus/asus_oled/trunk asus_oled
	

There is now available small utility for converting graphic files to format understood by the module. It uses Qt library, but works in console. It supports all graphic files types supported by Qt3 and makes it possible to generate text datafiles that can be send to /sys interface of the module. Instead of generating files, it can send the data directly to /sys files, so it works like a drop-in replacement for asusoled. It accepts the same commands, and much more. It also doesn't need graphic files in correct size - it can rescale them automatically, or to size specified by user, trying to maintain aspect ratio unchanged. It is included in Asus_OLED 0.03.

I also plan to add support for this little toy to Lapsus.

There is also small perl script written by Patrick S. Vogt that displays current time on the OLED display: asus_clock.pl


 

Get the source of the latest version (both driver and the utility): asus_oled-0.03.tar.bz2


 

There are also two files I created to get rid of faded 'ASUS' from my OLED. Before this driver (or asusoled utility) was available, I had no choice but to have OLED device all the time on, displaying default 'ASUS' logo. Now, when I display just a white image, it is visible where 'ASUS' logo was, because those pixels are a little bit darker. Following two files have all pixels white, except those that were part of ASUS logo. The second one has black pixels also in places where analog clock (the one displayed by Asus' software in Windows) is. I don't have any results yet, but I hope to make all the other pixels a little bit darker, so the faded logo is not so visible.

Negative ASUS logo     Negative ASUS logo plus analog clock


 

Here are some screenshots:

 

Asus OLED 0.03 on Asus G1
Asus OLED on G1   Asus OLED on G1

 

Asus OLED 0.03 on Asus G50
Asus OLED on G50

 

More info

 

For now there is only a part of README file:

Building the module

   To build the module you need kernel 2.6 include files and some C compiler.

   Just run:
   make
   make install (as a root)

   It will build (hopefully) the module and install it in
   /lib/modules/'uname -r'/extra/asus_oled.ko.

   To load it just use:
   modprobe asus_oled

   You can check if it has detected your OLED display by looking into dmesg output.
   There should be something like this:
   asus-oled 2-7:1.0: Attached Asus OLED device

   If it doesn't find your display, you can try removing usbhid module.
   If you add asus_oled into the list of modules loaded during system boot
   before usbhid, it will work even when usbhid is present.

   If it still doesn't detect your hardware, check lsusb output.
   There should be similar line:
   Bus 002 Device 005: ID 0b05:1726 ASUSTek Computer, Inc.

   If you don't see any lines with '0b05:1726' it means that you have different
   type of hardware that is not detected (it may or may not work, but the driver
   knows only '0b05:1726' device).

*******

Configuration

   There is only one option: start_off.
   You can use it by: 'modprobe asus_oled start_off=1', or by adding this
   line to /etc/modprobe.conf:
   options asus_oled start_off=1

   With this option provided, asus_oled driver will switch off the display
   when it is detected and attached. It is nice feature to just switch off the 'ASUS'
   logo. If you don't use the display, it is probably the good idea to switch it off,
   to protect OLEDs from "wearing off".

*******

Usage

   This module can be controlled with two special files:
   /sys/class/asus_oled/oled_N/enabled
   /sys/class/asus_oled/oled_N/picture

   (N is the device number, the first, and probably the only, has number 1,
    so it is /sys/class/asus_oled/oled_1/enabled
    and /sys/class/asus_oled/oled_1/picture)

   'enabled' files is for reading and writing, 'picture' is writeable only.

   You can write 0 or 1 to 'enabled' file, which will switch
   on and off the display. Reading from this file will tell you the last
   status set, either 0 or 1. By default it is 1, so if the device was set to 'off',
   and the computer was rebooted without power-off, this file will contain wrong
   value - because the device is off, but hasn't been disabled this time and is
   assumed to be on...

   To 'picture' file you write pictures to be displayed by the OLED device.
   The format of the file:
   <M:WxH>
   00001110010111000
   00010101010101010
   ....

   First line is a configuration parameter. Meaning of fields in <M:WxH>:
   M - picture mode. It can be either 's' for static pictures,
       'r' for rolling pictures, and 'f' for flashing pictures.
   W - width of the picture. May be between 1 and 1792
   H - height of the picture. May be between 1 and 32

   For example <s:128x32> means static picture, 128 pixels long and 32 pixels high.

   The physical size of the display is 128x32 pixels. Static and flashing pictures
   can't be larger than that (actually they can, but only part of them will be displayed ;) )

   If the picture is smaller than 128x32 it will be centered. Rolling pictures wider than
   128 pixels will be centered too, unless their width = n*128. Vertically they will be
   centered just like static pictures, if their height is smaller than 32.

   Flashing pictures will be centered horizontally if their width < 128, but they were
   centered vertically in a different way. If their height < 16, they will be centered
   in the upper half of the display (rows 0-15). This is because only the first half
   of flashing pictures is used for flashing. When the picture with heigh = 32 is
   displayed in flashing mode, its upper 16 rows will be flashing in the upper half
   of the display, and the lower half will be empty. After few seconds upper part will
   stop flashing (but that part of the picture will remain there), and the lower
   half of the display will start displayin the lower half of the picture
   in rolling mode, unless it is empty, or the picture was small enough to fit in
   upper part. It is not mine idea, this is just the way Asus' display work ;)
   So if you need just flashing, use at most 128x16 picture. If you need flashing and
   rolling, use whole size of the display.

   Lines following the first, configuration, line are picture data. Each '1' means
   that the pixel is lit, and '0' means that it is not. You can also use '#' as ON,
   and ' ' (space) as OFF. Empty lines and all other characters are ignored.

   It is possible to write everything in one line <M:WxH>01010101010101010...,
   and W*H characters will be used. If there is not enough characters, nothing will be
   displayed. However, the 'line mode' is easier to read (and write), and it also
   lets to omit parts of data. Whenever End-Of-Line character is found, but
   the line is not W characters long, it is assumed that all missing characters
   are equal to the last character in the line.

   Following line represents '0', '1' and a lots of '0's, dependng on the width of the picture
   provided in configuration data:
   010

   So if you need empty line, it is sufficient to write line with only one '0' in it.
   The same works with '1' (or ' ' and '#').

   If there are too many data in the file, they will be ignored. If you are not sure
   how many characters you are missing, you can add few lines with one zero in each of them.

   There are some example pictures in .txt format, that can be used as follows:
   cat foo.txt > /sys/class/asus_oled/oled_1/picture

   If the display is switched off you also need to run:
   echo 1 > /sys/class/asus_oled/oled_1/enabled
   To switch it off, just use:
   echo 0 > /sys/class/asus_oled/oled_1/enabled
	

There is also small Qt3 application available (it uses Qt3, but doesn't need X11), allowing for easy control of the OLED device, as well as image conversion from image formats supported by Qt3, like JPG, PNG, etc. Here is its README:

   This is little Qt (but it is console program) tool for creating data files
   in format recognized by the module. It also makes it possible to control
   the device directly (if the module is loaded).

   It takes name of the graphic file (in one of the formats supported by
   Qt 3.3 library) and either produces text file, that can be written
   to /sys interface of the module (if output file is given with -o parameter),
   or it send the data directly to the /sys interface, if no output file
   is given.

   It is drop-in replacement for 'asusoled' - it accepts the same commands
   and much more:
   - Static, Rolling and Flashing pictures are supported.
   - Aditional 'Flashing/Rolling' mode is possible - in this mode, upper
      half of the picture will be flashing, and lower will be rolled.
   - Graphic files don't need to be correct size, they will be resized,
     either automatically, or to the given size. It will try to preserve
     the ratio of the picture if it is possible.
   - It is possible to specify both enable/disable and send a picture
     with one command.
   - Some basic image processing options:
     * Inversion of pixel values black <-> white
     * 'BlackBackground' method - when there is a lot of white color
       around the main element of the picture, but black elements should
       stay black (for example tux logo), this method changes all white
       pixels in the background to black, leaving only 1 pixel from sides
       of the element.
	

Example of the driver's input file:

<s:32x32>
00000000000001111111000000000000
0000000000001       100000000000
000000000001         10000000000
000000000001         10000000000
000000000001         10000000000
000000000001 1  111  10000000000
000000000001    1 1   1000000000
000000000001  111     1000000000
000000000001 111111   1000000000
000000000001 111111   1000000000
000000000001    1 1    100000000
00000000001      11    100000000
00000000001 11111111    10000000
0000000001  11111111     1000000
000000001   111111111    1000000
000000001  1111111111     100000
00000001   11111111111    100000
00000001  111111111111     10000
0000001   111111111111     10000
0000001   111111111111     10000
0000001   111111111111     10000
0000001   111111111111     10000
000000011 11111111111      10000
000011 11  11111111111    100000
0001  1111  111111111111111 1000
001 1111111  11111111111111 1000
001 1111111  1111111  111111 100
001 11111111 111111   1111111 10
001 11111111          11111  100
001  1111111          111  11100
000111   111   11111  11  100000
000000111   111111111    1000000
	

Copyright (C) 2007, 2008 Jakub Schmidtke

Valid HTML 4.01 Transitional    BerliOS Developer Logo    Play Ogg