Xperia 10 iii: make Google assistant button a camera trigger

You can launch the camera direcrtly from the lock screen by swiping up down.

3 Likes

Is there easy way to get that flashlight code installed? I read the whole thread but I have no idea where to start after installing the patch manager. There is nothing ready related to this in the “web catalog”.

Before the patchmanager part, you’d first need to build (or download from @nephros) and install patched mce binary replacing the original /usr/sbin/mce executable (lacking support for that button) with the one patched by @nephros. Only then the patchmanager part can do anything.

The patched mce is here: Show home:nephros:sailfishos / mce - SailfishOS Open Build Service

Then, for the patchmanager part, you’d need to copy the patch code I posted earlier in this thread to a file called unified_diff.patch and then create another file called patch.json with the following content:

{"description": "Maps Xperia 10 III's Google Assistant button (unused in SFOS) to Flashlight toggle", "name": "Google Button as Flashlight", "display_name": "Google Button as Flashlight", "category": "other", "author": "whoever", "version": "1.0.0", "compatible": ["4.4.0.72"]}

then create a folder called e.g. google_button_flashlight in /usr/share/patchmanager/patches/ and copy both unified_diff.patch and patch.json files there. After that the patch should be visible in Patchmanager…

I can’t submit it to the Patchmanager’s web catalog for easy installation, because without the mce part it wouldn’t work anyway.

1 Like

I’m sorry everyone, but I have taken down the downloadable RPMs.

As mentioned above, this modification is potentially dangerous, and if you want it, you must build the package yourself. I realize that is a nuisance, but I do not want to take responsibility for things that break when people do not heed warnings.

All the things you need are there in the OBS repository (i.e. the patch itself, source tarball and .spec file).

All those years studiously ignoring the winblows button only to witness the coming of the google button. Sigh.

5 Likes

To make up for it a bit, I have proposed a pull request to Jolla.

10 Likes

I added it for my personal use at GitHub - RikudouSage/sailfish-os-patched-mce: Mce patched for SailfishOS to make use of the assistant hardware key but everyone feel free to use it. It’s automatically built using GitHub Actions and downloadable in the Artifacts section of every build (example: Remove arm version · RikudouSage/sailfish-os-patched-mce@b806b59 · GitHub).

As nephros said, don’t just download system stuff without knowing what you’re doing, at the very least check that the build script (sailfish-os-patched-mce/build.yaml at master · RikudouSage/sailfish-os-patched-mce · GitHub) doesn’t do anything shady.

Edit: Added a patchmanager patch that enables using the button as a flashlight toggle.

2 Likes

can this but just be configurable?
One would set it for camera, other one for flashligt, another for that guest account.

1 Like

It is, unless you enable the patch in patchmanager it works simply as home button.

That would be a nice app or settings menu entry

3 Likes

The patched mce has been updated for latest SFOS version (4.5.0.16). Download for example here.

2 Likes

What I haven’t seen here is an option to immediately start the camera while the phone is on. Or is there a way to?
Also, imho the swipe from lockscreen is too slow for when you really need to get a quick shot.

2 Likes

Can it produce a stripped version? The current non-stripped version boosts the binary by +300 kB or so.

Not sure it’s worth the time to lower the size by 300 kB, but if you know how to feel free to create a pull request.

The problem is that for now I actually don’t know how to :wink: as I am totally not familiar with all these online tools. Anyway, the non-stripped binary seems to work perfectly fine, so maybe indeed it’s not worth the hassle…

As mentioned above, there is a PR, and some discussion has happened, and the groundwork of a solution has been laid.

That solution does not need/use MCE, and it can be done on a running device by editing and replacing three files.

After that you have a Camera button, like proposed in the original post.

2 Likes

UPDATE 2: Added process_name in cfg to handle a pid check to avoid duplicate processes from running. Requires correct cmdline; cfg updated below.

UPDATE: Fixed issue where command will launch immediately after closing if the button was pressed. requires full cmdline.

Here’s a ‘test’ solution that doesn’t require having a holder and could be run as an independent service: GitHub - Logic-gate/Keymapper at testing. You will need to build libconfig yourself.

Demo: One Time File

Assist button config; keymap.conf
command; keymapper -s /dev/input/event3

// Not recommended to run keymapper as root,
// Provide full correct-cmdline e.g /usr/bin/invoker -s -n -d 5 --type=silica-media,silica-qt5 -A -- /usr/bin/jolla-camera
// Otherwise the process will never die

name = "TEST CONFING";
keymap = {
        assist_button = {
                proc = "Camera Starting...";
                trigger = 457;
                process_name = "/usr/bin/jolla-camera"
                cmd = "/usr/bin/invoker -s -n -d 5 --type=silica-media,silica-qt5 -A -- /usr/bin/jolla-camera";
        };
};
2 Likes

Here’s an arch64 build of libconfig: 295.8 KB folder on MEGA I am just waiting for @pamoedo to respond before pushing it openrepos.

2 Likes

Here’s the official package: Keymapper | OpenRepos.net — Community Repository System.
Libconfig has also been added to openrepos here: libconfig – C/C++ Configuration File Library | OpenRepos.net — Community Repository System

3 Likes

It works
By the way, how to start flashlight with the button?