Lenovo ThinkSmart View ROM/OS Development

I’m trying to install this booting from a USB Drive with the image of the Live DVD from the edl github account. When I run /opt/edl/edl w boot lk2nd.img or python /opt/edl/edl w boot lk2nd.img

I get

Qualcomm Sahara / Firehose Client V3.60 (c) B.Kerler 2018-2022.
main - Trying with no loader given …
main - Waiting for the device
main - Device detected :slight_smile:
main - Mode detected: sahara

and it just hangs. Anyone have any tips?

edit: If I reset the device while edl is running I get this:

HWID: 0x000660e160008000 (MSM_ID:0x000660e1,OEM_ID:0x6000,MODEL_ID:0x8000)
CPU detected: “APQ8053”
PK_HASH: 0xb9eca30dfea4693497b6ac7eec81d006967281e259eb9ac239f9ce6dabb70c14
Serial: 0xd8d33195

sahara
sahara - [LIB]: Couldn’t find a loader for given hwid and pkhash (000660e160008000_b9eca30dfea46934_[FHPRG/ENPRG].bin) :frowning:

Edl probably too old, build it from git

Thank for your help. I built it from github and flashed the file Felix posted on Feb 27. It boots to a screen with no backlight and the clock shows 19:00. Doesn’t seem like I can interact with it. I’m wondering if that’s the correct image I should have flashed. If so it looks like from other comments I can install an APK that might fix the screen, but I don’t know how I’m supposed to SSH in or install it. Can I do it from windows/wsl or do I need to boot from linux to connect?

Seems like I’m having the exact same issue as @phipe. When the device is booted so I can see the clock (no backlight) it shows up in Windows Device Manager as “CDC NCM”

Edit for anyone who gets here, select the device, choose to manually select the driver, choose network adapters, Microsoft as the vendor and scroll down to UsbNcm. After you install these drivers you should get a new network adapter. Mine has IP 172.16.42.2 and I was able to ssh to 172.16.42.1.

One final update for tonight. I was able to install the APK to fix the display. I’m now stuck at the same place as @TurtleHat. My display looks identical with the slide to unlock halfway off the screen and no response from the touchscreen.

dmesg has the same lines that show an unsupported touchscreen. Probably will just put it away for a while. Thanks to Felix and Mattmon for all your work on this!

relevant dmesg output below:
[ 11.450068] Himax-hx83112b-TS 2-0048: Unknown product id: 0
[ 11.450146] Himax-hx83112b-TS: probe of 2-0048 failed with error -22

I should have the model that @mattmon shipped to me sometime soon. Then I can hopefully add support for that variant. Right now it’s sitting in a warehouse at the border where some UPS person has been scanning it every day for the last 5 days.

6 Likes

Having dealt with that myself, hopefully you have it in the next week or two and they don’t try charging like $70 in duties. I really appreciate all the work you’ve been putting into this.

Do you think it’s likely we’ll be able to get a voice satellite, squeezebox client, and HA dashboard running together on one of these? I think those 3 features together are everything I could hope for from this device.

2 Likes

Voice satellite, yes @dinki and others have already accomplished this on Android. I’m particularly excited to play with voice on @FelixKa’s pmos rom!!

Ha dashboard, yes absolutely

Squeezebox is out of my wheelhouse, but if you can do it on Linux… then probably yes

2 Likes

Maybe a quick update on some other stuff here as well:

  • WiFi: While WiFi is generally quite fast (~200 Mbit/s for me on a WPA2-PSK network) it has some weird RX latency issue (very noticeable on SSH) and also drops to about 10 Mbit/s on WPA3 SAE encrypted networks. Someone reported a similar issue for QCA6174 based cards on the ath10k mailing list but received no replies so far. I’m hoping it can be fixed in the driver, because no firmware for this card has been released by QCA to the linux-firmware repositories. In fact, no firmware for an SDIO card has been put into linux-firmware so far. It lives in an “untested” branch in the upstream ath10k-firmware repository for QCA9377, which is a different card than the QCA9739 that’s in the ThinkSmart View. My bad, SDIO card firmwares exist for QCA6174.
    I’ve tried playing around with the MMC bus settings for the card (it runs at 208MHz in pmOS while the original ROM clocks the bus at 177MHz) but 177MHz actually made the card unreliable to probe on my device, which is why the original code probably includes that mmc re-probe hack. If it does probe at 177MHz there is no real change to the performance. I thought Lenovo may have underclocked the bus due to deficiencies in the board layout, as MMC buses at higher speeds can get finicky as PCB trace length increases. But the card works best at 208MHz for me on my device.
  • Audio Routing: I was able to trace back that weird loopback audio hack that can be seen in the Lenovo GPL diff. In searching for documentation on the registers it sets (which with Qualcomm is never an easy feat) I found it roughly corresponds to this CodeLinaro commit: ASoC: sdm660-cdc: Add 4-mic DMIC support. That means we won’t need it. The ThinkSmart only has 2 DMICs. The Smart Display variants do appear to have 4 DMICs that get switched around depending on device orientation.
  • Speaker Amp: As for the Speaker AMP, I’ll probably implement a whole separate driver. While it is quite similar to the TAS5805M (which is used in the Smart Display series, it seems) it’s different enough that I have to adapt almost every single settings function for the TAS5782M. Might as well just create a new driver then. I haven’t tested the Speaker Amp volume settings yet. Lenovo pins the amp volume to 0dB and then uses digital volume controls to control the playback volume. So, in theory, we should be able to get more volume out of the device if needed.

Meanwhile, the Himax touchscreen variant received its daily tender, loving customs warehouse scan this morning. So far, no other news. I may reach out to UPS and ask what’s going on.

8 Likes

Felix, thanks for all your work. Would it be helpful if you had some testers? If you posted a current ROM image and a list of what you would like to see tested; myself, and I’m sure others, would be glad to see what we could do.

Suggest reading this whole thread.

Several preliminary images have been posted, along with flashing instructions.

Any updates on being able to flash the Smart Display? I’d love to use a different rom from the stock one :pray:. I can help out with testing if needed!

hint, don’t sudo apk update without accepting things break :slight_smile:

  • it broke the audio for me, the rest still works as far as I can see
  • I’ve been pushing this thing to get a feeling what it does in comparison to a raspberry pi 3/4, but with a screen, and so far it doesn’t dissapoint!
  • I had to kill the firewall sudo service nftables stop && sudo rc-update del nftables to run syncthings on it and also get squeezelite to work, but hey they work!

Thanks for the amazing work on this so far everyone, especially @FelixKa. I’m trying to make a cheap FIIO R7 out of this thing and you’re getting really close! Doing this on the front-end side with the A8 / A11 ROMs just is less stable and less comfortable, so I’m with you on this rabbit chase!

Any ideas on how to get data flowing from the USB port outwards? I’ve tried to use a powered USB hub, a single USB c → b adapter and others to get my audioquest dragonfly red to work, but to no avail. The one thing that’s on my to try list is getting an OTG adapter and see if that does something, but perhaps I need to simply change the mode the USB port is working in? I couldn’t get lsusb to tell me anything useful.

3 Likes

Well, normally it shouldn’t break :sweat_smile:

That 's probably because I upstreamed the ALSA config changes. Good news is, they’re now upstream and shouldn’t break in the future as a result.

This should be possible to do. I just have to figure out how :stuck_out_tongue:
Right now it’s configured as a peripheral (so that basic USB networking and debugging works), so OTG is pretty much guaranteed not to work. But the setting in the Device Tree could be changed to OTG, I just don’t know if USB networking will still work after that and if there’s a way to switch between modes without having to recompile the kernel.

1 Like

@FelixKa when you say they’re already upstream, does that mean you’ve patched/updated/released another firmware or should i not have to worry about anything if i have the latest image from somewhere in this forum?

Edit. NM. i think i found your github repo and i see you have a few pre-release tags. I assume those are where you’re doing your development? Are they safe for flashing?

1 Like

well dare I ask to hand me one to test? :smiley:

And again, thanks for the work - happy to help out if I can do anything in particular.

1 Like

Getting USB working sounded intriguing, so I gave it a shot. It works.

It required hooking up all the smbcharger (charging controller) shenanigans in the Device Tree, which I initially left out because the device doesn’t have a battery.

USB Networking works just as before and is the default mode.

Two caveats:

  1. The device does not provide power in host mode. A powered USB hub is required.
  2. The device does not detect that something is plugged into the USB port and will have to be put into host mode manually by invoking echo host > /sys/kernel/debug/usb/7000000.usb/mode as root (the device will revert back to device mode if no USB device shows up within a certain timeframe).

I believe these two limitations to be due to the board design and as such nothing that can be changed, unfortunately.

Here’s the latest build which has USB OTG enabled: pmos-lenovo-cd-18781y-testing-20240319-rootfs.img.xz (405MB) (unxz and then flash to userdata using EDL).
With this build I’ve started using Username pmos and Password 1234 (for ease when unlocking the screen).
If you don’t feel like nuking your current install and just want the updated kernel (the only thing that really changed), that’s here: linux-lenovo-cd-18781y-6.8.0_p20240318235942-r0.apk (20MB)

9 Likes

We are very close! USB looked good for about 15 seconds and then disconnects. Have a powered usb-c hub/ethernet/card reader and it recognized everything. Ethernet even grabbed a DHCP IP address. Tried another combo-hub one with same results. Not sure it matters but I used the kernel apk.

[Tue Mar 19 17:00:32 2024] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[Tue Mar 19 17:00:32 2024] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 1
[Tue Mar 19 17:00:32 2024] xhci-hcd xhci-hcd.1.auto: hcc params 0x0230f665 hci version 0x100 quirks 0x0000008002000010
[Tue Mar 19 17:00:32 2024] xhci-hcd xhci-hcd.1.auto: irq 65, io mem 0x07000000
[Tue Mar 19 17:00:32 2024] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[Tue Mar 19 17:00:32 2024] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 2
[Tue Mar 19 17:00:32 2024] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0 SuperSpeed
[Tue Mar 19 17:00:32 2024] hub 1-0:1.0: USB hub found
[Tue Mar 19 17:00:32 2024] hub 1-0:1.0: 1 port detected
[Tue Mar 19 17:00:32 2024] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[Tue Mar 19 17:00:32 2024] hub 2-0:1.0: USB hub found
[Tue Mar 19 17:00:32 2024] hub 2-0:1.0: 1 port detected
[Tue Mar 19 17:00:32 2024] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[Tue Mar 19 17:00:33 2024] hub 1-1:1.0: USB hub found
[Tue Mar 19 17:00:33 2024] hub 1-1:1.0: 5 ports detected
[Tue Mar 19 17:00:33 2024] usb 1-1.2: new high-speed USB device number 3 using xhci-hcd
[Tue Mar 19 17:00:34 2024] r8152-cfgselector 1-1.2: reset high-speed USB device number 3 using xhci-hcd
[Tue Mar 19 17:00:34 2024] r8152 1-1.2:1.0: load rtl8153a-4 v2 02/07/20 successfully
[Tue Mar 19 17:00:34 2024] r8152 1-1.2:1.0 eth0: v1.12.13
[Tue Mar 19 17:00:34 2024] usb 1-1.5: new high-speed USB device number 4 using xhci-hcd
[Tue Mar 19 17:00:37 2024] r8152 1-1.2:1.0 eth0: carrier on
[Tue Mar 19 17:00:45 2024] xhci-hcd xhci-hcd.1.auto: remove, state 4
[Tue Mar 19 17:00:45 2024] usb usb2: USB disconnect, device number 1
[Tue Mar 19 17:00:45 2024] xhci-hcd xhci-hcd.1.auto: USB bus 2 deregistered
[Tue Mar 19 17:00:45 2024] xhci-hcd xhci-hcd.1.auto: remove, state 1
[Tue Mar 19 17:00:45 2024] usb usb1: USB disconnect, device number 1
[Tue Mar 19 17:00:45 2024] usb 1-1: USB disconnect, device number 2
[Tue Mar 19 17:00:45 2024] r8152-cfgselector 1-1.2: USB disconnect, device number 3
[Tue Mar 19 17:00:46 2024] usb 1-1.5: USB disconnect, device number 4
[Tue Mar 19 17:00:46 2024] xhci-hcd xhci-hcd.1.auto: USB bus 1 deregistered
1 Like

Odd, I didn’t see the USB controller reverting back to device mode when things were connected. I will try to investigate. But I’m going to have to buy a powered USB Hub, as right now I only have my Dell monitor that has a powered USB-C hub.

One more thing: I found other externally powered USB devices won’t work for testing. It has to specifically be a self-powered USB Hub.

1 Like

Question about pmos performance. I have it on one of my devices and i find that its incredibly slow, especially when rendering webpages in firefox. Are people using the web browser for their HA dashboards or some other way of doing it? Also im curious about the camera feature. You mentioned its highly unlikely it will work, but im curious how its able to work with android flavors but not on linux? TIA. Keep up the good work!

Hardware Acceleration in Firefox is currently broken: Firefox graphics broken (hardware acceleation) (#2332) · Issues · postmarketOS / pmaports · GitLab
Also, this device only has 2 GB of RAM.

The camera driver on Android is done in user space and it is a proprietary binary. There are no sources for it. The driver contains a bunch of register writes to initialize and control the camera. These would have to be reverse engineered or otherwise figured out (for example, by using a datasheet). Given that the model number for the camera sensor does not yield any usable results I’m thinking it’s unlikely we’ll be able to support it on Linux.
And even if, all the processing that Qualcomm builds into its libchromatix drivers would be missing, so the images would not look very good.