PiRogueToolSuite / pirogue-os

OS image for the PiRogue based on Debian 12
https://pts-project.org/
154 stars 6 forks source link

deb12 with hat and fan support #21

Closed grrrrr closed 9 months ago

grrrrr commented 9 months ago

I have inherited a PiRogue with an NGO I am working with, everything is working as expected with v1.0.4

When I try run v2.0.0 I notce that the hat/screen and the fan do not looking to work any more, have support for these components been dropped?

U039b commented 9 months ago

Hi! The latest version of PiRogue OS fully supports the HAT. Have you followed this guide to setup your PiRogue: https://pts-project.org/guides/g1/?

If so, can you please provide the output of the command dpkg -l | grep pirogue?

grrrrr commented 9 months ago

I did a fresh install earlier today and it was following the guide you say but specifically https://pts-project.org/guides/g1/#set-up-the-pirogue section

Hat has light but black screen. and same fan feels not to spin compared to 1.0.4

$ history 
    1  sudo apt update
    2  sudo apt install pirogue-base -y
    3  sudo apt dist-upgrade -y
    4  sudo reboot
    5  clear
    6  history 

pirogue pakages

$ dpkg -l | grep pirogue
ii  frida                                 16.0.19~pirogue1               arm64        dynamic instrumentation toolkit for reverse-engineering
ii  pirogue-ap                            1.1.1                          all          Install PiRogue wi-fi AP configuration
ii  pirogue-base                          1.1.0                          all          Install all PiRogue packages
ii  pirogue-cli                           1.1.0                          all          Provision PiRogue CLI tool
ii  pirogue-dashboard                     1.1.0                          all          Provision PiRogue dashboards
ii  pirogue-eve-collector                 1.1.0                          all          Provision PiRogue Suricata alarm collector
ii  pirogue-flow-inspector                1.1.0                          all          Provision PiRogue DPI
ii  pirogue-hardware-detection            1.1.0                          all          Automatically detect the hardware configuration during PiRogue installation
ii  pirogue-hat                           1.1.0                          all          Install PiRogue's hat requirements
ii  pirogue-maintenance                   1.1.0                          all          Provision PiRogue maintenance scripts
ii  pirogue-screen-st7789-240x240         1.1.0                          all          Provision PiRogue 240x240px ST7789 screen driver
ii  pirogue-tools                         1.1.0                          all          Install all PiRogue additional tools
ii  python3-adb-shell                     0.4.2-1~pirogue2               all          Python implementation of ADB with shell and FileSync functionality
ii  python3-communityid                   1.4-1~pirogue2                 all          Community ID flow hashing
ii  python3-geoip2                        4.5.0-1~pirogue2               all          MaxMind GeoIP2 API
ii  python3-iosbackup                     0.9.923-1~pirogue2             all          reads and extracts files from password-encrypted iOS backups
ii  python3-mvt                           2.4.1-1~pirogue1               all          Mobile Verification Toolkit
ii  python3-nskeyedunarchiver             1.5-1~pirogue2                 all          decodes Apple's NSKeyedArchiver
CyrilBrulebois commented 9 months ago

Hi @grrrrr, and thanks for the issue and the follow-up.

@U039b and I just tracked down the problem to the dist-upgrade step, and @U039b just confirmed that my proposed fix works as intended. If you're curious about the details, you can check this commit: https://github.com/PiRogueToolSuite/deb-packages/commit/fb76cefb87ac26df8e5ad29a03010d5b497e25d2.

An updated package is being published to the repository so that the next dist-upgrade calls no longer trigger this issue.

Meanwhile, you can call the z51 hook manually to refresh the DTBs in the /boot/firmware/ directory, so that the HAT-specific DTBO can be applied successfully:

sudo /etc/kernel/postinst.d/z51-pirogue-hardware-detection
sudo reboot
U039b commented 9 months ago

@grrrrr can you please confirm this fixes the issue on your side?

grrrrr commented 9 months ago

hi @CyrilBrulebois & @U039b thank you for look at this. I am confirming that the updated package has fixed the issue and now both the HAT and fan are working as with older PiRogue versions.

I wonder do you have suggestion for where to look for tweaking the fan control? Compared to with older version where fan spin the whole time, now it spins for maybe 10 seconds, stops for 5 and repeats when idle. I am thinking it is on the edge of some threshold.

U039b commented 9 months ago

The fan is driven by the kernel itself, the threshold is set at 37C in the file /boot/firmware/config.txt. The change of this threshold will be overwritten when upgrading PiRogue packages. Any unwise change in this file could break the hardware support.

CyrilBrulebois commented 9 months ago

Yeah, that's a 2-step process, and admins might be tempted to edit /etc/default/raspi-firmware-custom to have persistent changes to /boot/firmware/config.txt but the current implementation of pirogue-hat's postinst script enforces the presence of a specific line:

ensure_conf_line 'dtoverlay=pirogue-hat,gpiopin=13,temp=37000' /etc/default/raspi-firmware-custom

so editing this configuration file would lead to two (or more) lines with conflicting values in /etc/default/raspi-firmware-custom.

If we wanted to be more flexible, we could probably adjust this part of the postinst to ensure that a line matching the following pattern is present in that file:

^dtoverlay=pirogue-hat,gpiopin=13,temp=(\d+)

with a default of 37000 (m°C). I think it'd be better to have some PiRogue config file store this information somewhere (that can be edited durably by admins), and adjust the postinst to use this value.

In any case, it's probably worth filing separately, and I'll let @U039b comment on whether we'll want that to be configurable.

grrrrr commented 9 months ago

thanks both. I'll close this ticket as both hardware elements are detected again. I can certainly open a ticket for more easily controlled fan if it would be useful?