• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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 249 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 27 Oct 2024, 06:48

      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

      L 1 Reply Last reply 27 Oct 2024, 13:19 Reply Quote 1
      • L Offline
        lduboeuf @ds2k5
        last edited by 27 Oct 2024, 13:19

        @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 27 Oct 2024, 19:58 Reply Quote 0
        • D Offline
          ds2k5 @lduboeuf
          last edited by 27 Oct 2024, 19:58

          @lduboeuf

          thank you !

          1 Reply Last reply Reply Quote 0
          • D Offline
            ds2k5 @lduboeuf
            last edited by ds2k5 28 Oct 2024, 05:58

            @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

            L 1 Reply Last reply 28 Oct 2024, 08:40 Reply Quote 0
            • L Offline
              lduboeuf @ds2k5
              last edited by 28 Oct 2024, 08:40

              @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 28 Oct 2024, 09:34 Reply Quote 1
              • D Offline
                ds2k5 @lduboeuf
                last edited by 28 Oct 2024, 09:34

                @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
                • C CiberSheep moved this topic from General on 30 Oct 2024, 14:49
                5 out of 6
                • First post
                  5/6
                  Last post