UT on Meizu MX4 without using physical buttons
-
@jamieweb You can also lock the phone with a slide to the system indicator and than push lock.
But then, the phone ist just locked and the screen is not off. -
@thilov Is there a terminal command I can use to simulate pressing the physical lock button? I could just create a launcher for that.
-
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
locks the phone but the screen is still on.
-
@Lakotaubp Am I able to wake the device using the MX4's touch home ring? Or can I rebind it to a volume button or something? I want to preserve my lock button as it feels like it's about to break.
-
@thilov Ah awesome stuff, thanks for this. Is there a way to do this and turn the screen off too?
-
@jamieweb you can spy dbus with dbus-monitor on a adb shell terminal , then try to lock and wake up the phone, you shoulder be able to see the commands that you need .
sudo dbus-monitor --system
-
@AlainW94 Cool, I'll try that. Will this work with the on-device terminal as well? Or does it have to be via adb?
-
@jamieweb the on device terminal will be paused when the device will go to sleep so you will not see anything with dbus
-
@AlainW94 Ok thanks, hopefully this will solve the ability to lock the phone. Do you have any ideas for how I could wake the phone without using the physical lock button?
Will dbus be able to read the Meizu MX4's touch home ring when the device is locked?
-
@jamieweb I worked on dbus a little with my pro5 finger print reader. included in the home button . From memories the home button send a signal ove dbus or a proximity valus from the finger. I think that an app can read this value but it nerd to run even if the phone is sleeping and this is the problem as when the phone is sleeping, no app are running anymore excepted core apps
-
@AlainW94 Ah right I see. What would be the process for getting a user-written script to run while sleeping as a core app?
-
@jamieweb You can maybe try with a cron task, but I think that you will have to set the filesystem as writtable before to setup your task. Try to run your task every 2 second if it's a script. if you have a loop insinde then you can run it at startup. PS : I don't know if cron is still running when the phone is sleeping, I think yes but without testing it ...
-
maybe upstart would be better than cron. at least it doesn't require rw partition. this https://wiki.ubuntuusers.de/Baustelle/Ubuntu_Touch/Snippets/#Skalierung-der-Anzeige uses an upstart job to change the scaling. in a similar way, I'm sure you can write any other job
-
@AlainW94 I've set up an adb shell and run this command to see what happens on dbus when I press the lock button. Unfortunately there are dozens/hundreds of dbus commands in the log output, rather than just one command that I can put in a launcher.
Do you know whether there is a way to find the overarching command that triggers all of this off when the lock button is pressed?
On a side note, it looks like most of the dbus commands when pressing the lock button are to make the screen fade out over a short period.
-
@jamieweb Hi ! I did not have my notes under the hand for now but one things that you can try to reduce the amount of dbus messages is to switch off gsm/wifi/bluetooth you should have less messages over dbus. Tomorrow I will take a look at my notes to check what can be useful for you.
-
@AlainW94 Thanks for taking the time to have a look.
Unfortunately, I think that all of the dbus messages were actually related to locking the phone, I only ran the monitor command for about 2 seconds - just enough time to press lock.
Ideally I'd like to find the command that actually triggers all of this off and just create a launcher for that, rather than trying to reverse engineer with dbus commands.
-
@jamieweb The only things I found back from my notes regarding D-BUS is this :
signal time=1544722135.567846 sender=:1.0 -> destination=(null destination) serial=8601 path=/com/ubuntu/Upstart; interface=com.ubuntu.Upstart0_6; member=EventEmitted string "dbus" array [ string "SIGNAL=Activity" string "BUS=system" string "INTERFACE=com.canonical.Unity.UserActivity" string "OBJPATH=/com/canonical/Unity/UserActivity" string "SENDER=:1.21" string "ARG0=0" ] signal time=1544722135.795139 sender=:1.0 -> destination=(null destination) serial=8602 path=/com/ubuntu/Upstart; interface=com.ubuntu.Upstart0_6; member=EventEmitted string "dbus" array [ string "SIGNAL=Activity" string "BUS=system" string "INTERFACE=com.canonical.Unity.UserActivity" string "OBJPATH=/com/canonical/Unity/UserActivity" string "SENDER=:1.21" string "ARG0=1" ]
When the home button is pushed. I'm not sure that this will help you a lot...
-
With this command you will lock the user screen but not power off the display :
loginctl lock-session c1
-
@jamieweb You can also take a look at repowerd, it seems to be the deamon that is handling the power button : launchpad repowerd I see some event of it in syslog when pressing the power button.