Lenovo ThinkSmart View ROM/OS Development

The ViewAssist dev and I had to collaborate on the timing - I wrote the article, made some PR’s to the ViewAssist code so that everything would work, then as soon as he merged in the 2.0 stuff he let me know so that I could publish the article and it would actually be correct. He’s working to get all of the documentation updated as well, but it’s possible there’s something missing, given I was working against hypothetical directions. You do definitely need 2.0. I’d highly recommend popping into the ViewAssist discord if you’re having issues - dinki is super responsive, I’m frequently in there, and a lot of the issues people have had have been answered there, just not formally documented yet.

Is it coming out of both, or just the device speakers? I intended for it to come out of the TSV speakers, so I never really tested another use case. There’s a PR here though that might do what you want, if you’re also getting audio out of the speakers you do want it to come out of.

Thanks @miniconfig . i have been fairly active in the discord channel and just recently posted a question in there. hopefully he’ll get back to me and i can get this sorted. as far as the audio coming out of both, i’ll have to get back to you. I have the device in my office for testing purposes and the speaker i have configured is in my daughters bedroom upstairs. Once i move it back upstairs i should be able to answer.

I’ve started the process of getting the device included in postmarketOS proper, which should make it much easier for people to create their own custom images:

Once all the things are put in place you should only need to run a pmbootstrap install whenever you want to generate a new image.

I also figured out why the screen doesn’t come back on when it goes to sleep.
It seems that Phosh changed the way it reacts to the volume buttons being pressed. So far these are the only buttons we have on the device that make the OS react in any meaningful way. Phosh seems to have changed the behaviour such that the volume changes without the screen coming on (similar to how it works on most phones), so we can’t rely on these buttons to turn the screen back on. The screen does come back on when I press a button on my connected Bluetooth keyboard. So it’s not an issue with the display driver.

4 Likes

@FelixKa @miniconfig have you ever ran apk update or apk upgrade on your devices? I seem to have done it on one and i am having all sorts of issues with wyoming-satellite not working. I looked at the zeroconf versions and they’re different so i suspect there are a number of other underlying libs that are different as well.

kio-zeroconf-24.12.0-r0
kio-zeroconf-24.08.3-r0 ← this one is on a TSV with no issues.

I might just have to re-flash the one having issues. If i did a factory reset via pmos would that be sufficient?

Here are some logs. Followed @miniconfig tutorial for both devices. This second device is having issues. I did re-flash the device without running upgrade/update so i think theyre the same software wise.

 DEBUG:root:Namespace(mic_uri=None, mic_command='arecord -r 16000 -c 1 -f S16_LE -t raw', mic_command_rate=16000, mic_command_width=2, mic_command_channels=1, mic_command_samples_per_chunk=1024, mic_volume_multiplier=1.0, mic_noise_suppression=0, mic_auto_gain=0, mic_seconds_to_mute_after_awake_wav=0.5, mic_no_mute_during_awake_wav=True, mic_channel_index=None, snd_uri=None, snd_command='aplay -r 22050 -c 1 -f S16_LE -t raw', snd_command_rate=22050, snd_command_width=2, snd_command_channels=1, snd_volume_multiplier=1.5, wake_uri='tcp://127.0.0.1:10400', wake_word_name=[['alexa']], wake_command=None, wake_command_rate=16000, wake_command_width=2, wake_command_channels=1, wake_refractory_seconds=5.0, vad=False, vad_threshold=0.5, vad_trigger_level=1, vad_buffer_seconds=2, vad_wake_word_timeout=5.0, event_uri='tcp://127.0.0.1:10401', startup_command=None, detect_command=None, detection_command=None, transcript_command=None, stt_start_command=None, stt_stop_command=None, synthesize_command=None, tts_start_command=None, tts_stop_command=None, tts_played_command=None, streaming_start_command=None, streaming_stop_command=None, error_command=None, connected_command=None, disconnected_command=None, timer_started_command=None, timer_updated_command=None, timer_cancelled_command=None, timer_finished_command=None, awake_wav='/home/pmos/wyoming-satellite/sounds/awake.wav', done_wav='/home/pmos/wyoming-satellite/sounds/done.wav', timer_finished_wav=None, timer_finished_wav_repeat=(1, 0), uri='tcp://0.0.0.0:10700', name='Parents Tablet', area=None, no_zeroconf=False, zeroconf_name=None, zeroconf_host=None, debug_recording_dir=None, debug=True, log_format='[%(asctime)s] %(levelname)s:%(name)s:%(message)s')
[2024-12-27 14:42:46,236] INFO:root:Ready
[2024-12-27 14:42:46,496] DEBUG:root:Detected IP: 192.168.1.13
[2024-12-27 14:42:46,859] DEBUG:root:Zeroconf discovery enabled (name=be931dace3ff, host=None)
[2024-12-27 14:42:46,865] DEBUG:root:Connecting to mic service: ['arecord', '-r', '16000', '-c', '1', '-f', 'S16_LE', '-t', 'raw']
[2024-12-27 14:42:46,866] DEBUG:root:Connecting to snd service: ['aplay', '-r', '22050', '-c', '1', '-f', 'S16_LE', '-t', 'raw']
[2024-12-27 14:42:46,867] DEBUG:root:Connecting to wake service: tcp://127.0.0.1:10400
[2024-12-27 14:42:46,867] DEBUG:root:Connecting to event service: tcp://127.0.0.1:10401
[2024-12-27 14:42:46,868] INFO:root:Connected to services
[2024-12-27 14:42:46,886] ERROR:root:Unexpected error in wake read task
Traceback (most recent call last):
  File "/home/pmos/wyoming-satellite/wyoming_satellite/satellite.py", line 738, in _wake_task_proc
    await wake_client.connect()
  File "/home/pmos/wyoming-satellite/.venv/lib/python3.12/site-packages/wyoming/client.py", line 73, in connect
    self._reader, self._writer = await asyncio.open_connection(
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 1122, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.12/asyncio/base_events.py", line 1104, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 1007, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.12/asyncio/selector_events.py", line 651, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/selector_events.py", line 691, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 10400)
[2024-12-27 14:42:46,925] DEBUG:root:Connected to mic service
Recording raw data 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
[2024-12-27 14:42:49,927] DEBUG:root:Connected to wake service
[2024-12-27 14:42:51,138] WARNING:root:Failed to get info from wake service

so weird. if i do the zeroconf updates it discovers the device, but the pairing fails. if i remove taht and let it do auto discover, it works. So it seems like i need to configure it the regular way without the zeroconf flags, pair it, and then update the satellite bin to add the zeroconf flags followed by a reboot and then everything is working. weird wild stuff.

I ran apk update && apk upgrade thinking it was a good idea and I think it destabilized my device. Going to just reflash it. I believe the issue for me was that running that command cause the device to run out of disk space.

1 Like

I haven’t tried updating the entire system yet. I thought the python zeroconf library that wyoming-satellite uses wouldn’t be dependent on other underlying system libraries, given it’s described as a “pure python implementation”, but I could be mistaken in that. From your log, it looks like your satellite is disconnecting from the wake word service (that’s the one running on port 10400) and then reconnecting. I’ve definitely seen that happen a few times during startup, but it always seems to reconnect and settle down after everything is started. Does your openwakeword log show anything interesting?

Nah nothing in there. Its been stable now that i zeroconf’d without the params and then once added to HASS, add them back in so the device isnt consistently being autodiscovered.

The kernel stuff (minus the sound driver, working on getting that directly upstream) is now in: arm64: dts: qcom: msm8953: Add device tree for Lenovo ThinkSmart View · msm8953-mainline/linux@961ead7 · GitHub

So with the next release of that kernel package to postmarketOS I will begin the MR process to get the postmarketOS parts in and after that everyone should be able to very easily create their own builds.

10 Likes

Thanks Felix!

Do you have any advice on how manage things like ‘screen on’, ‘screen off’ or ‘screen timeout’ settings remotely (such as from Home Assistant, or MQTT, etc) with PostmarketOS?

Basically, the use case being the screen is off, and is turned on by a motion sensor. Or the screen turning off based on ‘sleep mode’ input boolean being activated.

I tried Googling and ChatGPT, but haven’t been able to find any answers that seem to work.

is anyone seeing issue with Postmarket OS staying connected to WiFi? seems to drop for me after a few minutes. I have a second one with Lineage OS on it right next to it and its WiFi connection is stable so its probably not a coverage issue.

@FelixKa i have been experimenting with immich-kiosk as a dashboard background on my TSV’s running PMOS. I set it up and it works for a few hours, but then the entire device freezes and the screen is unusable. I can ssh in and kill all the services, but it doesnt affect the device. I cant even sudo reboot the device. Have you seen anything similar to that? It makes me think that the chromium instance is having some caching/memory issues even though the immich-kiosk docs say it clears cache every 5 minutes. I cant seem to gather any logs related to this so its just a guess. Any ideas or input would be great.

Edit: I should mention that the dashboard in HA works just fine on other browsers. Just freezes up on PMOS with chromium.

Launching like this:
env MESA_GLES_VERSION_OVERRIDE=2.0 chromium-browser --enable-features=UseOzonePlatform --ozone-platform=wayland --password-store=basic --start-fullscreen --start-maximized --kiosk [ha url]

I found an article about disabling chromium hardware acceleration by passing this in --disable-gpu so im gonna try that out for a bit and see if it survives longer.

I don’t, unfortunately. But we should investigate this. Maybe we can write an integration for HA that can trigger these kinds of things on the device and can also control volume and microphones.

Do you maybe have any logs? Possibly a dmesg or log output from NetworkManager?

That sounds like a memory leak. I haven’t seen this myself, but I also haven’t played around with chromium much. Is this happening on the immich-kiosk for you?

A question form a current Lineage OS user:
Beside other things I use Music Assistant from this device.

So I rely on a good onscreen keyboard for the search that automatically pops up on text input fields of the browser.

Lineage / Android as a mobile system works perfectly here.
Is this possible with Postmarket OS or even already included?

I know it wasn’t easy to solve on many Linux setups (and then only working with specific version / window mangers).

I had initially thought it was a memory leak, but i think its related to how immich-kiosk is doing some stuff with css that require GPU support. Im working with the dev on this and have a beta that im testing out. I am trying to connect the dots all here, but the TVS has a Qualcomm Adreno GPU 650 integrated GPU, and chromium has all sorts of GPU issues of its own. According to this: https://www.notebookcheck.net/Qualcomm-Adreno-650-GPU-Benchmarks-and-Specs.448196.0.html the 650 supports vulkan, and we’re using phosh which is wayland. So then i found this article (albeit archlinux) Chromium - ArchWiki about how setting the --use-angle=vulkan flag for chromium might help with crashes. Im not super familiar with all the gpu stuff and linux so this might all be unrelated, but if the immich-kiosk beta doesnt work, i might fiddle around with these settings and see if they’re any better.

I think it depends on the browser you’re using to launch hass on PMOS. Chromium seems to have issues with an onscreen keyboard but there are hacks to get it to work. FF seems to display a keyboard without issues but suffers from other performance related things.

The TSV has an Adreno 506, not a 650, unfortunately.

Oh, damn. i think i was looking at the TSV Plus.

so been seeing this issue with wifi disconnects for a few months now, its been sitting with just PMOS installed on it on my desk waiting for me to get time to tinker with it, and basically every time I looked at it it was disconnected from WiFi

Between posting the note and now I found the time to deploy a Wyoming Satellite on it, and its been staying connected to WiFi ever since, so not sure what was up with it. Maybe some kind of network sleep it could not recover from.

Might try disabling the Wyoming Satellite and see if the disconnects come back, will post back at that point.