Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System menu does not show up when power button is pressed #83

Closed
MerlijnWajer opened this issue Feb 19, 2018 · 23 comments
Assignees
Labels

Comments

@MerlijnWajer
Copy link
Member

@MerlijnWajer MerlijnWajer commented Feb 19, 2018

No description provided.

@MerlijnWajer MerlijnWajer self-assigned this Feb 23, 2018
@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Feb 25, 2018

The UI itself still works; issue this to see that:

dbus-send --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.powerkeymenu_open string:"com.nokia.mce" string:"/com/nokia/mce/request" string:"com.nokia.mce.request" string:"devlock_callback" uint32:'0'

So the question is now: why does mce not call this method?

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Feb 25, 2018

It seems to be related to a specific state mce gets in. If I do this:
/etc/init.d/mce stop
/etc/init.d/mce start
(press power key)

It works. If I then use the lock switch to lock and unlock. Then after unlock the power key does not work.

Log here: https://ptpb.pw/N-1p

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Feb 25, 2018

Seems like the callback to tell mce the menu is closed is never execute (properly?).

This command 'resets' mce so it accepts the menu again (once):

dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.powerkey_callback int32:2

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Feb 25, 2018

Adding this to /etc/dbus-1/system.d/mce.conf:

<policy user="user">
<allow send_destination="com.nokia.mce"/>
<allow send_interface="com.nokia.mce.*"/>
</policy>

Makes it all just work. Is this harmful, allowing the user user to make calls to MCE? Seems like the intended purpose here.

However, Fremantle also only has the root rule and deny-all for everything else. I don't understand how it works in Fremantle. Does it work differently?

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Feb 25, 2018

Furthermore, it seems like when MCE does a call to say systemui-powerkeymenu, powerkeymenu acts on it, reports the call was OK, but then also returns that the method does not exist:

method call time=1519595657.625516 sender=:1.31 -> destination=com.nokia.system_ui serial=76 path=/com/nokia/system_ui/request; interface=com.nokia.system_ui.request; member=powerkeymenu_open
   string "com.nokia.mce"
   string "/com/nokia/mce/request"
   string "com.nokia.mce.request"
   string "powerkey_callback"
   uint32 0
method return time=1519595657.698877 sender=:1.9 -> destination=:1.31 serial=68 reply_serial=76
   int32 -3
error time=1519595657.702203 sender=:1.9 -> destination=:1.31 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=76
   string "Method "powerkeymenu_open" with signature "ssssu" on interface "com.nokia.system_ui.request" doesn't exist
"
error time=1519595657.703302 sender=org.freedesktop.DBus -> destination=:1.9 error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=69
   string "Rejected send message, 2 matched rules; type="error", sender=":1.9" (uid=1000 pid=2296 comm="/usr/bin/systemui ") interface="(unset)" member="(unset)" error name="org.freedesktop.DBus.Error.UnknownMethod" requested_reply="0" destination=":1.31" (uid=0 pid=2794 comm="/sbin/mce --force-syslog ")"

I believe this may be a problem in systemui dbus code, likely in this function (or how it is used):

static DBusHandlerResult dbus_req_handler(DBusConnection *connection, DBusMessage *msg, void *user_data)
@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Feb 25, 2018

Another issue, after the my dbus rules fix, it kind of works, but somehow not from boot. Requires mce restart before it all starts working. But why?

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Feb 26, 2018

So it seems that mce boots up in this submode: MCE_TRANSITION_SUBMODE; because /var/run/mce/call is not initialised. This is OK, but the submode is never removed, per https://github.com/maemo-leste/mce/blob/master/mce-dsme.c#L710

This signal is supposed to be send so that it exits that submode:

dbus-send --system --type=signal /com/nokia/startup/signal com.nokia.startup.signal.init_done

(This is from here: /etc/X11/Xsession.post/99initdone)
That will remove that mode.

Then, MCE will enter submode MCE_BOOTUP_SUBMODE, which is then removed with this:

dbus-send --system --type=signal /com/whatever com.nokia.HildonDesktop.ready

Finally, then, you can use powerkey and tklock. (This is in /etc/X11/Xsession.post/21hildon-desktop-wait)

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Feb 26, 2018

I've committed the dbus changes: maemo-leste/mce@6fef530

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Mar 3, 2018

@freemangordon - do you believe those dbus changes are not required?

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented May 31, 2018

So while this is an issue on pretty much every device, setting rc_parallel="YES" in /etc/rc.conf fixes this on all devices, except for the N900. The N900 doesn't reliably boot with this setting on. But on my droid4, my tablet, my pi, this fixes this issue. We will still have to fix the session handling so that it also works in non-parallel boot (I guess?), or we just have to fix the N900 parallel boot process.

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Jun 15, 2018

@parazyd I think I got the N900 to work with parallel bootup. Few fixes required. First is that /etc/init.d/xorg must depend on the powervr init script. Second is, I think, one that applies to all - we must ensure that dbus runs before networking is started, when wifi is brought up/online (since wpa supplicant now starts with dbus support enabled). This is currently not the case. I think just moving dbus to sysinit runlevel might work.

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 2, 2018

The dbus/wpasupplicant issue is fixed in a different manner. I've taken the latest image, added 'powervr' to xorg dependencies, and parallel boot works, some of the time, but it's still a bit broken, due to timeouts in openrc, because hildon-desktop takes forever to start up due to powervr issues. We can either fix that timeout, or we can move the dbus session starting to an init script, have that as a separate init script, and have mce (and af-services?) depend just on that session bus, and not on xorg. Then we can have mce start before xorg (and af-services?), and the race that we're seeing from non-parallel bootup will be gone.

But maybe it makes more sense to just fix parallel boot.

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 2, 2018

OK.

I've set rc_parallel=YES in /etc/rc.conf. (And for debugging, set rc_LOGGER="YES") Added this to the depend() function in '/etc/init.d/hildon-desktop: keyword -timeout. Did the same for etc/init.d/xsession. Added af-services as need to /etc/init.d/icd2.

Now parallel boot works on N900 (which it already did on other devices), and I get booted to a functional hildon-desktop. mce has left the boot submode, lock screen just works, power menu works, icd2 works, etc.

I might still want to fix the xsession and dbus mess, but parallel boot is a good enough fix for me for now.

@parazyd - Now, do we add the keyword -timeout to the N900 image only, or do we add it to all devices for now? I will fix icd2 init script now.

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 2, 2018

Same for rc_parallel, I guess we can enable that for all?

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 2, 2018

af-services also needs to depend on dsme.

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 2, 2018

I did a changelog for osso-af-services and icd2. Should rebuild them later/soon.

@parazyd

This comment has been minimized.

Copy link
Member

@parazyd parazyd commented Sep 3, 2018

We can enable -timeout for all devices as it's going to cause no trouble. rc_parallel was reported working fine on other devices, so if the -timeout fixes it for N900, I assume it's also safe to enable it everywhere.

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 3, 2018

OK. I'll add it for those two scripts, then. Just to be clear - I think I'm the only one who tried rc_parallel on various devices. Let's build images soon with parallel on, and then we'll see how it goes. I'll try to add it for those two init scripts tonight.

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 3, 2018

osso-af-services, icd2, hildon-desktop and maemo-system-services are all rebuild. There is still a race that I am trying to debug, but I am not sure why it occurs yet. It doesn't occur often, anyway: http://sprunge.us/fRXrsE - somehow icd2 is started before af-services even though it has a clear 'need af-services'.

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 3, 2018

I did create #173 as well, since doing that should probably fix our issue with requiring parallel boot in the first place...

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 4, 2018

With the latest osso-af-startup, maemo-system-services and mce, this issue should no longer be present, even on non parallel boot, which I still recommend highly over parallel boot

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 4, 2018

@parazyd - there is an issue when building a new image - something with init scripts during configure stage, might be related to my openrc script (when it expects sysvinit/upstart?) Can you check?

@MerlijnWajer

This comment has been minimized.

Copy link
Member Author

@MerlijnWajer MerlijnWajer commented Sep 5, 2018

Works in latest (not yet public) image!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.