Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huawei watch 2 support #101

Closed
andreagubellini opened this issue Nov 3, 2019 · 153 comments
Closed

Huawei watch 2 support #101

andreagubellini opened this issue Nov 3, 2019 · 153 comments

Comments

@andreagubellini
Copy link

Hi everyone,
I was thinking about this for quite some time.
Is there any chance we could get Asteroid on huawei watch 2?
I would be glad to help on the porting.

@jrtberlin
Copy link
Member

Hi, we have the Huawei watch 2 on the list of possible ports. I don't think that we have made any progress on the watch.
I would start by checking the porting guide (https://asteroidos.org/wiki/porting-guide/).
If you have questions make sure to check our IRC.

Additional note: this is the repository of the sync client for Android.

@jrtberlin jrtberlin transferred this issue from AsteroidOS/AsteroidOSSync Nov 6, 2019
@nabeelmoeen
Copy link

just saw support being added for the Huawei watch GT 2... hoping the huawei Watch 2 classic would be there soon as well

@ajayjohn
Copy link

Same here. +1 for the Huawei Watch 2 (LEO-DLXX)

@jrtberlin
Copy link
Member

To get started on the Huawei Watch 2 we need the partition table of the device.
If somebody has one we could use your help.

Steps to do:

  1. Boot TWRP with fastboot boot
  2. use adb to get the output of: ls -al /dev/block/platform/soc/7824900.sdhci/by-name

@dave18
Copy link

dave18 commented Aug 10, 2020

Hi, I'm new to all this, but is this the right output?

~ # ls -al /dev/block/platform/soc/7824900.sdhci/by-name
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
drwxr-xr-x 2 root root 740 Jan 1 04:29 .
drwxr-xr-x 4 root root 820 Jan 1 04:29 ..
lrwxrwxrwx 1 root root 21 Jan 1 04:29 DDR -> /dev/block/mmcblk0p21
lrwxrwxrwx 1 root root 20 Jan 1 04:29 aboot -> /dev/block/mmcblk0p7
lrwxrwxrwx 1 root root 20 Jan 1 04:29 abootbak -> /dev/block/mmcblk0p8
lrwxrwxrwx 1 root root 21 Jan 1 04:29 boot -> /dev/block/mmcblk0p29
lrwxrwxrwx 1 root root 21 Jan 1 04:29 cache -> /dev/block/mmcblk0p34
lrwxrwxrwx 1 root root 21 Jan 1 04:29 cmnlib -> /dev/block/mmcblk0p24
lrwxrwxrwx 1 root root 21 Jan 1 04:29 cmnlibbak -> /dev/block/mmcblk0p25
lrwxrwxrwx 1 root root 21 Jan 1 04:29 config -> /dev/block/mmcblk0p18
lrwxrwxrwx 1 root root 21 Jan 1 04:29 devinfo -> /dev/block/mmcblk0p23
lrwxrwxrwx 1 root root 21 Jan 1 04:29 fsc -> /dev/block/mmcblk0p13
lrwxrwxrwx 1 root root 21 Jan 1 04:29 fsg -> /dev/block/mmcblk0p22
lrwxrwxrwx 1 root root 21 Jan 1 04:29 keymaster -> /dev/block/mmcblk0p26
lrwxrwxrwx 1 root root 21 Jan 1 04:29 keymasterbak -> /dev/block/mmcblk0p27
lrwxrwxrwx 1 root root 21 Jan 1 04:29 keystore -> /dev/block/mmcblk0p17
lrwxrwxrwx 1 root root 21 Jan 1 04:29 misc -> /dev/block/mmcblk0p15
lrwxrwxrwx 1 root root 21 Jan 1 04:29 modem -> /dev/block/mmcblk0p32
lrwxrwxrwx 1 root root 21 Jan 1 04:29 modemst1 -> /dev/block/mmcblk0p11
lrwxrwxrwx 1 root root 21 Jan 1 04:29 modemst2 -> /dev/block/mmcblk0p12
lrwxrwxrwx 1 root root 21 Jan 1 04:29 nfc -> /dev/block/mmcblk0p19
lrwxrwxrwx 1 root root 21 Jan 1 04:29 nvbin -> /dev/block/mmcblk0p10
lrwxrwxrwx 1 root root 20 Jan 1 04:29 nvdata -> /dev/block/mmcblk0p9
lrwxrwxrwx 1 root root 21 Jan 1 04:29 oem -> /dev/block/mmcblk0p28
lrwxrwxrwx 1 root root 21 Jan 1 04:29 recovery -> /dev/block/mmcblk0p31
lrwxrwxrwx 1 root root 21 Jan 1 04:29 reserved -> /dev/block/mmcblk0p20
lrwxrwxrwx 1 root root 20 Jan 1 04:29 rpm -> /dev/block/mmcblk0p3
lrwxrwxrwx 1 root root 20 Jan 1 04:29 rpmbak -> /dev/block/mmcblk0p4
lrwxrwxrwx 1 root root 20 Jan 1 04:29 sbl1 -> /dev/block/mmcblk0p1
lrwxrwxrwx 1 root root 20 Jan 1 04:29 sbl1bak -> /dev/block/mmcblk0p2
lrwxrwxrwx 1 root root 21 Jan 1 04:29 sec -> /dev/block/mmcblk0p30
lrwxrwxrwx 1 root root 21 Jan 1 04:29 splash -> /dev/block/mmcblk0p16
lrwxrwxrwx 1 root root 21 Jan 1 04:29 ssd -> /dev/block/mmcblk0p14
lrwxrwxrwx 1 root root 21 Jan 1 04:29 system -> /dev/block/mmcblk0p33
lrwxrwxrwx 1 root root 20 Jan 1 04:29 tz -> /dev/block/mmcblk0p5
lrwxrwxrwx 1 root root 20 Jan 1 04:29 tzbak -> /dev/block/mmcblk0p6
lrwxrwxrwx 1 root root 21 Jan 1 04:29 userdata -> /dev/block/mmcblk0p35

@jrtberlin
Copy link
Member

Thanks @dave18, this is what we are looking for!

@dave18
Copy link

dave18 commented Aug 10, 2020

Glad I could help. happy to test any builds on my Watch 2 if needed.

@MagneFire
Copy link
Member

@jrtberlin and I are working on a port for the Huawei Watch 2(sawshark/sawfish). We don't own this watch so this is a unique opportunity for the community to help 😉

We both own the regular Huawei Watch (sturgeon) of which I did the port.

At first glance the two seem very similar. The (probably) biggest challenge is to port the Android base from Marshmallow to Nougat.
It turns out that some people are/were already working on this (https://github.com/iuncuim/android_manifest/commits/ng and https://github.com/asteroid-platy/android_manifest)

The current road map we will use to get a working port will be as follows:

  • Port sturgeon to an Android 7 base.
  • Make Linux kernel boot on sawshark/sawfish (needs debugging help from you)
  • Get partition mapping (done thanks to @dave18)
  • Create system tarball for sawshark/sawfish(using the Android 7 base)
  • Make the compositor work
  • Get touchscreen to work
  • Get sensors to work(seems similar to sturgeon)
  • Get Bluetooth to work(may also be a struggling point)
  • Get modem to work

A repository for the Huawei Watch 2 has already bee setup: https://github.com/MagneFire/meta-sawshark-hybris

Of course, when we have something to test we will publish that here. Though, keep in mind that porting the Android base is a time consuming task, meaning that it'll probably take sometime before we have anything to test for you.

@flocke
Copy link

flocke commented Sep 22, 2020

@jrtberlin @MagneFire Thank you for working on this. I own a Huawei Watch 2 (sawfish) and am pretty well versed in both the Linux and Android ecosystems as well as development for both (I'm the author of andOTP). So if you need any specific information or testing feel free to contact me.

@MagneFire
Copy link
Member

MagneFire commented Nov 6, 2020

Sorry for not getting back at this sooner. But I have successfully ported the Android base to 7.1.1 on sturgeon (the Huawei Watch Classic).

And I have just built a version for the Huawei Watch 2. This one has the system base from a sawfish build. Which is apparently the Bluetooth variant. So in any case I am not sure if it will work for sawshark LTE variant.

Download: https://www.dropbox.com/sh/h0kzcky4qls3v60/AAC7nBfhSoPpStSQ6Gx4h769a?dl=0

First of all, I don't expect it to boot fully. So depending on how far it gets in the boot process there are different things to debug.

To flash

Just follow the general instructions on the install page (pick for example sturgeon). I recommend using the temporary installation as this makes things easier to debug.

It reboots

The first thing to try is to boot AsteroidOS with --cmdline debug-ramdisk parameter.
Keep an eye on device manager/dmesg to see if an ADB device comes available. It is still possible that it reboots. In that case I need to do a little more debugging 😉

EDIT:
Just a heads up, I have updated the version linked. It has the following changes integrated from sturgeon:

  • Update libhybris to latest upstream.
  • Fix vibrator
  • Fix setting props
    • This fixes some weird issues where files couldn't be found.
  • Create a symlink from sawshark to every sawfish library.

Things that could work

Of course I couldn't test this so this is a list of things that may work:

  • Boots
  • Graphics
  • Vibrator
  • USB in ADB mode
  • Sensors (didn't look into this at all, but binaries are at the same location)
  • Speaker
  • Microphone
  • Touchscreen (Assuming that event0 is the touchscreen device)

Things that are likely broken

Some bugs are general on all platforms sawshark will be no different 😄

Things that won't work

Some of these are bugs and some aren't actually finished yet:

  • Bluetooth (misses patches)
  • USB in network/developer mode(This is a bug on sturgeon, must occur here too)

@FlorentBrianFoxcorner
Copy link

FlorentBrianFoxcorner commented Dec 27, 2020

@MagneFire thank you.

Tried booting the BT variant, following https://asteroidos.org/install/sturgeon/

The watch is unlocked now. Followed -> 2 b. Temporary installation:

adb push -p /home/fv/Downloads/asteroid-image-sawshark.ext4 /sdcard/asteroidos.ext4
adb reboot bootloader
fastboot boot /home/fv/Downloads/zImage-dtb-sawshark.fastboot

=> The watch then boots again into Wear OS.

Then tried:

fastboot --cmdline "debug-ramdisk" boot /home/fv/Downloads/zImage-dtb-sawshark.fastboot
fastboot: unrecognized option '--cmdline'
fastboot -c "debug-ramdisk" boot /home/fv/Downloads/zImage-dtb-sawshark.fastboot
downloading 'boot.img'...
OKAY [ 0.448s]
booting...
OKAY [ 0.162s]
finished. total time: 0.609s

=> watch hangs in fastboot and does not react on anything except holding both buttons until reset... then again booting into Wear OS

fastboot --version
fastboot version 1:8.1.0+r23-5ubuntu2
Installed as /usr/lib/android-sdk/platform-tools/fastboot

@MagneFire
Copy link
Member

MagneFire commented Dec 27, 2020

@FlorentBrianFoxcorner Thanks for testing! 😄
It is actually great to see that the watch hangs when you boot it with fastboot -c "debug-ramdisk" boot /home/fv/Downloads/zImage-dtb-sawshark.fastboot.
Can you verify whether or not you can connect to the watch using adb when it is frozen in this mode?
If adb shell works, can you send the logs for dmesg?
And try to find the asteroidos.ext4 file using the commands (in adb shell):

. /machine.conf
mkdir /sdcard
mount /dev/$sdcard_partition /sdcard
ls /sdcard

Also, does it show the AsteroidOS boot logo at this point?

Another thing, can you also send the output of dmesg on WearOS?

For reference sake, this may also be helpful: https://asteroidos.org/wiki/boot-process/

@FlorentBrianFoxcorner
Copy link

@MagneFire, YES, I was able to connect!

dmesg-asteroid.txt

It does not show the logo but is stuck at the frozen fastboot menu.

The kernel seems to lack CONFIG_QUOTA, I was NOT able to mount sdcard, mind dmesg.
The partition layout and the image do seem to be ok. I checked with:

adb pull /dev/mmcblk0p35 ./
sudo mkdir /media/debug
sudo mount -o loop ./mmcblk0p35 /media/debug

-> My Ubuntu box was able to mount the resulting image RW alright.

For dmesg on Wear Os I need root or is there a shortcut?

127|sawfish:/ $ dmesg
dmesg: /dev/kmsg: Permission denied

@MagneFire
Copy link
Member

Thanks so much for that info!
I have adjusted the kernel config to include the CONFIG_QUOTA. Can you retry a normal boot first to see if it progresses any further? Otherwise try the steps before again?

Only the fastboot image has changed, you do not need to push the ext4 file again.
https://www.dropbox.com/sh/h0kzcky4qls3v60/AAC7nBfhSoPpStSQ6Gx4h769a?dl=0

@FlorentBrianFoxcorner
Copy link

FlorentBrianFoxcorner commented Dec 28, 2020

The kernel still does not seem to fully support required ext4 features:

[..]
[ 7.722561] msm_otg 78d9000.usb: Avail curr from USB = 500
[ 7.780107] android_work: android_work: sent uevent USB_STATE=CONFIGURED
[ 34.014561] mmc0: mmc_partial_init: tuning execution failed (-22)
[ 34.016290] EXT3-fs (mmcblk0p35): error: couldn't mount because of unsupported optional features (40)
[ 34.017878] EXT4-fs (mmcblk0p35): couldn't mount as ext2 due to feature incompatibilities
[ 34.029527] EXT4-fs warning (device mmcblk0p35): ext4_enable_quotas:5274: Failed to enable quota tracking (type=0, err=-3). Please run e2fsck to fix.
[ 34.029634] EXT4-fs (mmcblk0p35): mount failed
[..]

Tried to build myself, did not succeed...

git clone https://github.com/AsteroidOS/asteroid.git
cd asteroid/src
git clone https://github.com/MagneFire/meta-sawshark-hybris.git # your latest changes are not yet pushed, right?
cd ..

added line to asteroid/build/conf/bblayers.conf:

${SRCDIR}/meta-sawshark-hybris \

then did:

sudo docker rm -f asteroidos-toolchain ; sudo docker run --name asteroidos-toolchain -it -v /etc/passwd:/etc/passwd -u id -u:id -g -v "$HOME/.gitconfig:/$HOME/.gitconfig" -v "$(pwd):/asteroid" asteroidos-toolchain bash -c "source ./prepare-build.sh sawshark && bitbake asteroid-image"

got:

'void (* glGetProgramBinary)(GLuint, GLsizei, GLsizei*, GLenum*, void*)' redeclared as different kind
of symbol

@FlorentBrianFoxcorner
Copy link

Tried

e2fsck -f /dev/mmcblk0p35

Filesystem is ok.

@MagneFire
Copy link
Member

A new fastboot version should be downloadable now. It has some other quota related functions enabled. Does this fix the mounting issues?

As for the bitbake issue, I think this is caused by libhybris using newer GLES3 based headers. The reason as to why I am not getting this issue is likely due to a dependency not recompiling after the libhybris change(i.e. lipstick, asteroid-launcher, etc are using older headers and compile fine.).
Anyway, I have downgraded the libhybris used, to a version that might fix the issue.

@FlorentBrianFoxcorner
Copy link

That did the trick for mounting /sdcard!

Without debug:
IMG_20201229_121750

New dmesg:
dmesg-sawshark-2020-12-29.txt

sh-4.4# ls -l /sdcard
drwx------ 2 root root 4096 Oct 21 04:39 adb
-rw------- 1 1000 1000 6640 Dec 29 2020 alm.agnss
drwxrwxr-x 2 1000 1000 4096 Jan 1 2009 anr
drwxrwx--x 8 1000 1000 4096 Dec 28 2020 app
drwx------ 2 root root 4096 Oct 21 04:39 app-asec
drwxrwx--x 2 1000 1000 4096 Oct 21 04:39 app-ephemeral
drwxrwx--x 2 1000 1000 4096 Oct 21 04:39 app-lib
drwxrwx--x 2 1000 1000 4096 Oct 21 04:39 app-private
drwx------ 2 1000 1000 4096 Oct 21 04:39 backup
drwxr-xr-x 2 2000 2000 4096 Oct 21 04:39 bootchart
drwxrwx--- 5 1000 2001 4096 Oct 21 04:39 cache
drwxrwx--x 3 root root 4096 Oct 22 18:32 dalvik-cache
drwxrwx--x 69 1000 1000 4096 Dec 27 2020 data
drwxrwx--- 2 1019 1019 4096 Oct 21 04:39 drm
lrwxrwxrwx 1 1000 1000 30 Oct 21 04:39 firmware -> /system/vendor/firmware/murata
drwxr-x--x 3 root root 4096 Oct 21 04:39 local
drwx------ 3 1000 1000 4096 Jan 1 2009 logdata
drwxrwx--- 2 root root 4096 Jan 1 1970 lost+found
drwxrwx--- 4 1023 1023 4096 Jan 1 2009 media
drwxrwx--- 2 1031 1031 4096 Oct 21 04:39 mediadrm
drwxrwx--t 35 1000 9998 4096 Oct 21 04:39 misc
drwxrwx--t 3 1000 9998 4096 Jan 1 2009 misc_ce
drwxrwx--t 3 1000 9998 4096 Oct 21 04:39 misc_de
drwxr-xr-x 2 1027 1027 4096 Jan 1 2009 nfc
drwxrwx--x 2 root root 4096 Oct 21 04:39 ota
drwxrwx--- 2 1000 2001 4096 Oct 21 04:39 ota_package
-rw------- 1 1000 1000 143638 Dec 29 2020 persistence.agnss
drwx------ 2 root root 4096 Dec 29 2020 property
drwxrwx--x 2 1000 1000 4096 Dec 28 2020 resource-cache
drwx------ 2 1000 1000 4096 Oct 21 04:39 ss
drwxrwxr-x 17 1000 1000 4096 Dec 29 2020 system
drwxrwx--- 3 1000 1000 4096 Jan 1 2009 system_ce
drwxrwx--- 3 1000 1000 4096 Oct 21 04:39 system_de
drwx------ 2 1000 1000 4096 Dec 25 2020 time
drwxrwx--x 2 1000 1000 4096 Oct 21 04:39 tombstones
drwx--x--x 2 1000 1000 4096 Oct 21 04:39 user
drwx--x--x 3 1000 1000 4096 Oct 21 04:39 user_de
drwxrwx--x 4 root root 4096 Oct 21 04:39 vendor

Also started new build now...

@MagneFire
Copy link
Member

Very interesting!
Can you check if /system/bin/logcat also outputs information? It should help with the display issue.

@FlorentBrianFoxcorner
Copy link

There is no adb connection possible when booted without debug.

And in debug mode there is no /system mounted.

Followed https://asteroidos.org/wiki/boot-process/ and logcat is in /rfs/system/bin. But it seems to be dynamically linked and libs are missing as well as ldd -> I am lost.

sh-4.4# /rfs/system/bin/logcat
sh: /rfs/system/bin/logcat: No such file or directory
sh-4.4# ldd /rfs/system/bin/logcat
sh: ldd: command not found

The build passed yesterday's error, now stuck at

collect2: error: ld returned 1 exit status
Makefile.AccountsHelperTest:161: recipe for target 'AccountsHelperTest' failed
make[4]: *** [AccountsHelperTest] Error 1
make[4]: Leaving directory '/asteroid/build/tmp-glibc/work/armv7vehf-neon-oe-linux-gnueabi/buteo-syncfw/+gitAUTOINC+dc14838480-r1/build/unittests/tests/msyncd
tests'
Makefile:57: recipe for target 'sub-AccountsHelperTest-pro-make_first' failed
make[3]: *** [sub-AccountsHelperTest-pro-make_first] Error 2

I there a way to skip tests during build?

@MagneFire
Copy link
Member

MagneFire commented Dec 29, 2020

Is a ssh connection possible without debug mode? (ssh ceres@192.168.2.15) (https://asteroidos.org/wiki/ssh/)
I don't think we need the debug mode for now, as it no longer crashes/reboots.

As for the build, disabling tests require some manual patches as well. Can you try to clean the package first?

bitbake -ccleanall buteo-syncfw

And try to rebuild.

Also, I have uploaded a new ext4 image that should have adb mode as the default. Just in case the ssh thing doesn't work.

@FlorentBrianFoxcorner
Copy link

FlorentBrianFoxcorner commented Dec 29, 2020

Sorry I did not notice this earlier: When that screen content I sent earlier is displayed, actually no USB connection can be made to the watch. Tried different USB ports at my PC without success. Also tried with new ext4 image. Ubuntu dmesg shows endlessly:

[..]
[ 4303.939954] usb 1-2.3: new high-speed USB device number 43 using xhci_hcd
[ 4304.072975] usb 1-2.3: New USB device found, idVendor=12d1, idProduct=1c2c, bcdDevice= 3.18
[ 4304.072978] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4304.072979] usb 1-2.3: Product: LEO-BX9
[ 4304.072980] usb 1-2.3: Manufacturer: HUAWEI
[ 4304.072981] usb 1-2.3: SerialNumber: TKQ7N18B06001286
[ 4846.446522] usb 1-2.3: USB disconnect, device number 43
[ 4846.446762] xhci_hcd 0000:02:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[ 4851.471366] usb 1-2.3: new high-speed USB device number 44 using xhci_hcd
[ 4851.607115] usb 1-2.3: New USB device found, idVendor=18d1, idProduct=d00d, bcdDevice= 1.00
[ 4851.607117] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4851.607119] usb 1-2.3: Product: Android
[ 4851.607120] usb 1-2.3: Manufacturer: Google
[ 4851.607121] usb 1-2.3: SerialNumber: TKQ7N18B06001286
[ 4876.909970] usb 1-2.3: USB disconnect, device number 44
[ 4890.739454] usb 1-2.3: new high-speed USB device number 45 using xhci_hcd
[ 4890.850385] usb 1-2.3: no configurations
[ 4890.850390] usb 1-2.3: can't read configurations, error -22
[ 4890.943980] usb 1-2.3: new high-speed USB device number 46 using xhci_hcd
[ 4891.054389] usb 1-2.3: no configurations
[ 4891.054393] usb 1-2.3: can't read configurations, error -22
[ 4891.058403] usb 1-2-port3: attempt power cycle
[ 4892.307485] usb 1-2.3: new high-speed USB device number 47 using xhci_hcd
[ 4892.333378] usb 1-2.3: no configurations
[ 4892.333383] usb 1-2.3: can't read configurations, error -22
[ 4892.427993] usb 1-2.3: new high-speed USB device number 48 using xhci_hcd
[ 4892.453381] usb 1-2.3: no configurations
[ 4892.453385] usb 1-2.3: can't read configurations, error -22
[ 4892.457403] usb 1-2-port3: unable to enumerate USB device
[ 4892.752003] usb 1-2.3: new high-speed USB device number 49 using xhci_hcd
[ 4892.862406] usb 1-2.3: no configurations
[ 4892.862410] usb 1-2.3: can't read configurations, error -22
[ 4892.955995] usb 1-2.3: new high-speed USB device number 50 using xhci_hcd
[ 4893.070021] usb 1-2.3: no configurations
[ 4893.070027] usb 1-2.3: can't read configurations, error -22
[ 4893.074426] usb 1-2-port3: attempt power cycle
[ 4893.692010] usb 1-2.3: new high-speed USB device number 51 using xhci_hcd
[ 4893.717061] usb 1-2.3: no configurations
[ 4893.717065] usb 1-2.3: can't read configurations, error -22
[ 4893.812015] usb 1-2.3: new high-speed USB device number 52 using xhci_hcd
[ 4893.837421] usb 1-2.3: no configurations
[ 4893.837426] usb 1-2.3: can't read configurations, error -22
[ 4893.840995] usb 1-2-port3: unable to enumerate USB device
[..]

These line occurs after fastboot boot [..] zImage-dtb-sawshark.fastboot:

[ 4846.446522] usb 1-2.3: USB disconnect, device number 43
[ 4846.446762] xhci_hcd 0000:02:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

Then the device becomes "Google Android" and USB connect is no longer possible.

Trying rebuild as well.

@FlorentBrianFoxcorner
Copy link

Build succeeded, I get the same result when using resulting ext4 and kernel.

@MagneFire
Copy link
Member

MagneFire commented Dec 29, 2020

ok, thanks for confirming. I am currently not sure why this issue occurs.
And good to see the same behavior, it's at least reproducible 😉

Meanwhile, I will create a new layer specific for the Bluetooth version of this watch. So there will, for now be, two repos:

I will let you know when the builds are done. The files will be published here: https://www.dropbox.com/sh/lefbpbjwqsmhfm2/AABSEF33uHH119JV38Ri1OYna?dl=0

On sturgeon usb did also not work, but this was partly solved by reverting a commit: https://github.com/MagneFire/meta-sturgeon-hybris/blob/nougat-mr1.8-release/recipes-kernel/linux/linux-sturgeon/0001-Revert-KEYS-Fix-crash-when-attempt-to-garbage-collec.patch. Something similar might also be needed here, though this commit does not appear for sawshark...
Otherwise, we could also disable usb-moded completely and use adbd directly, similar to: AsteroidOS/meta-asteroid#15.
I can test these changes for sturgeon too, so I don't suspect this to be a difficult thing to do.

edit: New files have been published to the Dropbox folder. Also I have updated the kernel to the latest version for Nougat.

Edit 2: I have updated the binaries one more time
On sturgeon we also pull the /firmware files, this was needed for the adsp to work. Instead of pulling these files on sawfish the partition is mounted to /firmware (MagneFire/meta-sawfish-hybris@53b9122) and then firmwared is adjusted to look there for files too (MagneFire/meta-sawfish-hybris@0877206).
The binaries for this version is located in the firmware_test folder.
Can you test if either behaves any differently from the previous builds?

@fosspill
Copy link

fosspill commented Jan 5, 2021

I'm not very well versed in this but I did try to flash both versions referenced in your last post @MagneFire to my Watch 2.

No luck: Both end up with the screen shown here #101 (comment)

To make the device discoverable with adb -c "debug-ramdisk" is still needed but the screen is frozen on the bootloader screen while debug is active.

I'd gladly extract any logs I can (from debug) if needed!

@MagneFire
Copy link
Member

MagneFire commented Jan 5, 2021

@fosspill Thanks for testing!
Maybe something else we can do is make the journal log persistent. To get the logs from the mode where something is shown on the screen.

1. Boot to debug-ramdisk

Boot to this mode to change the configuration of journalctl.

Then start a adb shell session. Execute the following commands:

. /machine.conf
mkdir /sdcard
mount /dev/$sdcard_partition /sdcard
mount -o loop /sdcard/media/0/asteroidos.ext4 /mnt
chroot /mnt
vi /etc/fstab

Change the contents of /etc/fstab to disable the /var/volatile entry, like this:

...
#tmpfs                /var/volatile        tmpfs      defaults              0  0
...

Then make adjust the journald config:

vi /etc/systemd/journald.conf

Adjust the #Storage=auto to Storage=persistent

...
[Journal]
Storage=persistent
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
...

Lastly, remove the symlink and create a new folder:

rm /var/log
mkdir /var/log/

Now exit chroot:

exit

And reboot to normal mode.

2. Reboot to normal mode.

Now just reboot to the mode where adb is broken, but where something is displayed on the screen.
Wait for a ~5 minutes, just to be sure.

3. Reboot to debug mode.

Now boot to debug mode to fetch the journalctl logs from the normal mode:

. /machine.conf
mkdir /sdcard
mount /dev/$sdcard_partition /sdcard
mount -o loop /sdcard/media/0/asteroidos.ext4 /mnt
chroot /mnt
journalctl --no-pager

Now you should see the log of the previous boot. Can you send me this?

On a side node, I have updated the images once more with an updated adb daemon and small changes to the usb-moded package. Can you test this too. I don't really expect it to be any different, but you never know 😉

edit: Adjusted instructions for temporary installation.

@fosspill
Copy link

fosspill commented Jan 5, 2021

First: The new images has the exact same issue.

Further:
I think I may have done something wrong (or missed a step here).

I ran (in order):

$ fastboot -c "debug-ramdisk" boot zImage-dtb-sawfish.fastboot
Downloading 'boot.img'
OKAY [  0.438s]
booting
OKAY [  0.161s]
Finished. Total time: 0.829s

$ adb shell
sh-4.4# . /machine.conf
sh-4.4# mkdir /sdcard
sh-4.4# mount /dev/$sdcard_partition /sdcard
sh-4.4# mount -o loop /sdcard/media/0/asteroidos.ext4 /mnt
mount: mounting /sdcard/media/0/asteroidos.ext4 on /mnt failed: No such file or directory

There is indeed no /0/ or anything alike in /sdcard/media, it is empty.

@MagneFire
Copy link
Member

Huh!? That's really strange, can you try this: #101 (comment), is the output the same?
Just to confirm that your watch isn't doing anything weird.
Are there any contents in the /sdcard/ when you mount it?

@bottymcbotface666
Copy link

@MagneFire
Great news, thanks for the picture you mailed me! I am very excited about the further development.

unnamed

@MagneFire
Copy link
Member

Time for a quick update.

It looks like the lackluster performance is originating from the underclock script we use https://github.com/AsteroidOS/meta-sawfish-hybris/blob/master/recipes-core/underclock/underclock/underclock. Looking at the WearOS scripts makes it more obvious that it keeps all cores active but limiting their max clock speed. In any case, I've done some tuning such that it keeps only two cores active instead and changing the GPU parameters. Now it performs much better 😄

Lastly, I looked into the speaker/microphone issue, it turns out that the issue really is related to using Oreo firmware files on a Nougat kernel. So, I went ahead and ported everything to Oreo and now the speaker and microphone works fine too.
Also, I took this opportunity to, instead of a watch specific tarball, build a generic system tarball for all msm8909(Wear 2100/Wear 3100) based watches. This should make it much easier for future ports to happen. Though, I must say that currently, it requires some hacks to get it to work (Enable OverlayFS to remove files from the read-only system partition and symlink hwcomposer so files.).

Happy easter to you all!

@flocke
Copy link

flocke commented Apr 4, 2021

@MagneFire Awesome to see all the progress you made, looks like I can soon permanently ditch WearOS from my sawfish.
Sorry I wasn't able to test the microphone/speaker stuff myself, I just couldn't find the time recently.
But that should change soon and I'd be happy to test your new builds then! Keep up the great work!

@MagneFire
Copy link
Member

MagneFire commented Apr 14, 2021

In case you haven't noticed, we finally have official nightlies! (https://asteroidos.org/install/sawfish/)

To comment on last progress update I've uploaded a nightly with some of my most recent changes in there (not upstreamed yet). It's available here: https://www.dropbox.com/sh/r2hhnfsgk3lbbxz/AADJyoFw4jKGG_h4-CYlIoAva?dl=0

A list of changes compare to the current upstream build:

  • Now based on an Oreo build.
  • Now requires you have a WearOS Oreo installed before installing this build, the WearOS system partition is mounted for vendor blobs instead of shipping this ourselves. This reduced the overall image size.
  • Updates the kernel too.
  • A fix for USB, really quirky right now, only ADB mode works (Select ADB mode in the settings app, other modes don't work).
    • I have no idea why, but enabling debug information for USB gadget in the kernel fixes adb 😄
  • Fix boot logo not shown at boot.
  • Fix speaker.
  • Fix microphone.
  • Disables underclock to reduce sluggishness of the user interface.

I did now start to notice that battery life isn't particularly great. I'm currently looking into this specific thing. Disabling AOD and Bluetooth still causes a huge battery drain, not sure where to look for now. I intend to look into how this was in the current official nightly. An initial look into the dmesg log reveals that once the system has entered deep sleep the CPU cores activate almost immediately. But looking at the WearOS log reveals the same thing. It may also be possible that the garbled screen patch can cause this because that specific patch undoes some low power mode screen stuff.

Talking about the screen stuff again, while looking into the boot logo not shown at boot issue I noticed that double-buffering for the framebuffer causes the black screen. This makes me lean to think that double buffering could maybe cause the garbled screen output. I will look into this further.

EDIT: I tried to give credit to the most relevant people helping with this port: https://asteroidos.org/wiki/porting-status/ if I missed someone please, let me know so I can rectify.

@fosspill
Copy link

So much exciting stuff here! You are a true superhero @MagneFire.

Battery drain is better with underclock I presume? Maybe keep the sluggishness until the cause of battery drain is figured out?

@MagneFire
Copy link
Member

MagneFire commented Apr 14, 2021

You are too kind @fosspill 😊

Regarding the battery drain, I did also assume that the underclock tool would be the culprit here, but it isn't. The battery drain is equally bad when either all cores are active or if only one core is active (Around 50% overnight with AOD and Bluetooth off). This makes me think it's not related directly to the amount of cores active. There are some low power mode settings for the CPU (https://github.com/AsteroidOS/meta-sawfish-hybris/blob/master/recipes-core/underclock/underclock/underclock#L15) which I seem to have disabled in my local branch, will look into this.

But I can't remember how good/bad battery life was with the previous nightly, so I have to look into this further.

For now I think it could be any of the following:

  • Disabled something in underclock, I shouldn't have disabled.
  • A change in the kernel (went from Nougat to Oreo)
  • Screen low power mode issue, incorrectly enters low power mode, leading to excessive battery drain.

The fact that I have to explicitly disable double buffering to actually show the boot logo is also very interesting. Looking at the kernel source it seems that double buffering is supported, but somehow it results in a black screen. I think this is one of the reasons for the sluggishness too. (Assuming that double buffering = improved UI smoothness)

@flocke
Copy link

flocke commented Apr 14, 2021

Maybe you can have a look at this kernel here now that the watch is ported to an Oreo base: https://forum.xda-developers.com/t/rom-kernel-huawei-watch-2-lte-sawshark-bt-sawfish-owde-180926-001-a1-22-jan-20.3705589/

If I remember correctly it drastically improved battery and and responsiveness on WearOS.

@MagneFire
Copy link
Member

@flocke Very interesting! I will try to use this kernel instead, it does sound like it has quite some improvements.
Sadly, the git history is non-existent, all is pushed as comment: https://github.com/toffyjan/Huwaei_watch_2_sawshark/commits/master this makes traceability pretty much impossible.
Nonetheless, the mentioned improvements seem like it's worth a shot, thanks!

@alfaonyt
Copy link

In case you haven't noticed, we finally have official nightlies! (https://asteroidos.org/install/sawfish/)

To comment on last progress update I've uploaded a nightly with some of my most recent changes in there (not upstreamed yet). It's available here: https://www.dropbox.com/sh/r2hhnfsgk3lbbxz/AADJyoFw4jKGG_h4-CYlIoAva?dl=0

A list of changes compare to the current upstream build:

* Now based on an Oreo build.

* Now requires you have a WearOS Oreo installed before installing this build, the WearOS system partition is mounted for vendor blobs instead of shipping this ourselves. This reduced the overall image size.

* Updates the kernel too.

* A `fix` for USB, really quirky right now, only ADB mode works (Select ADB mode in the settings app, other modes don't work).
  
  * I have no idea why, but enabling debug information for USB gadget in the kernel fixes adb smile

* Fix boot logo not shown at boot.

* Fix speaker.

* Fix microphone.

* Disables underclock to reduce sluggishness of the user interface.

I did now start to notice that battery life isn't particularly great. I'm currently looking into this specific thing. Disabling AOD and Bluetooth still causes a huge battery drain, not sure where to look for now. I intend to look into how this was in the current official nightly. An initial look into the dmesg log reveals that once the system has entered deep sleep the CPU cores activate almost immediately. But looking at the WearOS log reveals the same thing. It may also be possible that the garbled screen patch can cause this because that specific patch undoes some low power mode screen stuff.

Talking about the screen stuff again, while looking into the boot logo not shown at boot issue I noticed that double-buffering for the framebuffer causes the black screen. This makes me lean to think that double buffering could maybe cause the garbled screen output. I will look into this further.

EDIT: I tried to give credit to the most relevant people helping with this port: https://asteroidos.org/wiki/porting-status/ if I missed someone please, let me know so I can rectify.

Huh ?
The speakers don't seems to work for me and I don't know about microphone but the rest seems to work fine.

@MagneFire
Copy link
Member

Speaker and microphone functionality is only fixed in the build referenced in that comment (https://www.dropbox.com/sh/r2hhnfsgk3lbbxz/AADJyoFw4jKGG_h4-CYlIoAva?dl=0). This is not available in the current nightlies. Simply due to the issue that was introduced in these images: huge battery drain.

As for how to test microphone and speaker, look into this PR on the relevant commands: AsteroidOS/meta-sturgeon-hybris#1


As for the thing I did last since the last post here:

  • I tested the kernel @flocke mentioned: This kernel works, but did not fix the battery drain. speaker and microphone doesn't seem to be functional in that kernel, maybe the kernel source referenced is outdated?
  • Tested the latest kernel available for the platform which has linaro upstream: https://github.com/travismills82/android_kernel_huawei_sawshark this one works fine. Maybe we should switch to this kernel by default.

I do think that I found the root cause of the battery drain issue though. It seems to be related to rmt_storage. Looking at the init.rc script it seems that it can hold a wakelock, which would prevent the watch from sleeping. Currently I'm testing to see if this is true by disabling rmt_storage. The main downside of not having rmt_storage enabled is that the speaker and microphone functionality no longer works as the DSP can't boot without rmt_storage enabled.

@alfaonyt
Copy link

Strange with this build https://www.dropbox.com/sh/r2hhnfsgk3lbbxz/AADJyoFw4jKGG_h4-CYlIoAva?dl=0 the speaker and mic doesn't work but the problem is that when my watch is connected to my phone my watch don't receive any notifications 🤔

@MagneFire
Copy link
Member

How are you testing the speaker and microphone? I should mention that it only works as the user ceres. If you use adb shell then you need to login as the ceres user (su ceres).


Also, I can now confirm that rmt_storage was the cause of the battery issues. I will need to investigate why this is holding a wakelock while it should only do this when actually playing/recording audio.

@alfaonyt
Copy link

How are you testing the speaker and microphone? I should mention that it only works as the user ceres. If you use adb shell then you need to login as the ceres user (su ceres).

Also, I can now confirm that rmt_storage was the cause of the battery issues. I will need to investigate why this is holding a wakelock while it should only do this when actually playing/recording audio.

I didn't tested microphone but when I put the speakers at 100% and an alarm I can't hear anything and notifications doesn't work too I don't know why (on your last build)

@MagneFire
Copy link
Member

Ah, I see. We don't actually have any sounds included in the image 😢
There is an open issue: #39 We are missing custom AsteroidOS sounds...

That's also why I noted the AsteroidOS/meta-sturgeon-hybris#1 as that lists the commands that allow you to test the functionality for those.

@alfaonyt
Copy link

Ah, I see. We don't actually have any sounds included in the image 😢
There is an open issue: #39 We are missing custom AsteroidOS sounds...

That's also why I noted the AsteroidOS/meta-sturgeon-hybris#1 as that lists the commands that allow you to test the functionality for those.

Ok but can you check at the notifications please because (I don't know if it's me or not) I don't receive any notification on this build but it worked with the one that is on the official site.

@MagneFire
Copy link
Member

Notifications work fine for me, I've been using this build (https://www.dropbox.com/sh/r2hhnfsgk3lbbxz/AADJyoFw4jKGG_h4-CYlIoAva?dl=0) since yesterday.
If you are using the Android app, there are known issues with pairing. We already have a fix for this (AsteroidOS/AsteroidOSSync#127) it's pending some minor changes.

Otherwise you can just try to reboot the watch or phone. Toggle Bluetooth on/off on the watch or phone. (It's finicky 😉)

@alfaonyt
Copy link

alfaonyt commented May 13, 2021

Notifications work fine for me, I've been using this build (https://www.dropbox.com/sh/r2hhnfsgk3lbbxz/AADJyoFw4jKGG_h4-CYlIoAva?dl=0) since yesterday.
If you are using the Android app, there are known issues with pairing. We already have a fix for this (AsteroidOS/AsteroidOSSync#127) it's pending some minor changes.

Otherwise you can just try to reboot the watch or phone. Toggle Bluetooth on/off on the watch or phone. (It's finicky 😉)

Ok I just rebooted my watch and it worked now.
So now the problems are performance, battery and some USB modes am I right? For the USB I think we just need to look on the debug-ramdisk mode what is the difference between the two USB "drivers" I think and for performance and battery just find a kernel (or modify the actual kernel) that works just good. I am using the janjan's kernel and it is working just fine with Wear OS so why not trying on AsteroidOS (https://forum.xda-developers.com/t/rom-kernel-huawei-watch-2-lte-sawshark-bt-sawfish-owde-180926-001-a1-22-jan-20.3705589/)?

@alfaonyt
Copy link

Hey @MagneFire,
did you tried this kernel ?

@MagneFire
Copy link
Member

MagneFire commented May 24, 2021

Hey @MagneFire,
did you tried this kernel ?

The kernel you mentioned was also mentioned by @flocke. I've already reported the the behavior of this kernel in comment: #101 (comment)
Additionally I tried another kernel that is the most up-to-date I could find (see that comment too).

A reason as to why janjan's ROM build feels smoother is because it enables an additional CPU core and overclocks the GPU. Already tried this too, but still behaves the same. (Could be more but the kernel source doesn't have a proper git history, it's not worth to figure out what exactly changed (21+ million changes in one commit): https://github.com/toffyjan/Huwaei_watch_2_sawshark/commits/master)

I would like to mention again that I don't think the kernel is to blame for the performance issues. As mentioned in #160 (comment) I suspect that the hwcomposer is to blame here.
I did find another optimization where multiple notifications would cause the user interface to become laggy (AsteroidOS/asteroid-launcher#57 AsteroidOS/asteroid-launcher#58). This will have a positive effect on the Huawei Watch 2.

So, to summarize:

Here is a quick comparison between current implementation and with the aforementioned PR fix:

comparison.mp4

@SephGER
Copy link

SephGER commented Sep 13, 2021

I have the Sawfish(BT) variant and I tried the current nightly build and this version: https://www.dropbox.com/sh/r2hhnfsgk3lbbxz/AADJyoFw4jKGG_h4-CYlIoAva?dl=0
With the current nightly I'm stuck in a bootloop and with the other version there is just a black screen after the Huawei Logo. Is there something I'm missing? Is there a specific version from which I must start? Right now my watch runs the stock OS with build OWDD.180215.018

@MagneFire
Copy link
Member

The current nightly has a rather sluggish UI performance. This is using the kernel GPU drivers from Marshmallow with Android Nougat HWComposer library (copied from a stock Nougat ROM) (https://dl.dropboxusercontent.com/s/u1o3mtnlojg49jt/system-NXH20B.tar.gz).

Here is a new version that changes this a bit: https://www.dropbox.com/sh/hwox7dvun536fjb/AADUOnhMVQpJFDhjB-4_Teooa?dl=0 it's similar to what's done in #101 (comment). But for now with microphone and speaker functionality disabled as it resulted in horrible battery life. As well as it has enabled the underclock script again to further improve battery life.
An important change that was introduced in that build was the move towards Android Oreo and the need for an existing WearOS installation (only the system partition needs to be flashed with a system.img from a WearOS build).

Interestingly, using a stock WearOS ROM for sawfish (BT) or sawshark (LTE) from https://www.reddit.com/r/WearOS/comments/9lnwu4/for_those_wanting_to_force_the_new_ui_on_the_hw2/ makes the UI still feel sluggish.

Now the real interesting part, in case you didn't know, the Huawei Watch 2 (BT) actually got some WearOS H (Android Pie) preview builds. Simply using the system image from that results into a much improved UI performance. You can download the WearOS preview build from here: https://storage.googleapis.com/androiddevelopers/shareables/wear-preview/sawfish-PWH1.180422.008.tgz. It works on the LTE version of the watch too.

A quick how to on how to flash

Now to the actual flashing of it all, make sure you are already in fastboot mode:

- fastboot flash system system.img
- fastboot flash userdata asteroid-image-sawfish.ext4
- fastboot flash boot zImage-dtb-sawfish.fastboot
- fastboot continue

Enjoy AsteroidOS performing much better on the Huawei Watch 2 😄

To summarize

  • Current nightly (Nougat blobs): Slow
  • Latest (not upstream) (Oreo blobs): Slow
  • Latest (not upstream) (Pie preview blobs): Much improved (dare I say snappy 😊)

The latest work is not yet upstreamed but you can view it here: https://github.com/MagneFire/meta-sawfish-hybris-1/commits/oreo_v2.

@friedensfurz
Copy link

friedensfurz commented Feb 19, 2022

Sorry for reviving this thread after months, but I think this belongs here :-).
First of all, thank you all so much for AsteroidOS on the HW2!
It indeed works quite snappy, however, the battery life is terrible.

All dropbox links in here are dead, so installed the build from the official website.
This one seems to be different from the (test versions?) above, though.
My watch currently does not even last 12 hours starting with full battery.

Any chance for a fixed build or a reupload? @MagneFire

Thanks ;)

@MagneFire
Copy link
Member

Sorry for reviving this thread after months, but I think this belongs here :-). First of all, thank you all so much for AsteroidOS on the HW2! It indeed works quite snappy, however, the battery life is terrible.

All dropbox links in here are dead, so installed the build from the official website. This one seems to be different from the (test versions?) above, though. My watch currently does not even last 12 hours starting with full battery.

Any chance for a fixed build or a reupload? @MagneFire

Thanks ;)

I'm not aware of people reporting bad battery life on sawfish. It's generally know to have a pretty good battery life (~2 days).
There were some testing images, but they are indeed all dead since all those changes are already merged upstream (except the one with known terrible battery life for a known reason that is rmt-storage).

Is your experienced battery life similar to what you also had on WearOS? This could perhaps mean that your battery is faulty.

Otherwise, it must be some deep sleep related issue. Could you send some logs for that?
Steps to get a log:

  • Ensure ADB mode is enabled in the settings app.
  • On your PC (preferably Linux or MacOS) get the journal log by using:
    • adb shell "journalctl --no-pager" > journal.log
  • Additionally, getting the logcat might also be helpful:
    • adb shell "/system/bin/logcat" > logcat.log

@MagneFire
Copy link
Member

It's worth mentioning that I found a workaround to the black screen issue that has been plaguing this port for some time (and ports that build upon this). This has been merged in: AsteroidOS/meta-smartwatch#74

That PR also makes a huge performance improvement for all ports based on an Android 8.0 base. This port still uses the Nougat base because of the two (now solved) issues.
This means that we don't really have roadblock to keep using an Android 7.0 base. So, I'll work on porting the Android base to 8.0 again soonish :)

@eLtMosen
Copy link
Member

eLtMosen commented Aug 6, 2022

Shall we close this and open individual issues tagged sawfish in meta-smartwatch for eventually remaining problems?

@MagneFire
Copy link
Member

Sounds good 👍
We can probably do the same for AsteroidOS/meta-smartwatch#11

In both cases we have achieved the main goal, which is to add support. Missing features and current issues should get their own dedicated issue in https://github.com/AsteroidOS/meta-smartwatch/issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests