Livecasting porting notes for Zenfone 8

Day 5 Season 2

Dropping plans - day 36

I forgot to mention that while I was in vacation, Mister_Magister and K31jo started porting SailfishOS for Zenfone 8 too !
This is excellent news - my dream come true.

I think there’s one thing that can make ports better, and that is having more than one dev working on them.

I have shared the repos I have online under my github username, but we are still figuring out how to work.
Because maintainership of OBS nemo:devel:hw:asus:sake was already requested by him, Mister_Magister added me to that project.

My plan is to make some tests with OBS build, since the “devel” project builds the latest saiflishos.
So, I locally build 4.4.x, and I can add OBS repositiory so that I can simulate an upgrade to 4.5.x
This was one of the reasons I chose to build locally a previous version.

This would also allow me to see if droidmedia works better with 4.5 (though I doubt that 64-bit error will “fix itself”).

So I upload the droid-hal* rpms I have locally to that project, and add a couple more projects from their repositories, as suggested by OBS when the build does not start because ther is a missing package.

Now, if the droidmedia test fails, I can continue to figure out with building locally - but I still have the option to see if 4.4 would work first. Then I could build a slightly outdated droidmedia for 4.5.

But, I have a local change that it is not in github: masking of usb_moded. My local package has that /dev/null link in /etc/systemd, and the remote one would not → so if I update the system, the link will get removed, usb-moded will start, I’ll lose telnet access (which I still require since this is wifi-instable) and I have to go back to TWRP or Lineage Recovery to fix this, which I don’t want to:P

usb_moded: as per hadk-hot, I add -D to see debug arguments, and run in manually. Which immediately cuts me off from the usb connection.
Then reboot (using the GUI;), and look at journalctl -b -1 (that is, previous boot)

/config/usb_gadget/g1/functions/rndis.usb0/ethaddr: can’t open for writing: No such file or directory
/config/usb_gadget/g1/functions/rndis.usb0/wceis: can’t open for writing: No such file or directory

…Hang on, I’m confused. usb-moded disablement made it accidentally into my droid-config-sake repo.
Dropping plans to fix usb_moded for now:)

To update to 4.5.x, I need this line (from tucana ssu lr)
adaptation-community ... http://repo.merproject.org/obs/nemo:/devel:/hw:/xiaomi:/tucana/sailfish_latest_aarch64/
added / replacing this line from sake ssu lr:
adaptation-community-common ... https://repo.sailfishos.org/obs/nemo:/devel:/hw:/common/sailfish_latest_aarch64/

But meanwhile k1gen has the same GraphicMetadataBuffer does not work on 64-bit arch error.
So it might not “fix itself” even by upgrading to 4.5.x
Dropping plans to update to 4.5.x for now:)

# mv /usr/libexec/droid-hybris/system/lib64/libdroidmedia.so /usr/libexec/droid-hybris/system/lib64/libdroidmedia.so-bak
Doesn’t work. I doesn’t just simply start using 32-bit libs:)

Let’s switch plans and actually build the 4.4 droidmedia version with rinigus’ miniaudiopolicy.

$ cd external [vlad@vlinux external]$ git clone https://github.com/sailfishos-sony-tama/miniaudiopolicy.git cd - TEMPORARY_DISABLE_PATH_RESTRICTIONS=true make -j$(nproc --all) miniaudiopolicyservice

external/miniaudiopolicy/Android.mk: error: “miniaudiopolicyservice (EXECUTABLES android-arm64) missing libsoundtriggerservice (SHARED_LIBRARIES android-arm64)”

FAILED: ninja: 'out/target/product/sake/obj/SHARED_LIBRARIES/libsoundtriggerservice_intermediates/libsoundtriggerservice.so.toc', needed by 'out/target/product/sake/obj/EXECUTABLES/miniaudiopolicyservice_intermediates/LINKED/miniaudiopolicyservice', missing and no known rule to make it

Ok, let’s remove it altogether that dependency altogether?

Then I hit some more header errors (the same as with env.mk change the other day) which are again fixed by adding

frameworks/av/media/libmediametrics/include
frameworks/av/media/utils/include \

And the miniaudiopolicy build finally works.

Meanwhile on the device:

zypper in bluebinder doesn’t just “make” bluetooth work.
maybe it needs wifi?

I see this in journal.
Apr 25 10:50:20 Zenfone8 bluebinder_post.sh[7343]: Failed to get bluetooth address!

And this in logcat:
04-25 07:50:46.928 6313 10416 I vendor.qti.bluetooth@1.0-patch_dl_manager: BD Address: 8c:f5:8e:3d:7c:3c

For the first one, I need to fill in the bluetooth address with the second one.
That would go into a file called /var/lib/bluetooth/board-address as expected in this script.
Manually doing echo 8c:f5:8e:3d:7c:3c > /var/lib/bluetooth/board-address does work, but I can’t ship a port with my bluetooth address, can I?

So after stracing and grepping the whole system I “accidentally” find this short 9-byte file:

/mnt/vendor/persist$ xxd bt_nv.bin 
00000000: 0101 068c f58e 3d7c 3c                   ......?|<

Notice it?

This is my new /usr/bin/droid/droid-get-bt-address.sh

#!/bin/sh

B=$(xxd -e -g 8 -ps -s 3 /mnt/vendor/persist/bt_nv.bin)
echo "BT MAC: $B"

if [ ! -z "$B" ] ; then
    bt_mac=${B:0:2}:${B:2:2}:${B:4:2}:${B:6:2}:${B:8:2}:${B:10:2}
    echo $bt_mac > /var/lib/bluetooth/board-address
fi

Not enough time for video debugging today, but at least I have bluetooth.
It works with some audio headphones, but not yet in calls. This should be an easy fix for the next day…