UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. c4pp4
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 125
    • Groups 0

    c4pp4

    @c4pp4

    51
    Reputation
    34
    Profile views
    125
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online
    Location Prague, Czechia

    c4pp4 Unfollow Follow

    Best posts made by c4pp4

    • [HowTo] Alternate way of saving battery when using 4G/LTE

      What it does:

      1. Script I: Switch to 2G when screen is locked and switch back to 4G when screen is unlocked. TELEports or Dekko notifications work well.
      2. Alternative script II: Switch to 2G when screen is off and switch back to 4G when screen is on (regardless of screen lock). TELEports or Dekko notifications work well.
      3. Alternative script III: Turn off cellular data when screen is off and turn on cellular data again when screen is on (regardless of screen lock). No TELEports or Dekko notifications when screen is off.

      Precondition: Working 4G connection which drains battery when device is inactive (screen is locked or off).
      Originally made for Xiaomi Mi A2 and tested on it but can be useful for any device.


      Create a script "/home/phablet/lte-battery-saver"
      Script I:

      #!/bin/bash
      
      primary_preference="lte"
      saving_preference="gsm"
      sim_slot="/ril_0"
      
      interface=org.freedesktop.DBus.Properties
      member=PropertiesChanged
      
      dbus-monitor --session "type=signal,interface='${interface}',member='${member}'" |
      while read -r line; do
              if [[ ${line} == *"com.canonical.UnityGreeter"* ]]; then
                      read; read; read -r line
                      if [[ ${line} == *"IsActive"* ]]; then
                              read -r line
                              [[ ${line} == *"true"* ]] && /usr/share/ofono/scripts/set-tech-preference "${sim_slot}" "${saving_preference}" 1>/dev/null
                              [[ ${line} == *"false"* ]] && /usr/share/ofono/scripts/set-tech-preference "${sim_slot}" "${primary_preference}" 1>/dev/null
                      fi
              fi
      done
      

      Make script executable

      chmod u+x /home/phablet/lte-battery-saver
      

      Create an upstart session job "/home/phablet/.config/upstart/lte-battery-saver.conf"

      description "LTE battery saver"
      
      start on started dbus
      stop on stopped dbus
      
      exec /home/phablet/lte-battery-saver
      

      Start the job

      start lte-battery-saver
      

      or reboot the phone.


      NOTES (Script I and Alternative script II):

      • Change "/ril_0" to "/ril_1" if your data SIM is in slot 2 (see sim_slot variable)
      • If switching back doesn't work, try to set primary_preference variable to "any"
      • To switch between 3G and 2G replace "lte" with "umts" (see primary_preference variable)
      • To switch between 4G and 3G replace "gsm" with "umts" (see saving_preference variable)

      To apply the changes, restart the job

      restart lte-battery-saver
      

      or reboot the phone.


      To remove all changes

      stop lte-battery-saver
      rm /home/phablet/.config/upstart/lte-battery-saver.conf
      rm /home/phablet/lte-battery-saver
      

      Alternative script II:

      #!/bin/bash
      
      primary_preference="lte"
      saving_preference="gsm"
      sim_slot="/ril_0"
      
      interface=com.canonical.Unity.Screen
      member=DisplayPowerStateChange
      
      dbus-monitor --system "type=signal,interface='${interface}',member='${member}'" |
      while read -r line; do
      	if [[ ${line} == *"int32 0" ]]; then
      		read
      		/usr/share/ofono/scripts/set-tech-preference "${sim_slot}" "${saving_preference}" 1>/dev/null
      	elif [[ ${line} == *"int32 1" ]]; then
      		read
      		/usr/share/ofono/scripts/set-tech-preference "${sim_slot}" "${primary_preference}" 1>/dev/null
      	fi
      done
      

      Alternative script III:

      #!/bin/bash
      
      interface=com.canonical.Unity.Screen
      member=DisplayPowerStateChange
      
      dbus-monitor --system "type=signal,interface='${interface}',member='${member}'" |
      while read -r line; do
      	if [[ ${line} == *"int32 0" ]]; then
      		read
      		dbus-send --type=method_call --dest=com.ubuntu.connectivity1 /com/ubuntu/connectivity1/Private org.freedesktop.DBus.Properties.Set string:com.ubuntu.connectivity1.Private string:MobileDataEnabled variant:boolean:false
      	elif [[ ${line} == *"int32 1" ]]; then
      		read
      		dbus-send --type=method_call --dest=com.ubuntu.connectivity1 /com/ubuntu/connectivity1/Private org.freedesktop.DBus.Properties.Set string:com.ubuntu.connectivity1.Private string:MobileDataEnabled variant:boolean:true
      	fi
      done
      
      posted in Support
      c4pp4C
      c4pp4
    • [HowTo] Using Anbox manually to reduce battery drain

      I. Disable Anbox via anbox-tool:

      anbox-tool disable
      

      or make it disabled manually:

      rm /home/phablet/anbox-data/.enable
      stop anbox-session
      sudo stop anbox-container
      

      or alternatively configure Upstart to ignore the start on / stop on stanzas:

      sudo mount -o remount,rw /
      echo "manual" | sudo tee /etc/init/anbox-container.override
      echo "manual" | sudo tee /usr/share/upstart/sessions/anbox-session.override
      sudo sync
      sudo mount -o remount,ro /
      stop anbox-session
      sudo stop anbox-container
      

      II. Remove Anbox icons:

      rm /home/phablet/.local/share/applications/anbox-*
      

      III. Create start script:

      #!/bin/bash
      sudo start anbox-container
      start anbox-session
      

      and stop script:

      #!/bin/bash
      stop anbox-session
      sudo stop anbox-container
      rm /home/phablet/.local/share/applications/anbox-*
      

      IV. Start or stop Anbox:

      bash <nameofscript>
      
      posted in Support
      c4pp4C
      c4pp4
    • RE: One method to encrypt /home/phablet

      @ernest said in One method to encrypt /home/phablet:

      Seems that lightdm doesn't restart with the latest OTA. Any tips ?

      Hi, I'm using the following script (tested on OTA-15 and OTA-16 devel):

      #!/bin/bash
      if ! dpkg-query -l cryptsetup | grep ^ii 1>/dev/null; then
      	mount -o remount,rw /
      	apt-get update && \
      	apt-get -y install cryptsetup
      	sync
      	mount -o remount,ro /
      fi
      
      cryptsetup luksOpen /home/phablet.img phablet
      e2fsck /dev/mapper/phablet
      mount /dev/mapper/phablet /home/phablet && \
      nohup /etc/init.d/lightdm force-reload </dev/null >/dev/null 2>&1 &
      

      run as root: sudo bash <nameofscript>

      posted in Support
      c4pp4C
      c4pp4
    • RE: Sony Xperia X (suzu/F5121 & F5122)

      @japsi said in Sony Xperia X (suzu/F5121 & F5122):

      As I see that Anbox should work in X is there any instructions how to install it? It's not on "supported devices" list yet.

      Just follow http://docs.ubports.com/en/latest/userguide/dailyuse/anbox.html and skip "flash a specific boot image" step.

      In my case (F5122) it works. I used UT Terminal app:

      sudo mount -o rw,remount /
      sudo apt update
      sudo apt install anbox-ubuntu-touch
      anbox-tool install
      sudo apt install android-tools-adb
      sudo mount -o ro,remount /
      cd /home/phablet/Downloads
      wget https://f-droid.org/FDroid.apk
      adb install FDroid.apk
      

      and reboot... (not sure if it's needed)

      There is no sound by default, see https://github.com/anbox/anbox/issues/904. You need to override system/etc/media_codecs.xml file. I was trying to figure it out via rootfs-overlay (https://docs.anbox.io/userguide/advanced/rootfs_overlay.html) with no luck. I repacked android.img with fixed media_codecs.xml file and now there is a sound and even choppy video via NewPipe app. I used this fixed media_codecs.xml file: http://dpaste.com/2H2CP58, it's all in one from these files: https://github.com/anbox/anbox/tree/master/android/media because "Include" and "Included" tags don't work yet.

      Is there a way to apply anbox rootfs-overlay?

      posted in Sony Xperia X (F5121 & F5122)
      c4pp4C
      c4pp4
    • RE: Icon Library

      I have given a try (OSM Scout Server icon):

      osmscout-server.svg
      https://dpaste.com/DG5BG4GEX

      scout.png

      posted in Design
      c4pp4C
      c4pp4
    • RE: App menu double entries w/Anbox

      Try to refresh the Drawer by pulling down and releasing.

      posted in Support
      c4pp4C
      c4pp4
    • RE: Sony Xperia X (suzu/F5121 & F5122)

      @henri2h You can't modify the file directly, it's Squashfs filesystem (see https://en.wikipedia.org/wiki/SquashFS). The best way to override it is via rootfs-overlay as I wrote.

      To repack the image, you need some linux distro. Download the right android filesystem image from https://cdimage.ubports.com/anbox-images/. According to https://cdimage.ubports.com/anbox-images/devices.json it's android-armhf-64binder.img. You also need to have installed squashfs-tools package.

      Uncompress the filesystem as root to keep uid and gid identities:

      sudo unsquashfs android-armhf-64binder.img
      

      you will see something like this:

      Parallel unsquashfs: Using 4 processors
      1429 inodes (5270 blocks) to write
      
      [=================================-] 5270/5270 100%
      
      created 1239 files
      created 274 directories
      created 190 symlinks
      created 0 devices
      created 0 fifos
      

      it creates squashfs-root folder, locate squashfs-root/system/etc/media_codecs.xml file, rewrite it (as root) by the fixed one (http://dpaste.com/2H2CP58) and set the right owner:

      sudo chown 100000:100000 media_codecs.xml
      

      compress the filesystem into android.img:

      sudo mksquashfs squashfs-root/ android.img -noappend -no-xattrs -comp xz
      

      you will see something like this:

      Parallel mksquashfs: Using 4 processors
      Creating 4.0 filesystem on android.img, block size 131072.
      [=================================\] 5080/5080 100%
      
      Exportable Squashfs 4.0 filesystem, xz compressed, data block size 131072
      	compressed data, compressed metadata, compressed fragments,
      	no xattrs, compressed ids
      	duplicates are removed
      Filesystem size 212128.35 Kbytes (207.16 Mbytes)
      	39.95% of uncompressed filesystem size (531034.87 Kbytes)
      Inode table size 23934 bytes (23.37 Kbytes)
      	33.61% of uncompressed inode table size (71204 bytes)
      Directory table size 16322 bytes (15.94 Kbytes)
      	43.33% of uncompressed directory table size (37666 bytes)
      Number of duplicate files found 38
      Number of inodes 1703
      Number of files 1239
      Number of fragments 229
      Number of symbolic links  190
      Number of device nodes 0
      Number of fifo nodes 0
      Number of socket nodes 0
      Number of directories 274
      Number of ids (unique uids + gids) 4
      Number of uids 2
      	unknown (100000)
      	unknown (101000)
      Number of gids 4
      	unknown (100000)
      	unknown (102000)
      	unknown (101000)
      	unknown (101003)
      

      Copy the new created android.img file into the phone's home folder into anbox-data and rewrite the original one.

      posted in Sony Xperia X (F5121 & F5122)
      c4pp4C
      c4pp4
    • RE: [HowTo] Alternate way of saving battery when using 4G/LTE

      @mario-ch In case of Xperia X (maybe it's related to Halium 7.1) we have to set it to "lte" option instead of "any", so the script for your needs (3G<->4G) is here:

      #!/bin/bash
      
      interface=org.freedesktop.DBus.Properties
      member=PropertiesChanged
      
      dbus-monitor --session "type=signal,interface='${interface}',member='${member}'" |
      while read -r line; do
              if [[ ${line} == *"com.canonical.UnityGreeter"* ]]; then
                      read && read && read -r line
                      if [[ ${line} == *"IsActive"* ]]; then
                              read -r line
                              [[ ${line} == *"true"* ]] && /usr/share/ofono/scripts/set-tech-preference /ril_0 umts 1>/dev/null
                              [[ ${line} == *"false"* ]] && /usr/share/ofono/scripts/set-tech-preference /ril_0 lte 1>/dev/null
                      fi
              fi
      done
      
      posted in Support
      c4pp4C
      c4pp4
    • RE: Waydroid reboots my phone connected by wifi

      @stanwood
      Hi, thank you, I talked to him and it looks like there is no problem with missing kernel option. I made an issue: https://github.com/waydroid/waydroid/issues/268

      posted in Waydroid
      c4pp4C
      c4pp4
    • RE: [HowTo] Alternate way of saving battery when using 4G/LTE

      @totalrando use the walkthrough from the first post, just change variables to:

      primary_preference="lte"
      saving_preference="umts"
      
      posted in Support
      c4pp4C
      c4pp4

    Latest posts made by c4pp4

    • RE: Problem with daily upgrade

      @donieck I have reinstalled it via ubports-installer (RC channel). There is some kind of problem with the DEV channel build.

      Recovery works - hold power button, after the screen is restarted, release power button and hold volume up button until warning about unlocked bootloader appears, then release volume up button and wait for recovery.

      posted in Xiaomi Mi A2
      c4pp4C
      c4pp4
    • RE: My final feedback after 5 months of using UT on a Xiaomi Mi A2

      @embeddedmz said in My final feedback after 5 months of using UT on a Xiaomi Mi A2:

      • Volume of headphones used with a USB Type-C to 3,5 mm adaptor is low even if the system sound volume is at it highest value.

      Boot device to recovery screen. (restart + Volume Up) and connect to PC. From Terminal do:

      1. if your vendor is flashed to slot A:
      adb shell mount /dev/block/bootdevice/by-name/vendor_a /tmp
      adb pull /tmp/etc/mixer_paths.xml
      sed -i -e '/RX1 Digital Volume/{s/72/81/}' -e '/RX2 Digital Volume/{s/72/81/}' mixer_paths.xml
      adb push mixer_paths.xml /tmp/etc
      adb shell umount /tmp
      
      1. if your vendor is flashed to slot B:
      adb shell mount /dev/block/bootdevice/by-name/vendor_b /tmp
      adb pull /tmp/etc/mixer_paths.xml
      sed -i -e '/RX1 Digital Volume/{s/72/81/}' -e '/RX2 Digital Volume/{s/72/81/}' mixer_paths.xml
      adb push mixer_paths.xml /tmp/etc
      adb shell umount /tmp
      

      You can try to change both slots.
      Restart device and enjoy.

      Note: sed command is changing volume 72 to 81 in this section:

      <path name="headphones-ce">
              <path name="headphones" />
              <ctl name="RX1 Digital Volume" value="72" />
              <ctl name="RX2 Digital Volume" value="72" />
      </path>
      

      • The web browser : when watching a video on Youtube, it's impossible to move the seek bar to another time and when we try harder there's the contextual menu of the browser that appears.

      You can try tapping (double, tripple etc.) right side of video to forward, left side to backward seek.

      posted in Xiaomi Mi A2
      c4pp4C
      c4pp4
    • RE: [HowTo] Alternate way of saving battery when using 4G/LTE

      @prog-amateur said in [HowTo] Alternate way of saving battery when using 4G/LTE:

      I have used the "lte" modification in the script without success. Then I have reboot my phone and the script was working perfectly.

      Thank you for the report, you have to use "restart lte-battery-saver" to apply script changes. I will add a note about it. It looks like "lte" is more generic then "any" so I'll change the script.

      posted in Support
      c4pp4C
      c4pp4
    • RE: Morph (QtWebEngine) outdated

      https://security.gentoo.org/glsa/202101-30

      posted in Support
      c4pp4C
      c4pp4
    • RE: Morph (QtWebEngine) outdated

      @domubpkm Testing MR is not an option for me. I'm able to test QA only. And I think more important is the answer to question 1. about security.

      posted in Support
      c4pp4C
      c4pp4
    • Morph (QtWebEngine) outdated

      Release: OTA-22
      User-agent: Mozilla/5.0 (Linux; Ubuntu 16.04) AppleWebKit/537.36 Chrome/77.0.3865.129 Safari/537.36
      Internet banking site: https://ib.airbank.cz

      My internet banking is disabled due to outdated Morph web browser. According to this: https://github.com/ubports/morph-browser/issues/223#issuecomment-529066969, user-agent is using version taken from QtWebEngine. The installed one is 5.14.2 which is quite old I think.

      1. Is it safe to use the browser?
      2. What are my options now?
      posted in Support
      c4pp4C
      c4pp4
    • RE: Waydroid reboots my phone connected by wifi

      @stanwood
      Hi, thank you, I talked to him and it looks like there is no problem with missing kernel option. I made an issue: https://github.com/waydroid/waydroid/issues/268

      posted in Waydroid
      c4pp4C
      c4pp4
    • RE: Waydroid reboots my phone connected by wifi

      @stanwood said in Waydroid reboots my phone connected by wifi:

      @soulrock So I checked with Rudi.
      He just told me that this device hasn't got the appropriate kernel patch, this explains why you have some issues.

      Please contact the porter, or wait until a fix comes in a future OTA update.

      @stanwood
      Hi, would you please specify what patch is missing or ask Rudi?

      Here you can see related kernel changes: https://github.com/ubports-xiaomi-sdm660/android_kernel_xiaomi_sdm660/commit/36668a5cb62a916e2bcde178fce808f34726856f

      posted in Waydroid
      c4pp4C
      c4pp4
    • RE: Waydroid reboots my phone connected by wifi

      @mkarpicki No, I meant cellular data.

      posted in Waydroid
      c4pp4C
      c4pp4
    • RE: Waydroid reboots my phone connected by wifi

      @mkarpicki I've tried WhatsApp and it's working as well with cellular data.

      posted in Waydroid
      c4pp4C
      c4pp4