UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Need help with QML and systemd service creation

    Scheduled Pinned Locked Moved App Development
    6 Posts 2 Posters 830 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      ds2k5
      last edited by ds2k5

      Hi,
      I try to convert a Project from UB 16.04 to 20.04
      but have the issue that a switch "Stop charging after limit reached" is not working.

      Could somebody help me ?
      I did not understand why.
      I belive that the Service may be not installed.

      gitlab --> ubtouch2 / fork-indicator-upower

      Sorry did not have the right to post a link

      lduboeufL 1 Reply Last reply Reply Quote 1
      • lduboeufL Offline
        lduboeuf @ds2k5
        last edited by

        @ds2k5 said in Need help with QML and systemd service creation:

        Hi,
        I try to convert a Project from UB 16.04 to 20.04
        but have the issue that a switch "Stop charging after limit reached" is not working.

        Could somebody help me ?
        I did not understand why.
        I belive that the Service may be not installed.

        gitlab --> ubtouch2 / fork-indicator-upower

        Sorry did not have the right to post a link

        indeed, we use now systemd, you can find an example here in
        https://gitlab.com/lduboeuf/battery-saver

        i can't show you exactly since i'm on UT with Morph bot supporting gitlab anymore but you should find a .service somewhere and the service installation is done with a python script

        D 2 Replies Last reply Reply Quote 0
        • D Offline
          ds2k5 @lduboeuf
          last edited by

          @lduboeuf

          thank you !

          1 Reply Last reply Reply Quote 0
          • D Offline
            ds2k5 @lduboeuf
            last edited by ds2k5

            @lduboeuf

            Hi,
            how to find the systemd script for your APP ?

            did install the APP but did not find a systemd script

            phablet@ubuntu-phablet:~$ systemctl | grep -i batt
            phablet@ubuntu-phablet:~$
            
            phablet@ubuntu-phablet:~$ ls -la /opt/click.ubuntu.com/batterysaver.lduboeuf
            total 12
            drwxr-xr-x  3 clickpkg clickpkg 4096 Oct 28 07:00 .
            drwxr-xr-x 41 clickpkg clickpkg 4096 Oct 28 07:00 ..
            drwxr-xr-x  7 clickpkg clickpkg 4096 Oct 28 07:00 1.8.0
            lrwxrwxrwx  1 clickpkg clickpkg    5 Oct 28 07:00 current -> 1.8.0
            
            $ ls -la /home/phablet/.local/share/batterysaver.lduboeuf/batterysaver
            ls: cannot access '/home/phablet/.local/share/batterysaver.lduboeuf/batterysaver': No such file or directory
            
            $ ls -la /home/phablet/.local/share/batterysaver.lduboeuf/
            ls: cannot access '/home/phablet/.local/share/batterysaver.lduboeuf/': No such file or directory
            

            screenshot20241028_070611318.png

            screenshot20241028_070607269.png

            screenshot20241028_070842460.png

            Did deinstall the APP an reInstall but the binary is not there

            $ ls -la /home/phablet/.local/share/batterysaver.lduboeuf/batterysaver
            ls: cannot access '/home/phablet/.local/share/batterysaver.lduboeuf/batterysaver': No such file or directory

            lduboeufL 1 Reply Last reply Reply Quote 0
            • lduboeufL Offline
              lduboeuf @ds2k5
              last edited by

              @ds2k5 Now that i am on PC, it should be better

              So to check the current status of the background user service:
              systemctl status --user batterysaver
              we can see that/home/phablet/.config/systemd/user/batterysaver.service is used.

              So user service has to be copied to /home/phablet/.config/systemd/user/ and started accordingly, this is what is done with that python script:
              https://gitlab.com/lduboeuf/battery-saver/-/blob/main/src/main.py?ref_type=heads#L16

              D 1 Reply Last reply Reply Quote 1
              • D Offline
                ds2k5 @lduboeuf
                last edited by

                @lduboeuf

                thanks for explain

                $ /home/phablet/.config/systemd/user/batterysaver.service 
                -bash: /home/phablet/.config/systemd/user/batterysaver.service: Permission denied
                
                ~$ systemctl status --user batterysaver
                ā— batterysaver.service - Battery saver
                     Loaded: loaded (/home/phablet/.config/systemd/user/batterysaver.service; enabled; vendor preset: enabled)
                     Active: active (running) since Mon 2024-10-28 10:18:03 CET; 16min ago
                   Main PID: 9322 (batterysaver)
                     CGroup: /user.slice/user-32011.slice/user@32011.service/batterysaver.service
                             └─9322 /home/phablet/.local/share/batterysaver.lduboeuf/batterysaver /ril_1 gsm lte false true true
                
                Oct 28 10:21:56 ubuntu-phablet batterysaver[9322]: lockStateChanged(): screenIsLocked false
                Oct 28 10:21:56 ubuntu-phablet batterysaver[9322]: lockStateChanged(): switching to pref tech
                Oct 28 10:21:56 ubuntu-phablet batterysaver[9322]: lockStateChanged(): NOW SWITCHING TO "lte"
                Oct 28 10:22:58 ubuntu-phablet batterysaver[9322]: lockStateChanged(): screenIsLocked true
                Oct 28 10:22:58 ubuntu-phablet batterysaver[9322]: lockStateChanged(): NOW SWITCHING TO "gsm"
                Oct 28 10:24:41 ubuntu-phablet batterysaver[9322]: lockStateChanged(): screenIsLocked false
                Oct 28 10:24:41 ubuntu-phablet batterysaver[9322]: lockStateChanged(): switching to pref tech
                Oct 28 10:24:41 ubuntu-phablet batterysaver[9322]: lockStateChanged(): NOW SWITCHING TO "lte"
                Oct 28 10:25:58 ubuntu-phablet batterysaver[9322]: lockStateChanged(): screenIsLocked true
                Oct 28 10:25:58 ubuntu-phablet batterysaver[9322]: lockStateChanged(): NOW SWITCHING TO "gsm"
                
                1 Reply Last reply Reply Quote 0
                • CiberSheepC CiberSheep moved this topic from General on

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better šŸ’—

                Register Login
                • First post
                  Last post