Ubuntu

samsung x360 fn-keys work incorrectly

Reported by Sergey on 2009-07-15
68
This bug affects 11 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Medium
Unassigned

Bug Description

I've tried installing the latest ubuntu jaunty 9.04 on the samsung x360 laptop
brightness key presses are ignored, dmesg output includes multiple lines
atkbd.c: Unknown key pressed (translated set 2, code 0x83 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e003 <keycode>' to make it known.
I've tried adding HAL description for X360 to file /usr/share/hal/fdi/information/10freedesktop/30-keymap-misc.fdi:
      <match key="/org/freedesktop/Hal/devices/computer:system.hardware.vendor" prefix_ncase="samsung">
        <match key="/org/freedesktop/Hal/devices/computer:system.hardware.product" contains_outof="NC10;SP55S;SQ45S70S;SX60P;SX30S;R59P/R60P/R61P;Q210;Q310;X05;X360">
After that all the fn-keys are recognized by the kernel, but the problem is that fn-keys do not send release button events. The similar bug is
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/347623
I've applied similar patch to the kernel's atkbd.c
...
static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
...
{
  .ident = "Samsung X360",
  .matches = {
    DMI_MATCH(DMI_SYS_VENDOR,"SAMSUNG ELECTRONICS CO., LDT."),
    DMI_MATCH(DMI_PRODUCT_NAME,"X360"),
  },
  .callback = atkbd_setup forced_release,
  .driver_data = atkbd_samsung_forced_release_keys,
},
...
With the new kernel after
xrandr --output LVDS --set BACKLIGHT_CONTROL legacy
brightness keys seems to work correctly.

It would be nice if you could incorporate corresponding changes into the main streamline of ubuntu

Thank you

Sergey (sergey-dodo) wrote :
Jan Skowron (jan-skowron) wrote :

This is very similar bug to two bugs already fixed (or hacked):
Bug #347623: "Samsung q45 does not produce key-release events for Fn-Keys (patch included)"
Bug #295251: "Samsung NC10 brightness keys block keyboard and produce all-or-nothing effect "

It seems that for every new laptop, SAMSUNG produce malfunctioning keyboards, which for some of Fn + XX keys does not sent key-released events.
Bugs mentioned above, and this one, introduce two patches, one patch for atkbd.c about adding artificial key-release events. And other patch for HAL to add these laptops models to definition of Samsung keyboard, so users have not to use setkeycodes for every Fn + XX combination.

If I learn my laptop to recognize for eg. brightness keys with:
setkeycodes e008 225 # brightness up
setkeycodes e009 224 # brightness down
placed in /etc/rc.local, or HAL patch,
than xev shows key-pressed event but no key-release, it produce infinite sample of auto repeated key events - which locks computer.

Would it be possible to introduce same patches as for "Samsung q45 and Samsung NC10 also for Samsung X360 ?

I have found exactly same problem in lanchpad for Samsung R518, R60, NC20, Q35, Q210.
Eg. Bug #360247, Bug #411031, Bug #253874, Bug #385683, etc.
Maybe it will be good to introduce a patch for all Samsung laptops, as all seems to have malfunctioning keyboards? Or to prepare a common, unified bug, where people could place their laptop models to be added to a common patch, without need of filling separate bug reports?

Jan Skowron (jan-skowron) wrote :

For Samsung X360 I have prepared study to show what keys works, and what keys do not work. And what are their scancodes, and how their work if one will attach proper keycodes to them (with setkeycodes or HAL fdi).

--- Keys that do not work, because have no key-release events: ----

#fn Up # brightness up
setkeycodes e008 225
# 225 + 8 = 233
# from xmodmap -pke
# keycode 233 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp
# works, changes brightness, but no key-realese

#fn Down # brightness down
setkeycodes e009 224
# 224 + 8 = 232
# from xmodmap -pke
# keycode 232 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown
# works, changes brightness, but no key-realese

#fn F2 # battery symbol
setkeycodes e003 236
# 236 + 8 = 244
# from xmodmap -pke
# keycode 244 = XF86Battery NoSymbol XF86Battery NoSymbol XF86Battery
# works in Ubuntu, shows batery status, but no key-realese

#fn F4 # external monitor
setkeycodes e002 227
# 227 + 8 = 235
# from xmodmap -pke
# keycode 235 = XF86Display NoSymbol XF86Display NoSymbol XF86Display
# works in Ubuntu, but it changes monitors 5 times per second, constantly blinking, no key-realese

(I have no idea why I have to add 8 to all keycodes to match behaviour with xmodmap? I found out it with reverse engineering.)

--- Keys that do not work, because I don't know what they are, possibly have key-release problems, etc: ----

#fn F5 # backlight on/off
setkeycodes e004 ???
# I don't now what xmodmap event to match to this scancode.
# May have key-release problems?

#fn F7 # first aid kit
setkeycodes e031 ???
# I don't now what xmodmap event to match to this scancode
# May have key-release problems?

#fn F8 # running man
setkeycodes e033 ???
# I don't now what xmodmap event to match to this scancode
# May have key-release problems?

#fn F9 # wifi sign
setkeycodes e006 ???
# does not work. No wifi LED change, wifi state does not change, card allways on
# I don't know how to turn off bluetooth also.
# It is energy consuming bug, and annoying.

# fn F12 # scroll lock
# looks like scroll lock, but does not turn the led on/off
# does not have scancode reported in dmesg

Keys that works out of the box in 9.04:
(maybe have no key-release problems? Or works differently)

#fn Right # volume up
#fn Left # volume down
#fn ESC # suspend
#fn F6 # volume mute
#fn F10 # touchpad on/off
#fn F11 # numlock

#fn F3 # EURO sign
places some strange characters in terminal, xev says that it is a:
Alt_L + sequence of press and release of KP_Insert, KP_End, KP_Down, KP_Up
in keycodes, they are:
64 + 90, 87, 88, 80

# To find out what are the scancodes I have monitored "dmesg | tail" after pressing a key.
# To see what scancodes or keycodes are pressed, I have used showkey, showkey -s
# other usefull tools are dumpkeys, dumpkeycodes and xmodmap, xmodmap -pk

Jan Skowron (jan-skowron) wrote :
Jan Skowron (jan-skowron) wrote :
Jan Skowron (jan-skowron) wrote :
zl0i (sancheolz) wrote :

I made a same patch for my Samsung r60+ and it`s work correct. I think we need to place all patches for this notebooks in one bugreport. And I think good idea will be reconstruct structure like this:
.matches = {
    DMI_MATCH(DMI_SYS_VENDOR,"SAMSUNG ELECTRONICS CO., LDT."),
    DMI_MATCH(DMI_PRODUCT_NAME,"X360"),
},
and made it look like this:
.matches = {
    DMI_MATCH(DMI_SYS_VENDOR,"SAMSUNG ELECTRONICS CO., LDT."),
    DMI_MATCH(DMI_PRODUCT_NAME,"X360"),
},
{
    DMI_MATCH(DMI_SYS_VENDOR,"SAMSUNG ELECTRONICS CO., LDT."),
    DMI_MATCH(DMI_PRODUCT_NAME,"...R60..."),
},
{
    DMI_MATCH(DMI_SYS_VENDOR,"SAMSUNG ELECTRONICS CO., LDT."),
    DMI_MATCH(DMI_PRODUCT_NAME,"....."),
},
I don`t know is this code correct, but I think you understand my idea. So we need to check all keycodes matching(or set of fn keys), symptoms, model and place it in one prepared patch. And if we find that ALL samsung laptops has this bug and same patch, then patch will look like this:
if(DMI_SYS_VENDOR=="SAMSUNG...")
     /* do code to release keys for all samsung laptops */
So we need to find regularity in model of laptop to make universal patch.

scottnn (scottnn) wrote :

Just wanted to add that this effects the Samsung Q320 as well. I'm new to the whole ubuntu thing but if any files or info about the Q320 is needed to resolve this issue please let me know.

Sergey (sergey-dodo) wrote :

I think, it would be a good idea to add a command like setkeycodes, which would mark the codes, which do not have release events. Thus no kernel patching would be needed and the problem could be solved on the HAL level

Jan Skowron (jan-skowron) wrote :

Please see this bug report on Kernel Bugzilla: http://bugzilla.kernel.org/show_bug.cgi?id=14052

There is a patch for kernel to actually allow manipulating of "force_release" option for different keys by sysfs. So there will be no need to make yet another kernel driver changes. But (as Sergey suggested) could be probably managed by HAL itself.

zl0i (sancheolz) wrote :

I waiting too 2.6.32 with this patch. You may post comment #11, to make other know this solution.

zl0i (sancheolz) wrote :

I mean repost it in other same "fn key" bugs.

Shaun Menzies (shaunmenzies) wrote :

Identical situation occuring on Samsung n310 Go running Ubuntu Netbook Remix 9.10. have tested myself and no key-release events on some of the Fn keys.

When will this patch be made available to the community so I can notify the people over at sammy forums who would love to try NBR but baulk at the failing function keys ?

Cheers, Shaun

Sergey (sergey-dodo) wrote :

It is already in 2.6.32-rc6 ( http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32-rc6/ ), to setup key release, I've used the following as root:
echo 116-245 >/sys/devices/platform/i8042/serio0/force_release

Shaun Menzies (shaunmenzies) wrote :

Thanks for feedback, I installed 2.6.32-2 last night but that did not appear to contain the Samsung Fn force release fix. I would very much like to act the Guinea Pig here and use my n310 to test/validate this fix so please feel free to offer advice in getting this fix up and running.

I'm not sure what you mean by "I've used the following as root: echo 116-245 >/sys/devices/platform/i8042/serio0/force_release"

Could you expand into a little more detai ?

Cheers, Shaun.

Shaun Menzies (shaunmenzies) wrote :

Sorry, I forgot to add, I can see the file force_release in the /sys/devices/platform/i8045/serio0/force_release but am a loss what to do with it.

Cheers, Shaun.

Shaun Menzies (shaunmenzies) wrote :

FYI
After installing the 2.6.32 kernal and following the very informative instructions detailed here: http://wiki.archlinux.org/index.php/Extra_Keyboard_Keys

I found that the following keys on the Samsung have scan codes but are not configured:

Fn+UP = 0x88 (e008)
Fn+Down = 0x89 (e009)
Fn+F2 = 0x83 (e003)
Fn+F4 = 0x82 (e002)
Fn+F5 = 0x84 (e004)
Fn+F7 = 0xb1 (e031)
Fn+F8 = 0xb3 (e033)
Fn+F9 = 0x86 (e006)

Not sure this helps but hey, i'm wandering in a dark forest here.

Shaun Menzies (shaunmenzies) wrote :

Update:

After installing 2.6.31 kernal I added the following line to /etc/rc.local

echo 130,131,132,134,136,137,177,179,247,249 > /sys/devices/platform/i8042/serio0/force_release

This forces the missing Fn key scancodes, mentioned above, to produce a key release event.

Then I edited /lib/udev/rules.d/95-keymap.rules and after the 'LABEL=

"keyboard_vendorcheck"' section I added |*N310*| toe the Samsung vendor line that already contained |*NC10*| and |*NC20*|

ALL MY FUNCTION KEYS ARE NOW WORKING!!!!

What a palarva! So the next kernal release should indeed fix the Samsung keyboard function key issues.

Shaun Menzies (shaunmenzies) wrote :

Sorry that should read 2.6.32 kernel.

on Samsung N510 the same bug is present

it is posible to enable Fn+up/down via /lib/udev/rules.d/95-keymap.rules but without release :-/

is it posible to fix this bug in 2.6.31 ...

\northwind

Keng-Yu Lin (lexical) on 2009-12-11
Changed in linux (Ubuntu):
importance: Undecided → Medium
Keng-Yu Lin (lexical) on 2009-12-11
Changed in linux (Ubuntu):
status: New → Confirmed
Keng-Yu Lin (lexical) on 2009-12-11
Changed in linux (Ubuntu):
assignee: nobody → Keng-Yü Lin (lexical)
Keng-Yu Lin (lexical) wrote :
Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Lionel BASTET (lionel-bastet) wrote :

Same issue as Northwind on SAMSUNG N510 Netbook with Ubuntu 9.10 / 2.6.31-16-generic.

Keng-Yu Lin (lexical) wrote :

@Lionel
  I think it's better to report this as another bug since the model seems to be different.

G.D'Elia.it (actg) wrote :

I would like to let you know that the same bug is present on Samsung X520 too.

Zygmunt Krynicki (zkrynicki) wrote :

I have Samsung X520 with bios version 09IA.M011.20100412.KSY (cat /sys/class/dmi/id/bios_version).

The following keys don't work and hang unless you force_release them: volume-up, volume-down, brightness-up, brightness-down, battery-info. Should I open a separate bug for X520?

Keng-Yu Lin (lexical) on 2010-10-15
Changed in linux (Ubuntu):
assignee: Keng-Yü Lin (lexical) → nobody
Sergey (sergey-dodo) wrote :

In ubuntu 10.10 still need to add *X360* to /lib/udev/rules.d/95-keyboard-force-release.rules to make fn-keys release properly

Could anybody provide their /lib/udev/rules.d/95-keyboard-force-release.rules here with string for Samsung X360 included?

Does brightness adjustment keys (Fn+Up, Fn+Down) work properly with this fix?

papukaija (papukaija) on 2011-05-21
tags: added: maverick patch
michelino (puccio) wrote :

in a fresh installed natty on a samsung x360 the key fn+up fn+down works properly and you can see the brightness control notification but the brightness doesn't change!
hope this help!
michele

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
status: Confirmed → Incomplete
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.