RPi-Distro / raspi-config

Configuration tool for the Raspberry Pi
Other
565 stars 207 forks source link

Correct composite/4Kp60 menu option on Pi 4 #179

Closed ghost closed 2 years ago

ghost commented 2 years ago

Some explanation is required for this one, since it alters the flow of the script more than would appear necessary:

raspi-config uses /bin/sh, which on Debian means dash by default, not bash. As such, there is no support for arrays, since dash follows POSIX and there are no arrays in POSIX-only shells. Arrays are needed because otherwise I would need to create more duplication in the display menu code. At present, there are two places which define what the display menu looks like - one for the KMS case including FKMS, and one for the legacy graphics stack. In order to add /4Kp60 to the existing D6 Composite menu item for only Pi 4, I would have needed to duplicate both of these options, which would mean having four slightly different versions of the display menu defined in the script. So instead I use the fact that POSIX shells do support one array - the positional arguments. The menu items are defined once, and each of the four variations of the display menu selects different array elements.

The alternative would have been to simply switch raspi-config to using bash, but I decided this would probably not be welcome.

I have tested all four cases - Pi 4 with KMS, Pi 4 with legacy graphics, non-Pi 4 (on a Pi 3B+) with KMS, non Pi 4 (on a Pi 3B+) with legacy graphics.