Fix for new raspberry pi os not having hardware section in /proc/cpuinfo

This commit is contained in:
PM Kuipers 2024-05-06 13:34:52 +02:00
parent 30d067006d
commit 1f1333d5a6
2 changed files with 11 additions and 9 deletions

View File

@ -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])

View File

@ -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);