Windows-Surface als Smarthome-Display

Aus TippvomTibb
Zur Navigation springen Zur Suche springen

Allgemeines

Die beiden WindowsRT Surface Displays waren einfach zu schade, um Sie nur rumliegen zu haben.

Ich bin nicht mehr sicher was ich auf dieser Seite ergaenzen wollte. Die Hauptseite ist hier

WLAN Problem

[    9.704201] mwifiex_sdio mmc2:0001:1: info: FW download over, size 533976 bytes
[    9.945765] mwifiex_sdio mmc2:0001:1: WLAN FW is active
[   10.210971] mwifiex_sdio mmc2:0001:1: CMD_RESP: cmd 0x242 error, result=0x2
[   10.211047] mwifiex_sdio mmc2:0001:1: mwifiex_process_cmdresp: cmd 0x242 failed during       initialization
[   10.535490] mwifiex_sdio mmc2:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (14.68.29.p59) 
[   10.535524] mwifiex_sdio mmc2:0001:1: driver_version = mwifiex 1.0 (14.68.29.p59) 
[   17.295906] mwifiex_sdio mmc2:0001:1: info: trying to associate to bssid 24:5a:4c:22:8a:8f
[   17.324014] mwifiex_sdio mmc2:0001:1: info: associated to bssid 24:5a:4c:22:8a:8f successfully
[   17.354089] mwifiex_sdio mmc2:0001:1: CMD_RESP: cmd 0x23f error, result=0x2


Das Problem ist hier und hiergeloest.

Das Modul mwifiex_sdio muss noch mit modprobe geladen werden.

sudo modprobe mwifiex_sdio

Nicht wundern, es ist scheinbar standardmaeszig kein Modul geladen.

Module                  Size  Used by
mwifiex_sdio           28672  0
mwifiex               237568  1 mwifiex_sdio

Sobald das Modul geladen ist kann man das WLAN benutzen.

Feste IP

Ab Bookworm wird nicht mehr etc/dhcp.conf zu hinterlegen genommen, sondern jetzt dient dazu der NetworkManager fuer die Aufgaben rund ums Netzwerk.

sudo systemctl restart NetworkManager 


WLAN/LAN Management

nmcli device wifi list
nmcli device show
nmcli connection show

Surfstick

Ich habe keinen Surfstick in den Display.

sudo systemctl disable --now ModemManager

Reboot

Ein Reboot funktioniert nicht wirklich, da kein ACPI, kein BIOS sondern ueber die Firmware des SoC Tegra3.

Das Surface faehrt zwar runter bleibt aber beim Poweroff haengen.

Wenn keine Bildschirmanzeige da ist, die auf das Warten auf den Powerknopf hinweist, dann gibt das Beruehren des Windowsknopfes ein Vibrationssignal von sich.

Derzeit kenne ich nur die Loesung 5 Sekunden Powerknopf festhalten und wieder kurz druecken.

Autostart

Mist. Nach dem Wechsel auf Labwc (Wayland) geht mein Autostart nicht mehr.

echo $XDG_SESSION_TYPE

Mit

sudo raspi-config

erhaelt man unter Punkt 6 eine Umschaltmoeglichkeit.

X11 Openbox window manager with X11 backend Wayfire Wayfire window manager with Wayland backend Labwc Labwc window manager with Wayland backend

mkdir -p ~/.config/labwc
nano ~/.config/labwc/autostart

Windows-Taste

Um die Windowstaste (Super_L) anzupassen, aendert man einfach nur den Eintrag <command> in /etc/xdg/openbox/lxde-pi-rc.xml. [1]

Standrardmaeszig steht dort 'lxpanelctl menu', was aber nur das Startmenu oeffnet. Ich moechte aber, dass bei jeder Button-Aktivitaet das Panel sichtbar und wieder unsichtbar wird.

Das Startmenu bekomme ich dann ja durch Klicken auf die Himbeere.

In Raspbian 12 Bookworm laeuft das lxpanel mit dem Profil LXDE-pi.

Die passende panel-Config-Datei befindet sich in .config/lxpanel/LXDE-pi/panels/.

In der Panel-Datei muss man also den Eintrag autohide zwischen 0 und 1 wechseln und lxpanelctl restart ausfuehren.

Also die Idee ist wie folgt.

An den Super_L wird ein Bash-Script gebunden, welches den autohide Eintrag toggelt und das Panel neu startet.

Das Toggeln uebernimmt sed.

sed -i 's/^autohide=1$/autohide=0/' .config/lxpanel/LXDE-pi/panels/panel


Ich habe mal meine Testzeilen dringelassen.

#!/bin/bash
configfile="/home/chris/.config/lxpanel/LXDE-pi/panels/panel"
sed="/usr/bin/sed"

$sed -i 's/^autohide=1$/autohide=0/;ta;q1;:a' $configfile
retval="$?"
#echo "1->0 $retval"
#if [ $retval -ne 1 ]; then
#    echo "exit"
#    exit 0
#fi
[ $retval -ne 1 ] && exit
$sed -i 's/^autohide=0$/autohide=1/;ta;q2;:a' $configfile
#retval="$?"
#echo "0->1 $retval"


DTB Datei

DTB = Device Tree Binary

In dieser Datei ist die Hardwarestruktur des PI o.ä. codiert. Diese Datei ist binaer und somit nicht einfach lesbar. Hierzu schreibt Jeff Geerling:

How to customize the dtb (device tree binary) on the Raspberry Pi November 17, 2023

Every so often, when you're debugging weird hardware issues on SBCs like the Raspberry Pi, it's useful to get way down into the guts of how the Pi represents its hardware to Linux.

And the Linux kernel uses a method called Device Tree overlays to do it. On the Pi 5 (and other Pis), these overlays are stored as .dtb files inside the /boot/firmware directory, and there's an overlay for every major Raspberry Pi hardware model.

I've had to modify the dtb files in the past to increase the PCIe BAR space for early GPU testing on the Compute Module 4. And recently I've had to mess with how the PCIe address space is set up for testing certain devices on the Raspberry Pi 5.

The problem is, you can't just hand-edit a .dtb file—they're in a format readable only by the Linux kernel. You have to decompile the .dtb file to a .dts (source) file, edit it, then recompile it to a .dtb.

As an example, I needed to change the msi-parent for the Pi 5's external PCIe connector to allow for full MSI-X support for a Google Coral TPU (work on getting it to work is ongoing):

  1. Back up the current dtb

sudo cp /boot/firmware/bcm2712-rpi-5-b.dtb /boot/firmware/bcm2712-rpi-5-b.dtb.bak

  1. Decompile the current dtb (ignore warnings)

dtc -I dtb -O dts /boot/firmware/bcm2712-rpi-5-b.dtb -o ~/test.dts

  1. Edit the file

nano ~/test.dts

  1. Change the line: msi-parent = <0x2f>; (under `pcie@110000`)
  2. To: msi-parent = <0x66>;
  3. Then save the file.
  1. Recompile the dtb and move it back to the firmware directory

dtc -I dts -O dtb ~/test.dts -o ~/test.dtb sudo mv ~/test.dtb /boot/firmware/bcm2712-rpi-5-b.dtb

Check out elinux's Device Tree Reference for more useful background info.

I consider myself an absolute noob at Device Trees in Linux... but I've now done this enough times that I'd like a simple reference and most of the ones out there assume you are an expert-level wizard in all things Linux/hardware!