You are not logged in.

#1 2016-05-28 08:01:55

chrisnharvey
Member
Registered: 2016-05-28
Posts: 3

[SOLVED] Convertible laptop when switching from tablet to laptop

Hi,

I have a HP Pavilion 13 X360 PC. It's all working perfectly except, when I convert the laptop from tablet mode (keyboard on the back of screen) to laptop mode by rotating the hinge, for some reason GNOME decides to enter Airplane mode.

I have tried using xev to figure out what the keycode is so I can remap them, but this is the output I get when switching to tablet mode:

FocusOut event, serial 36, synthetic NO, window 0x1000001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 36, synthetic NO, window 0x1000001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 36, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   



And this when switching to laptop mode:




FocusOut event, serial 36, synthetic NO, window 0x1000001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 36, synthetic NO, window 0x1000001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 36, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

Ideally I would like it so when I switch to tablet mode, the touchpad gets disabled (the keyboard seems to get disabled automatically, so I'm not sure if this is something the hardware does, or if the software is just figuring this out automatically).

Then when switching back to laptop mode I would like the touchpad to be re-enabled.

Any advice would be greatly appreciated.

Chris

Last edited by chrisnharvey (2016-05-30 08:34:46)

Offline

#2 2016-05-29 22:14:47

chrisnharvey
Member
Registered: 2016-05-28
Posts: 3

Re: [SOLVED] Convertible laptop when switching from tablet to laptop

I came up with a little solution for this. Bit hacky, but works for my needs.

I found out the keycodes for the "flip back" and "flip front" when rotating the laptop screen back and forward. For me, flipping back was showing an icon in GNOME to say the touchpad was disabled (but it wasn't). So I found this code by using the following command:

xmodmap -pk | grep -i touch

Which gave me this:

201        0x1008ffb1 (XF86TouchpadOff)    0x0000 (NoSymbol)    0x1008ffb1 (XF86TouchpadOff)   

I then completely disabled this key using the following command:

xmodmap -e 'keycode 200 = NoSymbol'

I did the same for the "flip front" action, which for me was enabling Airplane Mode in GNOME. So I ran this command to find the keycode:

xmodmap -pk | grep -i wlan

Which gave me the keycode, which I disabled using the command above.

I then went into GNOME settings and setup some keyboard shortcuts, flipping the screen back and forward to tell it which key to bind to.

I then setup these keybindings to run the following command to enable and disable the touchpad.

xinput --set-prop 13 'Device Enabled' 0

I got the ID of the touchpad using xinput --list

Hope this helps someone who might have a similar problem.

If anyone has a better solution to this problem then please let me know.

Offline

#3 2016-05-30 08:33:46

chrisnharvey
Member
Registered: 2016-05-28
Posts: 3

Re: [SOLVED] Convertible laptop when switching from tablet to laptop

For anyone interested, I have written some scripts and a guide on how to do this here: https://github.com/chrisnharvey/x360-rotate-scripts

Contributions welcome.

Offline

Board footer

Powered by FluxBB