レナート   TBFKAYIBYNYAAYB   ﻟﻴﻨﺎﺭﺕ

Thu, 10 Aug 2006

MSI S270 Laptop Linux Kernel Driver

Earlier this year I worked on reverse engineering the brightness control of my MSI S270 laptop. Turning this work into a proper kernel driver was still left to be done. Until yesterday... The result of yesterday's work are two kernel patches I already posted for upstream inclusion.

If you want to test these drivers, download the latest kernel patches:

  1. acpi-ec-transaction.patch
  2. acpi-s270.patch

The two patches apply to kernel 2.6.17. After patching activate "MSI S270 Laptop Extras" under "Device Drivers"/"Misc devices" and recompile and install. After loading the s270 module, you now have a backlight class driver exposing its innards in /sys/class/backlight/s270bl/. For changing the screen brightness issue as root:

echo 8 > /sys/class/backlight/s270bl/brightness

This will set the screen brightness to maximum. The integer range is 0..8.

In addition to this backlight class driver we export a platform driver which allows reading the current state of the WLAN/Bluetooth subsystem. The platform drivers also allows toggling the automatic brightness control feature:

cat /sys/devices/platform/s270pf/wlan                 # Show WLAN status
cat /sys/devices/platform/s270pf/bluetooth            # Show Bluetooth status
echo 1 > /sys/devices/platform/s270pf/auto_brightness # Enable automatic brightness control

If the driver refuses to load (returning ENODEV) and you are sure you have an MSI S270 the machine is probably not recognized correctly by its DMI data. In that case you can pass force=1 to the driver which will force the driver load even when the DMI data doesn't match. YMMV. If everything works correctly please make sure to send me the output of dmidecode, so that I can add the DMI data to the list of known laptops in the driver.

There might even be a chance that this driver works on other MSI laptop models, too (such as S260). YMMV. But don't come running when the driver causes your machine to explode! MSI laptops such as the S270 or S260 are often sold as OEM hardware under different brands (such as Cytron/TCM/Medion/Tchibo MD96100 or "SAM2000"), so if your laptop looks remotely like this one and dmidecode | grep MICRO-STAR yields at least a single line, and you are adventurous than you might want to test this driver on it. And don't forget to send me your dmidecode output if it works for you!

Unfortunately HAL (at least in my version 0.5.7) doesn't support the generic backlight device class yet, which means no gnome-power-manager support for now.

Although this driver is based on reverse engineered data it should be legally safe even in the US. After I did my initial work on the S270 controls MSI supplied me with a register table of their ACPI Embedded Controller (which is what this driver interfaces with) and one of their engineers even tested my work.

Last but not least I created a mailing list for discussion of Linux on the MSI S270. Please join if you run Linux on one of these machines! I will announce future driver work for the S270 there.

posted at: 19:34 | path: /projects | permanent link to this entry | 9 comments


Posted by shensche at Fri Aug 11 01:35:13 2006
kia ora...

thanks for making this effort! but people with that machine should be aware that there are different versions around and mine (S270W-A2856DL (MS-1013-SKU9)) does not this driver for having brightness/WLAN/Bluetooth keys to work.

Posted by Lennart at Fri Aug 11 02:09:35 2006
It doesn't work for you? How that? Please elaborate. Does it just fail to load? This might just be a DMI problem. Please try loading with "force=1".

Posted by Richard Hughes at Fri Aug 11 08:42:27 2006
Hey, open a HAL bug and we can add support into HAL.

Posted by Szu at Fri Aug 11 10:13:26 2006
Hi, I own S260. What exactly should I expect from your patches? I'd like to test them, but since I can already adjust brightness via acpi keys and it adjusts itself when ac is plugged in/off, I wonder what is the advantage of your work.

Posted by Szu at Fri Aug 11 10:21:00 2006
Hi, I own S260. What exactly should I expect from your patches? I'd like to test them, but since I can already adjust brightness via acpi keys and it adjusts itself when ac is plugged in/off, I wonder what is the advantage of your work.

Posted by Lennart at Fri Aug 11 12:48:27 2006
Szu: you can control the screen brightness by software. Tools like gnome-power-manager may then be used to control the screen brightness depending on the current status (power cord plugged, unplugged, battery nearly empty...). In addition the screen might get dimmed when your machine is getting idle, as first step before enabling the screensaver or turning off the screen. The way most PDAs have it. Finally, some nice software can show you a brightness level display whenever you change the brightness.

A similar software can show you the status of the bluetooth/wlan "rfkill" on the screen. Or NetworkManager could warn you if "rfkill" is enabled and you try to conect to a wireless LAN.

Posted by Malte at Thu Feb 22 22:24:26 2007
> After loading the s270 module.
Please mention that the module name is 'msi-lapop'. First I tried to 'modprobe s270' which did not work. then I called make menuconfig and seached for msi here. I did not found the module name there. Then I looked to your mach and which files it changend, go to my kernel source directory mentionend in the patch and found the module name 'msi-laptop'. So please mention the module name somewhere that no one else needed to search that long.
The /sys/devices/ names changed too.

By the way the module is working for me, thanks :-)

Posted by kilou at Wed May 30 17:46:47 2007
I'm using Ubuntu 7.04 on an MSI S260 laptop. I could load the msi-laptop module with force=1 and the brightness could be controlled with issuing:

echo "n" > /sys/devices/platform/msi-laptop-pf/lcd_level

with n=[0-8]

This was working fine until I recently updated to HAL version 0.5.9. With this latest HAL version, I get the brightness control in Gnome power manager but it doesn't work. To make it work I need to pass ec_intr=0 to the kernel in menu.lst.

However the biggest issue is that if msi-laptop force=1 is loaded and I'm using HAL 0.5.9, Gnome power manager displays completely wrong information about the battery status (it says I'm on AC while I'm on battery, wrong battery life etc). Moreover if I type acpi -t in a terminal, the reported CPU temperature is 208.0 degrees C!!!! To get correct acpi information and a working gnome power manager I have to either:

- force-revert HAL version to 0.5.8
or
- unload msi-laptop

Is there anyway to make msi-laptop work with HAL 0.5.9???

Posted by ophil at Thu Oct 23 04:06:40 2008
Hi,
Great Work!

I own s271 and am using windows xp.
You¡¯d probably know the MSI Hotkeys Script (http://forum.msi.com.tw/index.php?topic=98869.0) which use the s270ctrlwin32.dll

I recently replaced the wlan from ralink to atheros ar5008.
As a result, the wlan-button doen¡¯t work (regardless of the LED which indicating wlan status, the wlan is always ON)
And I have to program some functions such as ¡°set_wlan_status¡± which control the radio ON/OFF of my atheros wlan, but I¡¯m dummy on the Hardware I/O programming.

Any idea or suggestion will be welcome.

Leave a Comment:

Your Name:


Your E-mail (optional):


Comment:


As a protection against comment spam, please type the following number into the field on the right:
Secret Number Image

Please note that this is neither a support forum nor a bug tracker! Support questions or bug reports posted here will be ignored and not responded to!


It should be obvious but in case it isn't: the opinions reflected here are my own. They are not the views of my employer, or Ronald McDonald, or anyone else.

Please note that I take the liberty to delete any comments posted here that I deem inappropriate, off-topic, or insulting. And I excercise this liberty quite agressively. So yes, if you comment here, I might censor you. If you don't want to be censored your are welcome to comment on your own blog instead.


Lennart Poettering <mzoybt (at) 0pointer (dot) net>
Syndicated on Planet GNOME, Planet Fedora, planet.freedesktop.org, Planet Debian Upstream. feed RSS 0.91, RSS 2.0
Archives: 2005, 2006, 2007, 2008, 2009, 2010

Valid XHTML 1.0 Strict!   Valid CSS!