Ubuntu: Why does “Airplane Mode” keep toggling on my HP laptop in Ubuntu 17.10?


I have an HP Spectre x360 convertible laptop and I'm running Ubuntu 17.10. Every time I turn the screen sideways or in tablet mode and back, 'Airplane Mode' is activated. In fact, when I boot up and login, I have to manually turn off 'Airplane Mode' and turn wifi back on. I don't want to disable the gnome rfkill plugin like so: 'gsettings set org.gnome.settings-daemon.plugins.rfkill active false' because then I can no longer use bluetooth. Also, for some godforsaken reason, even when I DO disable the plugin, the gnome shell turns on 'Airplane Mode' anyway, which means that I have to go turn wifi back on EVERY time I log in. This is so annoying, I really liked where 17.10 was going but this is seriously breaking the whole gnome shell experience.


In the gnome shell, "Airplane Mode" is automatically activated on boot for many HP laptops, when the screen is tilted sideways, or when the lid is opened/closed. The following is a fix for HP laptops running Linux and using the gnome shell. Keycode 240 is defined as KEY_UNKNOWN (a kind of no-op key) in /usr/include/linux/input-event-codes.h. Also your syslog will no longer prompt you to define the HP e057 and e058 codes, which can be remarkably annoying. Execute then reboot your machine, you should have no more troubles with airplane mode activating incorrectly :)

  sudo sh -c 'printf "#!/bin/sh\n/usr/bin/setkeycodes e057 240 e058 240\n" > /etc/init.d/hp-keycodes'  sudo chmod +x /etc/init.d/hp-keycodes  sudo ln -s /etc/init.d/hp-keycodes /etc/rc2.d/S01hp-keycodes  


I face the very same problem with 17.10 on my HP Spectre x360. In fact, I face both Nicholas and Pierre-Antoine problems:

  • Airplane mode activated every time I login or flip to tablet mode;
  • Fn+F12 (Toggle Airplane Mode key) is no longer working.

To quickly toggle the wifi, I made a small script:

## Content of ~/scripts/wifi_toggle : ##      #!/bin/bash      str=`export LANGUAGE=en_GB ; nmcli r wifi`      [ "$str" == "enabled" ] && nmcli r wifi off      [ "$str" == "disabled" ] && nmcli r wifi on  

I rarely use bluetooth, so it only handles wifi, but you can modify it easily to handle both bluetooth and wifi.

All this is a clear regression from 17.04 where everything worked flawlessly. I tried the 18.04 beta but it's the same situation than with 17.10.

Nicholas, Pierre-Antoine, I fill like filling two bug reports on these issues (on report per issue). Do you think you could had a comment in these reports whenever I'm done reporting? This would help confirming the bug status (more than one user affected).


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »