Lenovo ThinkSmart View ROM/OS Development

Alright. Enough ThinkSmart for the day :stuck_out_tongue:

Quick recap, hereā€™s what I got working today:

  • WiFi
  • Bluetooth
  • Touchscreen
  • GPU
  • Display

The graphics do not work well at this point. The GNOME desktop is very glitchy to the point of being barely usable. I will try other desktop environments and also try optimizing the kernel a bit further.

26 Likes

Holy crap!

Thatā€™s freaking impressive. Well done guys, you ROCK !

Just bought 3 of these off the back of this, keep it up :metal:

Amazing work! So camera, audio and maybe rotation sensor? Is anything else left after that? Can it run chromium without a full desktop? Would love to run this with OpenWakeWord and a Slimproto client! Thanks for all your work figuring this out!

Awesome job! With linux kernel and drivers working, we open this up to way more developers for the display layers.

What specifically is the problem with gnome? Is it gnome Wayland or X? What graphics hardware is on the device?

Could try just using the framebuffer (software graphics). The graphical requirements arent exactly fancy here.

What about a WM designed for touch interfaces, like plasma mobile?

Yes, that looks about right for what is still missing.

A bit stuck on the Camera. I canā€™t find a single good piece of information on the sensor that is installed. The stock libchromatix driver identifies it as s5kc505a which suggests itā€™s a Samsung ISOCELL sensor of some kind. Not sure if any of the mainline kernel drivers can speak to it. Online, the part is identified as Qtech:FX505AA:505A:SPY8133B:24 but I havenā€™t found anything conclusive yet.

Audio is contingent on getting the TI TAS5782M driver working on mainline. I believe the already existing TAS5805M mainline driver is similar enough for me to possibly slightly rewrite it to work with the TAS5782M. At first glance it looks like itā€™s just some differences in initialization. Thankfully itā€™s a TI part, they have their datasheets out in the open. Itā€™s going to be a bit more work than what was needed to get WiFi working with the ath10k driver, but still not a major undertaking.

Sensors seem to be handled by the Hexagon ADSP on this platform (roughly related: Qualcomm Snapdragon Sensor Core - postmarketOS). I might be able to access the sensors directly via a bitbanged i2c bus on the GPIOs. The actual i2c bus is not directly accessible.

It should be able to run Chromium without a full desktop.

Thatā€™s what some of the postmarketOS devs recommended I try. Havenā€™t done so yet.
Right now Iā€™m focusing on packaging up everything I have so far so I can get it out there for more people to test and play around with.

4 Likes

Another complication in the implementation of sound is that the board apparently uses the Secondary PCM to Bluetooth Audio.
It doesnā€™t look like PCM audio support is currently in the mainline driver.
There was a patch a few years ago, but it didnā€™t go anywhere: [alsa-devel] [PATCH 0/8] ASoC: qdsp6: db820c: Add support for external and bluetooth audio - Adam Serbinski

So Audio input/output via Bluetooth may be non functional for a while.

1 Like

Recreating your work from source is a pretty daunting task.

Any chance we could get a flash dump to try?

I fully indemnify you of any liability :sweat_smile: :stuck_out_tongue_winking_eye:

Haha. So far Iā€™m still working off my first ThinkSmart. The other two are still shrink wrapped :wink:

Here is an image you can use for testing. The default user is pmos with password pmos.

pmos-lenovo-cd-18781y-testing-20240217.tar.xz (409MiB)

You can flash it with EDL (using the loader from the original mod post) like this:

edl --memory=emmc --loader=prog_emmc_firehose_8953_ddr.mbn w boot lenovo-cd-18781y-boot.img && \
edl --memory=emmc --loader=prog_emmc_firehose_8953_ddr.mbn w userdata lenovo-cd-18781y-rootfs.img

Would probably work with QFIL too, just never used it myself.

Be patient when booting for the first time. On first boot the partitions are resized and firmware is put into place from the /vendor partition. All of this can take a good 3-5 Minutes.

At the login screen use the keyboard button (left of 0) to enter the password pmos.

At some point in the boot process, if still connected via USB, the device will pop up as a USB network interface on your machine.
With that, once you see the Phosh login/lock screen you should also be able to SSH into the thing: ssh [email protected]
You can also just connect to WiFi using the UI.
Once logged into the system you can install additional packages using apk add. pmOS has access to Alpine Linux package repos, so pretty much anything should be there.

Bluetooth Keyboards and Mice can be added through the UI in the Bluetooth Settings. Works perfectly.

If you want to use Firefox youā€™ll have to disable hardware acceleration for now: Disable Use hardware acceleration when available (#56) Ā· Issues Ā· postmarketOS / mobile-config-firefox Ā· GitLab

Even building from source should be fairly straightforward:

  1. Setup pmbootstrap
  2. Run pmbootstrap init. Set up your pmOS environment to your liking (I recommend using phosh as the UI option). When it asks for a device choose qemu-aarch64 for now until you install my pmaports git fork in the next steps.
  3. Go to the aports directory. You can find the path to it using pmbootstrap config aports.
  4. Add my git repo as a remote: git remote add kaechele https://gitlab.com/kaechele/pmaports.git
  5. Fetch my git repo: git fetch kaechele
  6. Switch to the correct branch: git checkout kaechele/lenovo-cd-18781y
  7. Set the target device to the ThinkSmart codename: pmbootstrap config device lenovo-cd-18781y
  8. Run the installation: pmbootstrap install. This will take some time as it will have to download and compile the kernel for you.
  9. Sign the boot image. I use magiskboot: magiskboot sign ~/.local/var/pmbootstrap/chroot_rootfs_lenovo-cd-18781y/boot/boot.img (adjust paths as needed, may need sudo because files in the chroot are owned by UID 0 (root))
  10. Flash the resulting images using the edl command above.

Note:
Currently kernel update flashing from within pmOS is not enabled yet. So you will have to both pmbootstrap sideload any updated kernel as well as EDL flash the resulting boot.img. I hope to change this soon, so that the EDL flashing step will be no longer necessary. Just need to find an easy way to sign boot images within the build process and on the device before writing to the partition. If I can get lk2nd working we may no longer need signing (other than for lk2nd).

8 Likes

On a random note: Iā€™m hoping to see some movement in the Qualcomm GPU space in mainline for AI. In a weird coincidence I stumbled upon a live stream by George Hotz programming a Qualcomm GPU driver. Given his current work on tinygrad and the Snapdragon 845 maybe we can see some improvements there :slight_smile:

2 Likes

Nice work! Iā€™ve been messing with partitions originally to fit the GSI 11 w/ google apps. Still some tweaking to be done but so far I removed the system & vendor partitions to free up some space:

/dev/mapper/userdata2
                          6.4G      1.6G      4.4G  27% /

The original userdata partition wasnā€™t aligned, so this may give a slight performance bump as well.

Interested to run some benchmarks on the 8.1 rom and @FelixKaā€™s linux build.

I think one of them will be MUCH faster :slight_smile:

LOCAL AI on a thinksmart would. Eā€¦ nuts.

I like how you think.

I wouldnā€™t make any bets yet. Linux on MSM8953 based devices still seems to be very much in flux. I also havenā€™t optimized much at all right now. Just trying to get everything up and running.

And stuff still works? :thinking:
From what I can tell /vendor contains the bits and pieces to make the sensors and camera go.

Theyā€™ve been copying the vendor blobs into the gsi.

The vendor partition has a bunch of the oobe Lenovo stuff, getting rid of it probably frees close to half a gig.

1 Like

Ah seems Iā€™ll put vendor back in :laughing: Most everything else is working though.


Edit: Ok 6G partition now. Iā€™ll try again if youā€™re able to make progress with the remaining pieces.

My device has the OOBE stuff on /system, not /vendor. Vendor only has the stuff necessary to run and communicate with the Qualcomm userspace subsystems such as Sensors, Activity Detection, Image Processing and Cameras.
Thereā€™s also ā€œonlyā€ about 260MB of stuff in there.

On another note: I donā€™t think weā€™re gonna get the camera working on mainline. It looks like a completely custom part for Lenovo used in their 2018-2020 generation of low-end/lower-midrange devices.
I donā€™t think Iā€™ll have the time to reverse engineer that thing, although it would be possible.

The sensors via the ADSP may actually be supportable eventually given this merge request for pmOS: Draft: Qualcomm Sensor Manager support (MSM8996 & Co. SSC) (!4118) Ā· Merge requests Ā· postmarketOS / pmaports Ā· GitLab
But it looks like work wasnā€™t completed on it.

2 Likes

I finally had a chance to try flashing the linux build.

Itā€™s clearly booting, because I see the USB ethernet device on my host:

[81608.624056] usb 1-3: New USB device found, idVendor=18d1, idProduct=d001, bcdDevice= 6.07
[81608.624061] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[81608.624063] usb 1-3: Product: Lenovo ThinkSmart View
[81608.624064] usb 1-3: Manufacturer: Lenovo
[81608.624065] usb 1-3: SerialNumber: postmarketOS
[81608.655848] cdc_ncm 1-3:1.0: MAC-Address: f6:e9:3b:e5:2d:f0
[81608.656043] cdc_ncm 1-3:1.0 usb0: register 'cdc_ncm' at usb-0000:00:14.0-3, CDC NCM (NO ZLP), f6:e9:3b:e5:2d:f0
[81608.672336] cdc_ncm 1-3:1.0 enp0s20f0u3: renamed from usb0

However, the LCD displays only flashing shapes with very low brightness.

Have not tried flashing on another unit, will report back.

Does anyone know if this device is the same (or at least spec-wise) than the Google Assistant one? Model no. SD-X701B