diff --git a/azbox/hardware_caps.c b/azbox/hardware_caps.c index 6489378..7b3d90a 100644 --- a/azbox/hardware_caps.c +++ b/azbox/hardware_caps.c @@ -2,7 +2,7 @@ * determine the capabilities of the hardware. * part of libstb-hal * - * (C) 2010-2012 Stefan Seyfried + * (C) 2010-2012,2016 Stefan Seyfried * * License: GPL v2 or later */ @@ -45,6 +45,7 @@ hw_caps_t *get_hwcaps(void) } else strcpy(caps.boxname, "(unknown model)"); + strcpy(caps.boxarch, "mipsel"); return ∩︀ } diff --git a/generic-pc/hardware_caps.c b/generic-pc/hardware_caps.c index 36b2b35..6f76bdc 100644 --- a/generic-pc/hardware_caps.c +++ b/generic-pc/hardware_caps.c @@ -2,24 +2,22 @@ * determine the capabilities of the hardware. * part of libstb-hal * - * (C) 2010-2012 Stefan Seyfried + * (C) 2010-2012,2016 Stefan Seyfried * * License: GPL v2 or later */ -#include -#include -#include #include #include -#include #include +#include static int initialized = 0; static hw_caps_t caps; hw_caps_t *get_hwcaps(void) { + struct utsname u; if (initialized) return ∩︀ @@ -32,6 +30,10 @@ hw_caps_t *get_hwcaps(void) caps.display_xres = 8; strcpy(caps.boxvendor, "Generic"); strcpy(caps.boxname, "PC"); + if (! uname(&u)) + strncpy(caps.boxarch, u.machine, sizeof(caps.boxarch)); + else + fprintf(stderr, "%s: uname() failed: %m\n", __func__); return ∩︀ } diff --git a/include/hardware_caps.h b/include/hardware_caps.h index 5966056..6d6b16e 100644 --- a/include/hardware_caps.h +++ b/include/hardware_caps.h @@ -35,6 +35,7 @@ typedef struct hw_caps int display_yres; char boxvendor[64]; char boxname[64]; + char boxarch[64]; } hw_caps_t; hw_caps_t *get_hwcaps(void); diff --git a/libspark/hardware_caps.c b/libspark/hardware_caps.c index e52aaee..3f3b200 100644 --- a/libspark/hardware_caps.c +++ b/libspark/hardware_caps.c @@ -15,6 +15,7 @@ #include #include #include +#include #include @@ -24,6 +25,7 @@ static hw_caps_t caps; hw_caps_t *get_hwcaps(void) { + struct utsname u; if (initialized) return ∩︀ @@ -55,12 +57,18 @@ hw_caps_t *get_hwcaps(void) len = read(fd, buf, sizeof(buf) - 1); close(fd); } + ret = uname(&u); + if (ret == 0) + snprintf(caps.boxarch, sizeof(caps.boxarch), "%s", u.machine); /* even if cmdline failed */ if (len > 0) { buf[len] = 0; char *p = strstr(buf, "STB_ID="); int h0, h1, h2; if (p && sscanf(p, "STB_ID=%x:%x:%x:", &h0, &h1, &h2) == 3) { int sys_id = (h0 << 16) | (h1 << 8) | h2; + /* include processor architecture and boxid bytes in boxarch */ + p[15] = '\0'; + snprintf(caps.boxarch, sizeof(caps.boxarch), "%s %s", u.machine, p); switch (sys_id) { case 0x090003: tmp = "Truman Premier 1+"; diff --git a/libtriple/hardware_caps.c b/libtriple/hardware_caps.c index facb1b1..8190097 100644 --- a/libtriple/hardware_caps.c +++ b/libtriple/hardware_caps.c @@ -2,7 +2,7 @@ * determine the capabilities of the hardware. * part of libstb-hal * - * (C) 2010-2012 Stefan Seyfried + * (C) 2010-2012,2016 Stefan Seyfried * * License: GPL v2 or later */ @@ -21,7 +21,8 @@ static hw_caps_t caps = { .display_xres = 128, .display_yres = 64, .boxvendor = "Armas", - .boxname = "TripleDragon" + .boxname = "TripleDragon", + .boxarch = "ppc405" }; hw_caps_t *get_hwcaps(void) diff --git a/raspi/hardware_caps.c b/raspi/hardware_caps.c index a4f4a3f..d04d836 100644 --- a/raspi/hardware_caps.c +++ b/raspi/hardware_caps.c @@ -2,24 +2,23 @@ * determine the capabilities of the hardware. * part of libstb-hal * - * (C) 2010-2013 Stefan Seyfried + * (C) 2010-2013,2016 Stefan Seyfried * * License: GPL v2 or later */ -#include -#include -#include #include #include -#include #include +#include +#include static int initialized = 0; static hw_caps_t caps; hw_caps_t *get_hwcaps(void) { + struct utsname u; if (initialized) return ∩︀ @@ -32,6 +31,10 @@ hw_caps_t *get_hwcaps(void) caps.display_xres = 8; strcpy(caps.boxvendor, "Raspberry"); strcpy(caps.boxname, "Pi"); + if (! uname(&u)) + strncpy(caps.boxarch, u.machine, sizeof(caps.boxarch)); + else + fprintf(stderr, "%s: uname() failed: %m\n", __func__); return ∩︀ }