Tablet mode script

1 view
Skip to first unread message

tom r lopes

unread,
May 13, 2019, 5:48:12 PM5/13/19
to berke...@googlegroups.com
So I have been playing around with a BayTrail tablet with a keyboard/touchpad dock.  Asus T100taf, with a 64GB Atom Baytrail cpu, 1 GB ram, emmc storage (I don't remember the size) and 32bit EFI.  I installed Arch Linux with LXDE and it runs fine as a laptop.  

Now I want to see if I can get it to run as a tablet in LXDE.  Gnome does pretty good with screen rotation and detaching on my higher end machine (Thinkpad Helix)   But runs like crap on the Baytrail with 1GB ram.  

Gnome uses the accelerometer for screen rotation which in linux is an iio device in /sys  For the undock I think it is an ACPI event.  My machine has the iio device.  So rotation should be easy with a script found on the interwebs.  But the machine doesn't have the ACPI.  Here the keyboard/touchpad are USB devices attached to a hub.  

So for undock I would need a script that looks for USB disconnect.  I don't know anything about scripting or programming:  


I took the last answer in that link and modified it a little:  

import pyudev import subprocess context = pyudev.Context() monitor = pyudev.Monitor.from_netlink(context) monitor.filter_by(subsystem='usb') for device in iter(monitor.poll, None): if device.action == 'remove': subprocess.Popen("onboard")


It works Ok but onboard runs for any USB disconnect.   I want onboard for specific USB is disconnected.   I will have to read up a bit more.  


Thomas


Reply all
Reply to author
Forward
0 new messages