Commit | Line | Data |
---|---|---|
fb53440b JS |
1 | |
2 | Driver for Asus OLED display present in some Asus laptops. | |
3 | ||
4 | The code of this driver is based on 'asusoled' program taken from | |
631dd1a8 | 5 | <http://lapsus.berlios.de/asus_oled.html>. I just wanted to have a simple |
fb53440b JS |
6 | kernel driver for controlling this device, but I didn't know how |
7 | to do that. Now I know ;) Also, that program can not be used | |
8 | with usbhid loaded, which means no USB mouse/keyboard while | |
9 | controlling OLED display :( | |
10 | ||
11 | It has been tested on Asus G1 and didn't cause any problems, | |
12 | but I don't guarantee that it won't do anything wrong :) | |
13 | ||
14 | It can (and probably does) have errors. It is usable | |
15 | in my case, and I hope others will find it useful too! | |
16 | ||
17 | ******* | |
18 | ||
19 | Building the module | |
20 | ||
21 | To build the module you need kernel 2.6 include files and some C compiler. | |
22 | ||
23 | Just run: | |
24 | make | |
25 | make install (as a root) | |
26 | ||
27 | It will build (hopefully) the module and install it in | |
28 | /lib/modules/'uname -r'/extra/asus_oled.ko. | |
29 | ||
30 | To load it just use: | |
31 | modprobe asus_oled | |
32 | ||
33 | You can check if it has detected your OLED display by looking into dmesg output. | |
34 | There should be something like this: | |
35 | asus-oled 2-7:1.0: Attached Asus OLED device | |
36 | ||
37 | If it doesn't find your display, you can try removing usbhid module. | |
38 | If you add asus_oled into the list of modules loaded during system boot | |
39 | before usbhid, it will work even when usbhid is present. | |
40 | ||
41 | If it still doesn't detect your hardware, check lsusb output. | |
42 | There should be similar line: | |
43 | Bus 002 Device 005: ID 0b05:1726 ASUSTek Computer, Inc. | |
44 | ||
45 | If you don't see any lines with '0b05:1726' it means that you have different | |
46 | type of hardware that is not detected (it may or may not work, but the driver | |
47 | knows only '0b05:1726' device). | |
48 | ||
49 | ******* | |
50 | ||
51 | Configuration | |
52 | ||
53 | There is only one option: start_off. | |
54 | You can use it by: 'modprobe asus_oled start_off=1', or by adding this | |
55 | line to /etc/modprobe.conf: | |
56 | options asus_oled start_off=1 | |
57 | ||
58 | With this option provided, asus_oled driver will switch off the display | |
59 | when it is detected and attached. It is nice feature to just switch off the 'ASUS' | |
60 | logo. If you don't use the display, it is probably the good idea to switch it off, | |
61 | to protect OLEDs from "wearing off". | |
62 | ||
63 | ******* | |
64 | ||
65 | Usage | |
66 | ||
67 | This module can be controlled with two special files: | |
68 | /sys/class/asus_oled/oled_N/enabled | |
69 | /sys/class/asus_oled/oled_N/picture | |
70 | ||
71 | (N is the device number, the first, and probably the only, has number 1, | |
72 | so it is /sys/class/asus_oled/oled_1/enabled | |
73 | and /sys/class/asus_oled/oled_1/picture) | |
74 | ||
75 | 'enabled' files is for reading and writing, 'picture' is writeable only. | |
76 | ||
77 | You can write 0 or 1 to 'enabled' file, which will switch | |
78 | on and off the display. Reading from this file will tell you the last | |
79 | status set, either 0 or 1. By default it is 1, so if the device was set to 'off', | |
80 | and the computer was rebooted without power-off, this file will contain wrong | |
81 | value - because the device is off, but hasn't been disabled this time and is | |
82 | assumed to be on... | |
83 | ||
84 | To 'picture' file you write pictures to be displayed by the OLED device. | |
85 | The format of the file: | |
86 | <M:WxH> | |
87 | 00001110010111000 | |
88 | 00010101010101010 | |
89 | .... | |
90 | ||
91 | First line is a configuration parameter. Meaning of fields in <M:WxH>: | |
92 | M - picture mode. It can be either 's' for static pictures, | |
93 | 'r' for rolling pictures, and 'f' for flashing pictures. | |
94 | W - width of the picture. May be between 1 and 1792 | |
95 | H - height of the picture. May be between 1 and 32 | |
96 | ||
97 | For example <s:128x32> means static picture, 128 pixels long and 32 pixels high. | |
98 | ||
99 | The physical size of the display is 128x32 pixels. Static and flashing pictures | |
100 | can't be larger than that (actually they can, but only part of them will be displayed ;) ) | |
101 | ||
102 | If the picture is smaller than 128x32 it will be centered. Rolling pictures wider than | |
103 | 128 pixels will be centered too, unless their width = n*128. Vertically they will be | |
104 | centered just like static pictures, if their height is smaller than 32. | |
105 | ||
106 | Flashing pictures will be centered horizontally if their width < 128, but they were | |
107 | centered vertically in a different way. If their height < 16, they will be centered | |
108 | in the upper half of the display (rows 0-15). This is because only the first half | |
109 | of flashing pictures is used for flashing. When the picture with heigh = 32 is | |
110 | displayed in flashing mode, its upper 16 rows will be flashing in the upper half | |
111 | of the display, and the lower half will be empty. After few seconds upper part will | |
112 | stop flashing (but that part of the picture will remain there), and the lower | |
113 | half of the display will start displayin the lower half of the picture | |
114 | in rolling mode, unless it is empty, or the picture was small enough to fit in | |
115 | upper part. It is not mine idea, this is just the way Asus' display work ;) | |
116 | So if you need just flashing, use at most 128x16 picture. If you need flashing and | |
117 | rolling, use whole size of the display. | |
118 | ||
119 | Lines following the first, configuration, line are picture data. Each '1' means | |
120 | that the pixel is lit, and '0' means that it is not. You can also use '#' as ON, | |
121 | and ' ' (space) as OFF. Empty lines and all other characters are ignored. | |
122 | ||
123 | It is possible to write everything in one line <M:WxH>01010101010101010..., | |
124 | and W*H characters will be used. If there is not enough characters, nothing will be | |
125 | displayed. However, the 'line mode' is easier to read (and write), and it also | |
126 | lets to omit parts of data. Whenever End-Of-Line character is found, but | |
127 | the line is not W characters long, it is assumed that all missing characters | |
128 | are equal to the last character in the line. | |
129 | ||
130 | Following line represents '0', '1' and a lots of '0's, dependng on the width of the picture | |
131 | provided in configuration data: | |
132 | 010 | |
133 | ||
134 | So if you need empty line, it is sufficient to write line with only one '0' in it. | |
135 | The same works with '1' (or ' ' and '#'). | |
136 | ||
137 | If there are too many data in the file, they will be ignored. If you are not sure | |
138 | how many characters you are missing, you can add few lines with one zero in each of them. | |
139 | ||
140 | There are some example pictures in .txt format, that can be used as follows: | |
141 | cat foo.txt > /sys/class/asus_oled/oled_1/picture | |
142 | ||
143 | If the display is switched off you also need to run: | |
144 | echo 1 > /sys/class/asus_oled/oled_1/enabled | |
145 | To switch it off, just use: | |
146 | echo 0 > /sys/class/asus_oled/oled_1/enabled | |
147 | ||
148 | ||
149 | ******* | |
150 | ||
151 | For any additional info please have a look at http://lapsus.berlios.de/asus_oled.html | |
152 | ||
153 | ||
154 | ||
155 | Jakub Schmidtke (sjakub@gmail.com) | |
156 |