Patches by ichthyosaurus

I am well aware of OP’s contributions to the SFOS app ecosystem and community.
And yours.

You are out of place lecturing me (or anyone else) on what is appropriate to reply in a topic here, or what is feasible to expect in modifying SFOS through a patch or otherwise.

7 Likes

What’s OP meaning?

20 chars nedded

I don’t think either of these can be implemented as a patch. Patches are generally just an option for cosmetic changes (although cosmetic changes can be quite complex like the emoji keyboard patch). Both of these would need deeper changes in the system, which would have to be done by Jolla.

(In case you don’t know: you only need an account there if you want to publish patches…)

I recommend you use sailfish-patch and follow the instructions there. That should get you started :).

This shouldn’t be too hard, maybe you want to give it a try yourself. You’d have to add a button to the lockscreen, and use a DBus call to restart the service (this is the service, and here is an example of a DBus call from QML).

1 Like

Thanks, glad you like it :slight_smile: (and to hear that it actually works).

Yeah, I’m using an Xperia X and things are slooow…

That’s what I meant by “This doesn’t make the app more beautiful […]” in the description :wink: . Sadly, there’s nothing that can be done through a patch here. A proper fix would have to be implemented by Jolla, and it’s probably very low on their to-do list.

“OP” means “original poster”, i.e. me. And @nephros is right, these things are beyond the possibilities of a patch…

Yes, it’s possible :wink: . It’s a three-line fix, have fun.

1 Like

The #1 is just about changing the Settings menu in some of its parts therefore I think that Patch Manager is the right tool to deliver them.

Alternatively, I found that qCommand can do the job of setting the power energy saving battery threshold (and create a related icon) but changing the menu would be more stylish. :slight_smile:

The #2 cannot be implemented with a patch by Patch Manager and I already got it as soon as I have tried to do a patch for Patch Manager. Thanks.


About the service that you link to me

service_do restart sailfish-fpd
sleep 3
service_do restart sailfish-fpd

@piggz → The sleep 3 is a waste of time and having to repeat the restart means that restart does not work correctly and it should be fixed.

@ichthyosaurus → It would be nice to have a patch in Patch Manger to remove that 2 lines of code. The diff patch could be downloaded from here while the Patch Manager patch from here:

Obviosly, if the patch improves the performance and does not introduce regressions then it should be integrated with the SailFish Utilities. Unfortunately, in PM2 the fingerprint is missing among the category therefore I choose others

About the FP reader restart

Looking at the running process, I found these about FP reader:

[root@sfos defaultuser]# ps | grep fpd
 2904 root     /usr/lib64/qt5/plugins/devicelock/encsfa-fpd --daemon
 4887 root     /usr/bin/sailfish-fpd --systemd
 4888 root     /usr/libexec/sailfish-fpd/fpslave --log-to=syslog --log-level=4
 4954 root     grep fpd

Restarting the service is quite immediate:

[root@sfos defaultuser]# time systemctl restart sailfish-fpd
real	0m 0.14s

To understand which processes were restarted I did a stop and a check:

[root@sfos defaultuser]# ps | grep fpd
 2904 root     /usr/lib64/qt5/plugins/devicelock/encsfa-fpd --daemon
 5107 root     grep fpd

Probably the restart from Utilities will restart also the QT5 plug-in, I did not verified the code of service_do function but considering the parameters passed to the function, it is about systemctl.

About power saving on Xperia 10 II

My Xperia 10 II is running with energy power saving alway active and at the beginning it shown some troubles about BT and FP reader awakening which forced me to reset that sub-systems.

I should not say this because it will be considered trolling but… :sweat_smile:

After having configured some options about suspending/awakening hardware subsystems in Android while I was running the Android Support, the BT and FP reader never got stuck anymore even with AS stopped. However, the counterside is that my smartphone - when left alone without no any interaction or connections active - started to be busy in suspend/awake the systems continuosly loading the CPU for 25% but with no impact on the battery discharge rate (less than 1%) because the CPU seems busy by System Monitor handling I/O but no power is drained because there is no code/math processing.

In fact, the dmesg -Hw shows a lot of this stuff on the WARN level and above:

[  +0.000236] ------------[ cut here ]------------
[  +0.000202] WARNING: CPU: 7 PID: 6013 at /home/abuild/rpmbuild/BUILD/kernel/sony/msm-4.14/kernel/mm/vmscan.c:1685 isolate_lru_page+0x1e0/0x1e8
[  +0.000365] ---[ end trace b94aa1c373c520dc ]---

[  +0.001869]  cache: parent cpu2 should not be sleeping

[  +0.026021] OOM killer enabled.
[  +0.000003] Restarting tasks ... done.
[  +0.022791] PM: PM: suspend exit 2023-06-18 08:17:15.039700682 UTC
[  +0.000003] PM: suspend exit
[  +0.045724] ## mmc1: mmc_gpio_set_uim2_en: gpio=101 value=1
[  +4.943132] PM: PM: suspend entry 2023-06-18 08:17:20.028365718 UTC
[  +0.000016] PM: suspend entry (deep)
[  +0.000010] PM: Syncing filesystems ... done.
[  +0.015110] Freezing user space processes ... (elapsed 0.040 seconds) done.
[  +0.040466] OOM killer disabled.
[  +0.000002] Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done.
[  +0.003784] Suspending console(s) (use no_console_suspend to debug)
[  +0.029206] Disabling non-boot CPUs ...
[  +0.002401] CPU1: shutdown
[  +0.005101] CPU2: shutdown
[  +0.004633] IRQ 7: no longer affine to CPU3
[  +0.000259] CPU3: shutdown
[  +0.004800] CPU4: shutdown
[  +0.003805] CPU5: shutdown
[  +0.003962] CPU6: shutdown
[  +0.004003] CPU7: shutdown
[  +0.003154] suspend ns:   30885642235516	suspend cycles:    1068241562170
[  -0.000010] resume cycles:    1069294245240
[  +0.000854] Enabling non-boot CPUs ...
[  +0.001628] CPU1 is up

[  +2.401109] somc_panel_color_manager: somc_panel_inject_crtc_overrides (788): Override: Already have original funcs! Is setup called twice??
[  +0.000435] somc_panel_color_manager: somc_panel_pcc_setup (886): Cannot read uv data: missing command

If what written above is correct (because correlation does not necessarly means cause-effect relationship) then SFOS should correctly set the FP reader about suspend/aswakening. About BT, one single event even in conjunction with the FP reader failure make the assumption statistically too weak,

Original hi-res image is here.

About FingerPrint reader service

Considering how fast is the FP reader service in being started

[root@sfos defaultuser]# systemctl stop sailfish-fpd
[root@sfos defaultuser]# time systemctl start sailfish-fpd
real	0m 0.16s

and the few static places in which it is needed 1. unlock the screen and 2. add a new fingerprint, I think that it would a sane policy to start it only when it is necessary and stop immediately after. By default do start it at the boot time.

Unlock the screen:

  • is there a PIN set?
    no: proceed
  • is there a FP set, at least?
    no: wait for the PIN
  • start the FP service
  • does unlock succeed?
    no: wait for unlock or timeout
  • timeout exipired?
    stop the FP service
  • stop the FP service

Add a new fingerprint:

  • start the FP service
  • acquire the fingerprint
  • stop the FP service

Probably implementing the logic about unlocking the screen would be easier that the one described because those check are just done for sure. Therefore there are just three points to change: start, stop and stop. Instead, the logic for adding a fingerprint is straightforward.

Hey @robang74 , I really recommend you check out sailfish-patch! You have many nice ideas and some of them shouldn’t be too hard to implement so it would be a great way for you to get into patching yourself :slight_smile: . I think that would give you the best results :wink: .

I’ll read the rest tomorrow…

2 Likes

I found that tool already. Thanks.

It is a good suggestion and it will teach me more about the internals of the GUI functioning. This can give me an insight about how to optimise it more in deep.

2 Likes

This is a dangerous feature because while you are working with the touch screen an expanded notification can pop-up under your finger.

sfos-patch-homescreen-notifications-always-expanded-screenshot-1

As you can see in this screenshot from the patch the expanded notification can offer buttons on which you may click inadvertently.

Does Patch Manager patch allow to run shell code?

  • pre-install, post-install
  • pre-remove, post-remove

I saw that it allows to run shell code for test the patch outcome.

In such a case, it would be wonderful to have $EXTRAPATH set to the current extra folder, if it exists in the current PM2 patch

1 Like

Please discuss Patchmanager questions and capabilities in a separate topic.

As you said, this one is about patches by ichthyosaurus not the Patchmanager application.

1 Like

Hi @ichthyosaurus you recommended sailfish-patch to robang74.
I’m just a simple user with no coding skills and would like to have three-fingers-volume-contol patch working again.
So i thought, maybe it’s possible to update the patch with sailfish-patch. Unfortunately, I’m somewhat lost. Maybe you can guide me a little bit.

What have I done so far:
I’ve downloaded the original package, which isn’t working anymore from openrepos.net.
The package consists of two file: a patch.json which seems to be the description file and the unified_diff.patch which is the real patch and which is making the changes to the files.

unified_diff.patch looks like that:

— original/usr/share/lipstick-jolla-home-qt5/volumecontrol/VolumeControl.qml 2015-10-12 02:57:01.762197000 +0300
+++ patched/usr/share/lipstick-jolla-home-qt5/volumecontrol/VolumeControl.qml 2015-10-12 03:01:32.415210665 +0300
@@ -238,7 +238,7 @@
extend: “showBar”
PropertyChanges {
target: volumeBar

  •            showContinuousVolume: Screen.sizeCategory >= Screen.Large
    
  •            showContinuousVolume: Screen.sizeCategory >= Screen.Small
           }
       }
    
    ]
    — original/usr/share/lipstick-jolla-home-qt5/compositor.qml 2015-10-12 02:54:39.780190000 +0300
    +++ patched/usr/share/lipstick-jolla-home-qt5/compositor.qml 2015-10-12 03:00:08.967206545 +0300
    @@ -191,7 +191,7 @@
    MultiPointTouchDrag {
    id: globalVolumeGestureItem
  •    enabled: !systemGesturesDisabled && SS.Screen.sizeCategory >= SS.Screen.Large
    
  •    enabled: !systemGesturesDisabled && SS.Screen.sizeCategory >= SS.Screen.Small
       orientation: Lipstick.compositor.topmostWindowOrientation
       fingers: 3
       direction: MultiPointTouchDrag.Vertical
    

I’ve looked for the system files, they are still there and in

/usr/share/lipstick-jolla-home-qt5/volumecontrol/VolumeControl.qm

l there has just the line numbers changed.
In

/usr/share/lipstick-jolla-home-qt5/compositor.qml

the original patched line doesn’t exist anymore. But there is a similar line:

readonly property bool largeScreen: SS.Screen.sizeCategory >= SS.Screen.Large

So I would try to patch this line to

readonly property bool largeScreen: SS.Screen.sizeCategory >= SS.Screen.Small

so the hopefully working patchfile would look like that:

— original/usr/share/lipstick-jolla-home-qt5/volumecontrol/VolumeControl.qml
+++ patched/usr/share/lipstick-jolla-home-qt5/volumecontrol/VolumeControl.qml
@@ -291,7 +291,7 @@
extend: “showBar”
PropertyChanges {
target: volumeBar

  •            showContinuousVolume: Screen.sizeCategory >= Screen.Large
    
  •            showContinuousVolume: Screen.sizeCategory >= Screen.Small
           }
       }
    
    ]
    — original/usr/share/lipstick-jolla-home-qt5/compositor.qml
    +++ patched/usr/share/lipstick-jolla-home-qt5/compositor.qml
    @@ -247,7 +247,7 @@
    MultiPointTouchDrag {
    id: globalVolumeGestureItem
  •    readonly property bool largeScreen: SS.Screen.sizeCategory >= SS.Screen.Large
    
  •    readonly property bool largeScreen: SS.Screen.sizeCategory >= SS.Screen.Small
       orientation: Lipstick.compositor.topmostWindowOrientation
       fingers: 3
       direction: MultiPointTouchDrag.Vertical
    

I installed sailfish-patch and after installation I created an empty folder named three-finger-volume. I generated a clean CONFIG file via

sailfish-patch -eC > CONFIG

So far so good. But now I don’t really understand what I have to do further on.
Is it correct, that I have to copy the changed unified_diff.patch and the CONFIG file in the newly created folder and afterwards I have to run:

sailfish-patch -i CONFIG my_patch_file.diff

What exactly do I have to write in the CONFIG file. What are the source packages? (Maintainer, description and names shouldn’t be that hard, but with the SourcePackages I have no clue and how do I know, if there are conflicts with other patches.

And last but not least:
How can I test, if the patch is working, before I create a new repo with the command above?

Sorry for asking stupid questions :grimacing:

2 Likes

Neither I about A-GPS but probably, I have managed to:

I need many testers… :blush:

UPDATE

Give a try to this patch x10ii-iii-agps-config-emea available into the Patch Manager Web Catalog . The v0.0.3 uses the Google SUPL host because the Google Certicates of Authority are available in /system/etc/security/cacerts_google imported by the ASOP . Those certifactes among others can be updated with the command line devel-su update-ca-trust by root . While in the v0.0.2 has been added the XTRA v3 support for GPS, GLONASS, BeiDou and Galileo constellations.

2 Likes

Yes, especially if the notification is long. I personally don’t use this patch but everyone has their use case…

No, but you can run Python code through pyotherside.

Nice, kudos on your first and second patch! I recommend you upload the CONFIG as well somewhere, so that others can pick it up if they want to change anything, or if they want to update the patch to a new SFOS version in the future.

You can open a pull request on Github to get this fixed. They just merged a fix I proposed today, yay :). Actually, I suppose the delay has some (obscure) reason and you should thoroughly test it if there really is no regression…

That would merit its own separate thread, and it’s a bit off-topic here.

1 Like

Nice, kudos to you too! Welcome to the world of patching ;).

Is it this one?

Exactly! Actually, you can skip the new directory because the --import option sets that up for you. I assume you followed the docs - do you have an idea how to make this more clear? You just have to follow the second section (“If no CONFIG file is available, follow these steps:”)…

In the SourcePackages field you define all packages that should be patched. You can find them by using the new --inspect-diff command I just implemented (you’ll have to download the script again). You can also manually run this on your phone: rpm -qf /path/to/file (with /path/to/file being the path of the patched file, e.g. /usr/share/lipstick-jolla-home-qt5/compositor.qml.

This will give you a package name, which you then write into the config file:

...
SourcePackages:
- lipstick-jolla-home-qt5 >= 1.25.13.6
...

The other fields should be self-explanatory, except maybe for Requires: which you normally don’t have to change at all.

For your patch, I recommend you add this as well:

...
# Restart lipstick (the homescreen) when deploying the patch by running sailfish-patch -p
TestCommands:
- systemctl --user restart lipstick
...

You don’t have to, let Patchmanager handle that. In general, there’s way to many patches to manually check for compatibility, and such small changes shouldn’t create conflicts. If they do, people will tell you :).

You don’t. Just create a new repo for the patch by running the --import command (as documented), and then fix the patch. It will at first fail to apply in the new repo, but sailfish-patch will generate a helper script that you can use to fix the patch. (You don’t even need that in your case because your patch is very short.) Just make sure to edit the files in the patched folder.

Then build the patch and deploy it to your phone: sailfish-patch -b -p

Not stupid at all :). Actually, I would be especially happy if you have ideas on how to improve the documentation so that others may need less questions.

2 Likes

Thanx for this detailed answer.
Yes this is the one
So I will have a look, if I have success later on.
I will as well reread your docs and give - if possible - hints what can be improved.

1 Like

I fear this is a rocky road to go with my skills. Anyway, if you are still holding my hand, I maybe get there where I want. As a reward, I will write you a guide with the title “updating a patch for complete noobs”, which you can use for your github docs.

Ok, what have I done:
I changed the CONFIG file in the way I think it has to be. Than I used

sailfish-patch -i CONFIG unified_diff.patch

which returned some errors and told me to try it again. I fixed the errors in the CONFIG and run it again.

Output is:

sailfish-patch -i CONFIG unified_diff.patch
warning: license text not found at COPYING
you can download it using the ‘-eL’ option
error: unrecognized source file
Any patch file, or a patch named ‘unified_diff.patch’ in the
root of a tar archive are supported.
You can safely remove ‘sfos-patch-three-finger-volume’ for cleanup.

And a folder (sfos-patch-three-finger-volume) with a new CONFIG file was created. Nothing else, just the CONFIG file.

I guessed for the license text warning and run

sailfish-patch eL unified_diff.patch

in the folder above the newly created one. Where the unified_diff.patch file lies. The command completed without any output.

Unfortunately I have no clue what

error: unrecognized source file

mean (do I have to be connected to the phone?) and what does

You can safely remove ‘sfos-patch-three-finger-volume’ for cleanup.

mean? Shall I delete the newly created folder? But then the new CONFIG file is gone as well.

Further on, for me it is not clear, when I have to make things on my Workstation and when do I have to ssh to my phone. And if I have to ssh to my phone, what is the syntax I have to use together with your commands. I usually use ssh to use Terminal more comfortably. So I usually use putty, but of course I now that i can connect via ssh -p 22 defaultuser@IP in Terminal as well, but if I just connect via ssh sailfish-patch can’t be found, because it is not on my phone. But if I read the docs correctly, for the build and deploy command I have to ssh to my phone.

And, In the docs on github you wrote:

  • Run sailfish-patch -i CONFIG my_patch_file.diff to create a new repo and bootstrap it.

What does that mean? I don’t know what bootstrapping is and I would read this line as with that command you have created a repo and it is bootstrapped. But further above is written that the bootstrap option is

sailfish-patch -u

Questions over questions, I warned you about stupid questions :grimacing:

I would have attached my CONFIG file in Blockquote, but it gets misinterpreted.

1 Like

I released the v0.0.7 and it could be the “good one” because I have tested intensively and in the worst conditions. Moreover, it is indipendent from Google services but relies on Qualcomm SUPL hosts network. Among other features, implement a throttling for XTRA in such a way the SFOS does not lag and apps do not freeze.

PERFORMANCES

After a reboot, the fix indoor with 4G IPv4-only mobile data transit on a free UDP VPN with energy save mode enabled and WiFi tethering active, it takes less than 15s for 9000m h-accuracy and near 1m for fixing the point under 100m of h-accuracy, 2m for 15m with 6/41 use/view satellites. Without the WiFi tethering active or any Wifi connections, it takes near 30s for 30m h-accuracy.

1 Like

As long as you’re not in a hurry - I’m generally quite slow with replying :see_no_evil:

That would be awesome! It’s really good to get all these questions because it will make patching more approachable and easy for beginners.

Well, that is weird. I just tested it myself and it works for me. Did you change the unified_diff.patch file? The error message means that the script could not determine whether the file actually is a patch. Can you run file --mime-type -b unified_diff.patch and check if the output is text/x-diff?

That’s because it did not recognize the patch file and aborted the process, i.e. it did not import anything yet. The CONFIG file is just an unchanged copy of the config file you prepared. The message means that you can (should) delete the newly created folder so that you can try again. (The script doesn’t delete it automatically because it might be interesting for finding what went wrong - not in our case though.)

The license is not required at this step, and the -eL option download the license text from spdx.org. It should actually print something like saved license GPL-3.0-or-later to COPYING

The only thing you may have to run on the phone is rpm -qf /path/... to find the package that a file belongs to. The new -Id option does that for you though, so normally you don’t have to run anything via SSH yourself.

Also, you shouldn’t put sailfish-patch on the phone because it needs Bash and wouldn’t work with Sailfish’s Busybox.

The script needs SSH access to your phone, though, and I just realised that it isn’t documented in the readme how to configure this. You have to set these environment variables (they have very brief descriptions in the manpage and when running sailfish-patch --help):

  • SF_PATCH_SSH_TARGET: set this to the IP you use to connect
  • SF_PATCH_REMOTE_USERNAME: set this to defaultuser, the current default value is still nemo
  • SF_PATCH_PASSFILE: this is quite important: on your phone, go to Settings → Developers → Password and set a secure password. Then save this password in a plain text file somewhere on your computer, and define the path to this file in SF_PATCH_PASSFILE.

(The script needs root (devel-su) access to your phone because it has to run pkcon and rpm when downloading packages from the Jolla store, and when installing the patch for you.)

With “bootstrapping” I mean “take a config file, download the source packages listed there, create a new git repository containing all files, then last but not least apply the patch to the files in the patched folder”. In other words: “set everything up for you so you can get started”.

The -u or --update option does that for patches that were created with sailfish-patch, i.e. that already have a config file. The -i or --import option uses -u internally but adds a few more steps.

You can share it here: https://paste.systemli.org

I hope this wall of text doesn’t confuse you further ;).

2 Likes

I’m an old lad and so my impatient times are gone for quite a time :upside_down_face:

I just changed the text inside the file, to what I posted in the above. I will check tomorrow if kate (my editor of choice) has done anything to the file format:

I guessed so, just wanted to be sure.

Thanx for explantion.

Ok, this was the point where I was absolutely lost, even so I use ssh quite often. I’m happy that you just forgot some parts in the the docs otherwise I would have felt like an idiot. :blush:

Thanx for explaining

I will share the CONFIG tomorrow if I still have no success.
Everything of your text is helping me, so not more confusion but less. :+1:
Thanx for your patience.

1 Like