From 1f1333d5a68f0f6da7616e7a3907cc2adaa14956 Mon Sep 17 00:00:00 2001 From: PM Kuipers Date: Mon, 6 May 2024 13:34:52 +0200 Subject: [PATCH] Fix for new raspberry pi os not having hardware section in /proc/cpuinfo --- configure.ac | 2 +- src/gpio/dma.cpp | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 1100de4..22da9ae 100755 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([MediaCore HID Server], [4.2.1], [bugs@miqra.nl], [mediacore-hid], [http://www.miqra.nl/]) +AC_INIT([MediaCore HID Server], [4.2.2], [bugs@miqra.nl], [mediacore-hid], [http://www.miqra.nl/]) AC_PREREQ([2.59]) AM_INIT_AUTOMAKE([1.11 no-define foreign subdir-objects]) AC_CONFIG_HEADERS([config.hpp]) diff --git a/src/gpio/dma.cpp b/src/gpio/dma.cpp index 23d663d..531fb5a 100644 --- a/src/gpio/dma.cpp +++ b/src/gpio/dma.cpp @@ -509,17 +509,19 @@ void get_model_and_revision(DmaHardware &hw) { fclose(fp); if (modelstr[0] == '\0') - fatal("rpio-pwm: No 'Hardware' record in /proc/cpuinfo\n"); + { + // If no hardware string was found, assume model 2 board - since rpi1 is deprecated anyway + hw.board_model = 2; + } else if (strstr(modelstr, "BCM2708")) { + hw.board_model = 1; + } else { + // Assume model 2 board since rpi1 is deprecated anyway + hw.board_model = 2; + } + if (revstr[0] == '\0') fatal("rpio-pwm: No 'Revision' record in /proc/cpuinfo\n"); - if (strstr(modelstr, "BCM2708")) - hw.board_model = 1; - else if (strstr(modelstr, "BCM2709") || strstr(modelstr, "BCM2835") || strstr(modelstr, "BCM2711")) - hw.board_model = 2; - else - fatal("rpio-pwm: Cannot parse the hardware name string\n"); - /* Revisions documented at http://elinux.org/RPi_HardwareHistory */ ptr = revstr + strlen(revstr) - 3; board_revision = strtol(ptr, &end, 16);