forked from gartnera/headunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SetRequiredSurfaces dbus message sniffing
This commit adds sniffing of NativeGUIClient::SetRequiredSurfaces dbus method calls. It allows to react to losing video/input focus when CMU changes the front surface (call, SMS/text message and so on).
- Loading branch information
Showing
3 changed files
with
69 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e05db16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey tested this, headunit runs up until you connect the phone then it crashes. Was late to work so didn't pick up the dumps but the headunit.log file ends like this:
so not much there, I don't know if you can get anything from that.
I am going to try tweaking it a little bit and see if I can get it working
e05db16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, As I said I haven't tested it. I'm not a C++ guru also, so probably there is some stupid mistake in my code. In another commit I removed unnecessary BTHFClient stuff and added some more logging to narrow down the problem.
e05db16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really promising @mishaaq it seems like the DBus::Callback API does just what we need. I've never used the API before but I don't see any obvious C++ fail in the code. I'm going to try and debug more too as soon as I get a chance. Debugging on the car sucks though :(
e05db16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried hacking around a bunch here: lmagder@4ab38ce
I was able to log out the callbacks without it crashing and with no matcher specified. However I was only getting the "NameAcquired" signal and nothing else, which makes me think we are not registering the filter on the right connection or that it only sees messages traveling through the connection, like we can't filter stuff between two other processes.
e05db16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmagder regarding your "hacking" commit: I'm sure you need to call add_match before setting up filtering, because the D-BUS specification states that only messages with DESTINATION attribute explicitly set to your D-BUS service path will be delivered to your service without matching. Another thing: "SetRequiredSurfaces" is a D-BUS method, so you don't need to check for a signal with that name. When it comes to the lack of messages probably we need to conform to this thing: https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-eavesdropping.
e05db16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mishaaq Thanks! I had it wrong. I assumed removing the match would show all the messages and I could filter in the callback for better debugging. Same reason why I was logging the signals. I need to try again then.
e05db16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmagder Probably matching against empty rule (
add_match("")
) should do the work. Alternatively need to add this "eavesdropping" thing.