[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tablet mode script

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 found this:  https://stackoverflow.com/questions/469243/how-can-i-listen-for-usb-device-inserted-events-in-linux-in-python

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.  


You received this message because you are subscribed to the Google Groups "BerkeleyLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to berkeleylug+unsubscribe@googlegroups.com.
To post to this group, send email to berkeleylug@googlegroups.com.
Visit this group at https://groups.google.com/group/berkeleylug.
To view this discussion on the web visit https://groups.google.com/d/msgid/berkeleylug/CAGpvfspVaQDhb%2B_1RZZbkA%3D8N02r17bG-RJCRwgB-bYdR9ruYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.