From 62836e3f07e2f5e1a49d0d426104ab3ee288448e Mon Sep 17 00:00:00 2001 From: procount Date: Tue, 3 Nov 2020 18:46:15 +0000 Subject: [PATCH] Auto display switching works on HDMI0/1, DSI. Need to create patch. dual switching Fix type in kernelconfig7l Set max_framebuffers=2 Add con2fbmap components --- README.md | 6 ++ README_PINN.md | 5 +- buildroot/.config | 3 +- buildroot/kernelconfig-recovery.armv7l | 2 +- buildroot/package/Config.in | 1 + buildroot/package/con2fbmap/Config.in | 7 ++ buildroot/package/con2fbmap/con2fbmap.mk | 25 +++++++ buildroot/package/recovery/init | 33 +++++++++- .../package/recovery/{.profile => profile} | 0 buildroot/package/recovery/recovery.mk | 2 +- buildroot/package/rpi-firmware/config.txt | 1 + changes.md | 6 ++ con2fbmap/Makefile | 10 +++ con2fbmap/con2fbmap.1 | 29 ++++++++ con2fbmap/con2fbmap.c | 66 +++++++++++++++++++ history.md | 6 ++ recovery/config.h | 2 +- 17 files changed, 196 insertions(+), 8 deletions(-) create mode 100644 buildroot/package/con2fbmap/Config.in create mode 100644 buildroot/package/con2fbmap/con2fbmap.mk rename buildroot/package/recovery/{.profile => profile} (100%) create mode 100644 con2fbmap/Makefile create mode 100644 con2fbmap/con2fbmap.1 create mode 100644 con2fbmap/con2fbmap.c diff --git a/README.md b/README.md index 1b354f24f..5e54fec4a 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,12 @@ Please note that in some cases it may extract the files into a folder, if this i ## Change History +### V3.5.2 + +- **KERNEL** - Fix issue with PI4 8GB models +- **Translations** - Update it translations +- **HDMI** - Automatic switching between HDMI0 and HDMI1 + ### V3.5 - **KERNEL** - Bump firmware & kernel as NOOBS 3.5 for CM4 diff --git a/README_PINN.md b/README_PINN.md index 1443d1556..5c1ed3af8 100644 --- a/README_PINN.md +++ b/README_PINN.md @@ -5,7 +5,7 @@ The latest version of [PINN](http://downloads.sourceforge.net/projects/pinn/pinn-lite.zip) can be downloaded from [sourceforge](http://www.sourceforge.net/projects/pinn). -This README relates to v3.5 +This README relates to v3.5.2 (PINN-lite does not include any operating systems at all. It is more akin to `NOOBS-lite` rather than `NOOBS`. For that reason, the filename that you download is called `pinn-lite.zip`. More recently, `pinn.zip` has also been made available for download which includes versions of Raspbian and LibreELEC.) @@ -345,6 +345,9 @@ Two editors are available in the recovery shell: vi and nano. Only the Tiny vers ### How to change display output modes By default, PINN will output over HDMI at your display’s preferred resolution, even if no HDMI display is connected. If you do not see any output on your HDMI display or are using the composite output, press 1, 2, 3 or 4 on your keyboard to select HDMI preferred mode (1), HDMI safe mode (2), composite PAL mode (3), or composite NTSC mode (4), respectively. +(Note that Composite mode is no longer available by default on the PI4 model) + +From v3.5.2, PINN can automatically detect which of the 2 HDMI ports are connected and switch to using the correct one. If both are connected, it will ue HDMI 0. If the DSI touchscreen is attached, this will take precedence over the 2 HDMI ports. If you don't have a keyboard, you can still change the display mode used by PINN through editing the `recovery.cmdline` file in the root PINN directory prior to first boot and appending the following argument: - `display=` (e.g. `display=1` or `display=3`) diff --git a/buildroot/.config b/buildroot/.config index cbdfcc751..2fff11c24 100644 --- a/buildroot/.config +++ b/buildroot/.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Buildroot 2015.02-git-00125-g50a736e Configuration +# Buildroot 2015.02-git-00001-g354d4c8-dirty Configuration # BR2_HAVE_DOT_CONFIG=y @@ -347,6 +347,7 @@ BR2_PACKAGE_RECOVERY=y BR2_PACKAGE_REBOOTP=y BR2_PACKAGE_RPI_WIFI_FIRMWARE=y BR2_PACKAGE_PIGZ=y +BR2_PACKAGE_CON2FBMAP=y # # Audio and video applications diff --git a/buildroot/kernelconfig-recovery.armv7l b/buildroot/kernelconfig-recovery.armv7l index 43cae907d..29707d77a 100644 --- a/buildroot/kernelconfig-recovery.armv7l +++ b/buildroot/kernelconfig-recovery.armv7l @@ -191,7 +191,7 @@ CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_PLATFORM=y -CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_HCDis not set CONFIG_USB_DWCOTG=y CONFIG_USB_STORAGE=y CONFIG_USB_UAS=y diff --git a/buildroot/package/Config.in b/buildroot/package/Config.in index dce631ab3..8d3b575be 100644 --- a/buildroot/package/Config.in +++ b/buildroot/package/Config.in @@ -8,6 +8,7 @@ menu "Target packages" source "package/rebootp/Config.in" source "package/rpi-wifi-firmware/Config.in" source "package/pigz/Config.in" + source "package/con2fbmap/Config.in" menu "Audio and video applications" source "package/alsa-utils/Config.in" diff --git a/buildroot/package/con2fbmap/Config.in b/buildroot/package/con2fbmap/Config.in new file mode 100644 index 000000000..7bec38381 --- /dev/null +++ b/buildroot/package/con2fbmap/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_CON2FBMAP + bool "con2fbmap" + ### build dependencies + ### runtime dependencies + help + Change tty console to a different framebuffer device /dev/fbX + diff --git a/buildroot/package/con2fbmap/con2fbmap.mk b/buildroot/package/con2fbmap/con2fbmap.mk new file mode 100644 index 000000000..64818cb9f --- /dev/null +++ b/buildroot/package/con2fbmap/con2fbmap.mk @@ -0,0 +1,25 @@ +############################################################# +# +# con2fbmap system +# +############################################################# + + +CON2FBMAP_VERSION = 1.0 +CON2FBMAP_SITE = $(TOPDIR)/../con2fbmap +CON2FBMAP_SITE_METHOD = local +CON2FBMAP_LICENSE = BSD-3c +CON2FBMAP_LICENSE_FILES = LICENSE.txt +CON2FBMAP_INSTALL_STAGING = NO + +define CON2FBMAP_BUILD_CMDS + cd $(@D) + $(MAKE) -C $(@D) all + $(TARGET_STRIP) $(@D)/con2fbmap +endef + +define CON2FBMAP_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 $(@D)/con2fbmap $(TARGET_DIR)/usr/bin/con2fbmap +endef + +$(eval $(generic-package)) diff --git a/buildroot/package/recovery/init b/buildroot/package/recovery/init index 7e4671135..d412dfccd 100755 --- a/buildroot/package/recovery/init +++ b/buildroot/package/recovery/init @@ -11,8 +11,6 @@ /bin/hostname -F /etc/hostname /bin/mount -t tmpfs tmpfs /tmp -export PS1="\u@\h:\w#" - #modprobe 8188eu modprobe 8192cu @@ -35,6 +33,32 @@ echo 2 >/sys/module/vt/parameters/cur_default /sbin/getty -L tty3 0 vt100 & /sbin/getty -L ttyAMA0 115200 vt100 & +export QWS_DISPLAY="LinuxFb" + +present=`tvservice -l | sed -n -e 's|^Display Number \(.*\),.*$|\1| p'` +for dev in $present; do + fitted=`tvservice -n -v $dev 2>/dev/null` + if [[ "$fitted" != "" ]]; then + case $dev in + 0) #7in touchscreen + export QWS_DISPLAY="LinuxFb:size=800x480:depth=32:0" + break; + ;; + 2) #normal HDMI0 + export QWS_DISPLAY="LinuxFb:/dev/fb0" + break; + ;; + 7) #Secondary HDMI1 + export QWS_DISPLAY="LinuxFb:/dev/fb1" + /usr/bin/con2fbmap 2 1 + /usr/bin/con2fbmap 3 1 + break; + ;; + esac + fi +done + + # Enable syslog /etc/init.d/S01logging start > /dev/null @@ -45,7 +69,7 @@ fi if grep -q vncshare /proc/cmdline; then #VNC server AND framebuffer for screen sharing - export QWS_DISPLAY="VNC:LinuxFB:size=800x480:depth=32:0" + export QWS_DISPLAY="VNC:"$QWS_DISPLAY fi if grep -q ssh /proc/cmdline; then @@ -56,6 +80,9 @@ if grep -q ssh /proc/cmdline; then fi + + + # Mouse acceleration #export QWS_MOUSE_PROTO=:accel=1 diff --git a/buildroot/package/recovery/.profile b/buildroot/package/recovery/profile similarity index 100% rename from buildroot/package/recovery/.profile rename to buildroot/package/recovery/profile diff --git a/buildroot/package/recovery/recovery.mk b/buildroot/package/recovery/recovery.mk index 6c125a983..860c21875 100644 --- a/buildroot/package/recovery/recovery.mk +++ b/buildroot/package/recovery/recovery.mk @@ -42,7 +42,7 @@ define RECOVERY_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/settings $(TARGET_DIR)/mnt2 $(TARGET_DIR)/mnt/os $(TARGET_DIR)/boot # allow mount to automatically mount ntfs drives (cd $(TARGET_DIR)/sbin; ln -sf mount.ntfs-3g mount.ntfs) - $(INSTALL) -m 0755 package/recovery/.profile $(TARGET_DIR)/root/.profile + $(INSTALL) -m 0755 package/recovery/profile $(TARGET_DIR)/root/.profile endef $(eval $(generic-package)) diff --git a/buildroot/package/rpi-firmware/config.txt b/buildroot/package/rpi-firmware/config.txt index 1fc7335d0..dbada7459 100644 --- a/buildroot/package/rpi-firmware/config.txt +++ b/buildroot/package/rpi-firmware/config.txt @@ -5,3 +5,4 @@ fixup_file=fixup_rc.dat [pi4] start_file=recover4.elf fixup_file=fixup4rc.dat +max_framebuffers=2 diff --git a/changes.md b/changes.md index f3dfbf158..1d2f8ec4a 100644 --- a/changes.md +++ b/changes.md @@ -599,4 +599,10 @@ Fixes the incorrect recovery.cmdline bug in v2.5.2. - **Clarify** - Clarify text between replace & reinstall - **Logs** - Add Show Log in Fix up menu +### V3.5.2 + +- **KERNEL** - Fix issue with PI4 8GB models +- **Translations** - Update it translations +- **HDMI** - Automatic switching between HDMI0 and HDMI1 + diff --git a/con2fbmap/Makefile b/con2fbmap/Makefile new file mode 100644 index 000000000..eba94fe09 --- /dev/null +++ b/con2fbmap/Makefile @@ -0,0 +1,10 @@ +CC=$(PWD)/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc + +all: con2fbmap + $(MAKE) $(AM_MAKEFLAGS) con2fbmap + +con2fbmap: con2fbmap.c + $(CC) -static con2fbmap.c -o con2fbmap + + + diff --git a/con2fbmap/con2fbmap.1 b/con2fbmap/con2fbmap.1 new file mode 100644 index 000000000..e0b941693 --- /dev/null +++ b/con2fbmap/con2fbmap.1 @@ -0,0 +1,29 @@ +.TH con2fbmap 1 2006-01-18 2.1 "Linux frame buffer utils" +.SH NAME +con2fbmap \- shows and sets mapping between consoles and framebuffer devices. +.SH SYNOPSIS +.B con2fbmap +.RI console +.RI [ framebuffer ] +.SH DESCRIPTION +.B This documentation is not finished +.PP +.B con2fbmap +is a system utility to show or change the mapping of the consoles to the +frame buffer device. The frame buffer device provides a simple and unique +interface to access different kinds of graphic displays. +.PP +Frame buffer devices are accessed via special device nodes located in the +/dev directory. The naming scheme for these nodes is always +.IR \fBfb < n >, +where +.I n +is the number of the used frame buffer device. +.PP +.SH OPTIONS +The first option must be there, and identify the console on which to work. +If the second option is not set, con2fbmap shows the current mapping of +identified console. If the second argument is given (as a number) con2fbmap +maps the identified console to said framebuffer device. +.TP +Sven LUTHER diff --git a/con2fbmap/con2fbmap.c b/con2fbmap/con2fbmap.c new file mode 100644 index 000000000..4d2c908b4 --- /dev/null +++ b/con2fbmap/con2fbmap.c @@ -0,0 +1,66 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEFAULT_FRAMEBUFFER "/dev/fb0" +#define DEFAULT_FRAMEBUFFER_DEVFS "/dev/fb/0" + +const char *programname; + +void Usage(void) +{ + fprintf(stderr, "\nUsage: %s console [framebuffer]\n\n", programname); + exit(1); +} + +int main(int argc, char *argv[]) +{ + int do_write = 0; + char *fbpath; /* any frame buffer will do */ + int fd; + struct fb_con2fbmap map; + + programname = argv[0]; + switch (argc) { + case 3: + do_write = 1; + map.framebuffer = atoi(argv[2]); + case 2: + map.console = atoi(argv[1]); + break; + default: + Usage(); + } + + if (access("/dev/.devfsd", F_OK) == 0) /* devfs detected */ + fbpath = DEFAULT_FRAMEBUFFER_DEVFS; + else + fbpath = DEFAULT_FRAMEBUFFER; + + if ((fd = open(fbpath, O_RDONLY)) == -1) { + fprintf(stderr, "open %s: %s\n", fbpath, strerror(errno)); + exit(1); + } + if (do_write) { + if (ioctl(fd, FBIOPUT_CON2FBMAP, &map)) { + fprintf(stderr, "ioctl FBIOPUT_CON2FBMAP: %s\n", strerror(errno)); + exit(1); + } + } else { + if (ioctl(fd, FBIOGET_CON2FBMAP, &map)) { + fprintf(stderr, "ioctl FBIOGET_CON2FBMAP: %s\n", strerror(errno)); + exit(1); + } + printf("console %d is mapped to framebuffer %d\n", map.console, + map.framebuffer); + } + close(fd); + exit(0); +} diff --git a/history.md b/history.md index c3c20abcd..c1786f99e 100644 --- a/history.md +++ b/history.md @@ -5,6 +5,12 @@ PINN is a version of the NOOBS Operating System Installer for the Raspberry Pi w ## Change History +### V3.5.2 + +- **KERNEL** - Fix issue with PI4 8GB models +- **Translations** - Update it translations +- **HDMI** - Automatic switching between HDMI0 and HDMI1 + ### V3.5 - **KERNEL** - Bump firmware & kernel as NOOBS 3.5 for CM4 diff --git a/recovery/config.h b/recovery/config.h index df7be31fa..e3d180cf1 100644 --- a/recovery/config.h +++ b/recovery/config.h @@ -2,7 +2,7 @@ #define CONFIG_H /* Version number displayed in the title bar */ -#define VERSION_NUMBER "3.5.1" +#define VERSION_NUMBER "3.5.2" /* Color of the background */ // #define BACKGROUND_COLOR Qt::white