AsteroidOS / meta-smartwatch

OpenEmbedded layer that provides support for various smartwatches.
26 stars 18 forks source link

Add support for the Casio WSD-F20 (ayu/koi) #140

Closed dodoradio closed 1 year ago

dodoradio commented 1 year ago

This adds support for the Casio Pro Trek Smart WSD-F20 (codenamed ayu). The layer is called koi because the kernel and most of the platform is shared with the WSD-F10, the Casio Smart Outdoor Watch. However, this has only been tested on a WSD-F20A, so I cannot actually say for sure that this is supported.

This device is unique in a number of ways, including:

A series of disclaimers

This watch is both problematic and expensive. According to various forum threads, the following failures are embarrassingly common:

Casio does not provide extended warranty for these failures. The watches are also hilariously slow under WearOS, to the point that the second hand can be seen lagging on some watchfaces. Despite all this, used units still sell between $100-$200 in different markets.

My personal example bricked itself while I was testing AsteroidOS, and no longer boots into android unless reflashed with a live dump. This also affects Asteroid: The environment variable LD_BIND_NOW=1 needs to be set for all applications linked against Qt, or they exit with an illegal instruction error. This seems to be caused by the dynamic linker incorrectly mapping the qtbase library, but the issue is completely incomprehensible, and may be caused by a kernel or hardware bug. Just before the watch bricked itself, on one occasion I did get UI to work without the environment variable being set, suggesting that this may be related to the bricking. Because this issue is so unclear, I am not adding the environment variable to the build system until we can clarify on at least one other device. I have currently manually added this variable to /etc/systemd/system.conf .

The port status

Currently, the following works, provided that I set LD_BIND_NOW:

The following does not work:

USB is not externally accessible. On WSD-F20, this can be accessed by removing the four hex screws from the front, removing the whole front bezel and the CASIO logo plate. USB is available as two gold contacts, with D+ on the left and D- on the right. A custom cable is needed for this, and I have had no success with designing a dock for this.

[1] This watch has a reflective segment LCD layered on top of the primary colour LCD. This LCD tells the time and contains a small dot-matrix which is used in WearOS to display the date and sensor data. Although it handles all the sensors on the device, the LCD portion of the driver is quite rudimentary, just copying over data that is written to it. @MagneFire and I have been attempting to reverse engineer an application that writes to this display, but we have only managed to set the time in minutes and hours, and to invert the colours of the display, with no success setting seconds, date or any of the additional functions.

dodoradio commented 1 year ago

There seems to be an issue here, if usb_g_android is enabled, ssh works but adb does not. if it is disabled, adb works but ssh does not.. I'll have to investigate this further

Lisra-git commented 1 year ago

Hey, just found this issue and can't tell how much this help! I'm on my way since a year to fight against mistakes made by Casio making any reset to factory watch useless as they won't pass setup, I got new factory files to flash and was searching for the USB connection, i'll try this and report back, Having an alt OS on this is also probably the best for it to die properly, can't wait to see how this go!

Lisra-git commented 1 year ago

and what's your setup to connect to USB, seem like it just won't detect? any special mode?

dodoradio commented 1 year ago

Hi, the USB access requires disassembly. I plan to release proper instructions soon, but we're currently still figuring things out over on the matrix chat

Lisra-git commented 1 year ago

I just got the pads exposed, I had the entire watched teared down but now face is off and I have the 2 pad exposed what's next?

dodoradio commented 1 year ago

Please can you ask these questions on the matrix chat? The instructions here are intentionally brief, as the flashing process is unptedictable and I'd like to be able to provide one-on-one tech support until I write good instructions; this PR is not a good place for that tech support

Lisra-git commented 1 year ago

I tried to search for it but I can't find it 😅

dodoradio commented 1 year ago

https://asteroidos.org/contact/

eLtMosen commented 1 year ago

I tried to search for it but I can't find it sweat_smile We are at #asteroid:matrix.org

This is what i did to my Ayu. Red is USB green and Black is USB white in my solder job here

IMG_0669

dodoradio commented 1 year ago

With massive help from @beroset and @MagneFire I have managed to reverse engineer nearly all of the segment LCD functions, as far as I understand. Currently commands (which are all 7 bytes long) are known for:

all of the above have been implemented in https://github.com/AsteroidOS/lcd-tools/pull/3

The secondary LCD is made up of:

ic_launcher

normally, the day of week and day of month are displayed on the dot matrix, hours and minutes on large numerical display and seconds on lower display.

The segment LCD also supports a series of special modes that display sensor data:

The sensor segment commands seem to hijack the backlight, which can render the watch inoperable until a hard reboot or the correct reset commands.

dodoradio commented 1 year ago

some testing by @eLtMosen and further testing by me indicates LD_BIND_NOW=1 is always needed in a full install, and is not needed in a temporary install

dodoradio commented 1 year ago

after some light debugging, I am sure that the compass issue is caused by a similar problem to the one seen with the Qt libraries. the issue can be worked around by using the temporary installation method, but it would be great if we figured out the actual cause and an actual solution.

dodoradio commented 1 year ago

The entire LCD interface, at least everything used from wearos, has been reverse engineered. code is at https://github.com/dodoradio/lcd-tools/