Xperia 10 iii: make Google assistant button a camera trigger

Just an idea (since the Xperia 10 ii is told to be the next supported device):
the Xperia 10 iii has an otherwise useless Google assistent button. It would be great making it a camera trigger button with SFOS

The camera trigger button is great for one hand shooting (I loved it on the Xperia X and XA2) and a feature I am missing with the Xperia 10 / 10 ii.

17 Likes

I thought it WAS camera button, doh…

5 Likes

FYI ~ pics can be taken using either of the volume buttons, certainly on my Xperia 10 ii.

1 Like

all these buttons don’t have “focus” position as on original X :frowning:

1 Like

In that case, think it would be out of place to suggest using the Google Assistant button as a Flashlight toggle instead?

2 Likes

So… is there a way to handle that button programmatically? It almost hurts how it’s been there completely unused while it could be such a nice flashlight toggle or play/pause key…

3 Likes

Please no. We have had such a button on the Xperia X. It made screenshots involuntarily when holding the phone.

I would prefer if it was possible to assign any of the topmenu shortcuts to this.
So you can have it as flashlight, or wifi toggle, or mute/dnd switch.

3 Likes

I’m sure we’re talking about an optional feature, i.e. one that could be enabled or not.

Anyway, evdev_trace -t reports pressing that button as KEY_01c9 (event3). so I’ve tried to make mce use it by this name and assign another button’s function to it, e.g.

printf "[EVDEV]\nKEY_01c9=KEY_VOLUMEDOWN\n" > /etc/mce/99-unused-button.ini
systemctl restart mce

Sadly, to no avail. Will keep trying.

3 Likes

I’ve posted somewhat relevant stuff earlier, regarding that button

1 Like

I tried something similar, getting the key event to some MCE-“known” button through udev hwdb:

/etc/udev/hwdb.d/70-xperia10iii-assistant-button.hwdb

#  - Generic input devices match:
#
# E: MODALIAS=input:b0019v0001p0001e0100-e0,1,k72,1C9,ramlsfw
evdev:input:b0019v0001p0001e0100*
 KEYBOARD_KEY_01c9=controlpanel
# KEYBOARD_KEY_01c9=camera

and then in /etc/mce/99-xperia10iii-assistant-button.ini

[EVDEV_TYPE]

evdev:input:b0019v0001p0001e0100=INPUT;KEYBOARD;MOUSE;DOUBLE_TAP;ACTIVITY


[EVDEV]

# see https://github.com/sailfishos/mce/blob/master/evdev.inc#L607
# and https://github.com/sailfishos/mce/blob/master/evdev.inc#L29
#KEY_01c9=SW_KEYPAD_SLIDE
#KEY_01c9=SW_POWER
#KEY_01c9=SW_RFKILL_ALL
#KEY_01c9=KEY_RFKILL
#KEY_01c9=KEY_MICMUTE
#KEY_CONTROLPANEL=SW_RFKILL_ALL
#KEY_CONTROLPANEL=KEY_RFKILL
KEY_CONTROLPANEL=KEY_MICMUTE

But this also does nothing :slightly_frowning_face:

3 Likes

I guess I’ve tried everything that came to my mind. Can’t make that damn button recognized :woozy_face: KEY_VOLUMEDOWN which is the same device and handled by the same event3 can be reassigned without any problems whereas this KEY_01c9 just doesn’t react.

1 Like

I have a hunch there is some additional glue needed in XKB config to map it to a proper event. Not sure.

Also, if I understand the mce code correctly, only some specific keys are recognized by mce, so mapping just any key can’t work.

Yay! Success!

Patched it to be handled as a “Home” key, which is already handled in MCE and Lipstick:

https://build.merproject.org/package/show/home:nephros:sailfishos/mce

FAT WARNING: this is a crucial system package. Do NOT just download an RPM from a random dude on a forum and install it.
Hence I have disabled publishing RPMs for that package.

But you can take the patch and build it yourself.

But now MCE recognizes a KEY_ASSISTANT, you can use /etc/mce/99-evdevfoo.ini to map it to another.

12 Likes

Cool! Now we need to pressure Jolla to upstream it.

But if they upstream exactly the current changes, Assistant button being Home button is not exactly desireable, and only useful for people who will later remap it.
So Jolla would probably need to create a new function of camera button in a few packages anyways.
But it is cool to see it works!

Wow, great! I’m lazy so I’ve just grabbed your rpm from obs and I’ll give it a try :grinning:

Another hint: The “home” key event is actually handled in /usr/share/lipstick-jolla-home-qt5/compositor.qml around line 1762 (search for “home-key”).

If you are an adventurous QML hacker you can make it do stuff there.
You can also use the dbus code there to do things in applications.

Be wewwy wewwy careful though, making a mistake in that file will make Lipstick not start.

2 Likes

I’ve already mentioned that I am lazy so instead of installing it I actually just replaced /usr/sbin/mce with the one you built, extracted from your rpm.

Works PERFECTLY FINE, thank you @nephros!

Edit: Via /etc/mce/99-something.ini I was only able to remap this key to KEY_POWER. Attempts to remap it to other keys doesn’t seem to work.

I would really love to be able to assign it to KEY_PLAYPAUSE. I guess I will need to do it via /usr/share/lipstick-jolla-home-qt5/compositor.qml… I’ll play with it tomorrow.

P.S. build.sailfishos.org permanently times out. build.merproject.org works but “Sign up is disabled”. So how to sign up?

1 Like

Yeah if I read mce code correctly it has two paths handling key events: evdev and powerkey.

The evdev path ignores any powerkey events. Probably that is why only that mapping works.

But my C comprehension skills are low, I might be wrong.

About OBS, accounts must be requested through mal or lbt on IRC, there is no online sign up.

And yes, b.s.o has been acting up lately, but b.m.o works reliably.

1 Like