From 901e24be19bb11a8fe814e56d07acf03f89299d4 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 17 Apr 2018 23:14:22 +0000
Subject: xymon: update xymon-gputemp.sh for 710 max temp

---
 abs/core/xymon/PKGBUILD         |  7 +++++--
 abs/core/xymon/logfetch.c.patch | 10 ++++++++++
 abs/core/xymon/xymon-gputemp.sh | 24 +++++++++++++++---------
 3 files changed, 30 insertions(+), 11 deletions(-)
 create mode 100644 abs/core/xymon/logfetch.c.patch

diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
index 759241b..b06cc43 100755
--- a/abs/core/xymon/PKGBUILD
+++ b/abs/core/xymon/PKGBUILD
@@ -1,7 +1,7 @@
 pkgbase=xymon
 pkgname=('xymonserver' 'xymonclient')
 pkgver=4.3.28
-pkgrel=5
+pkgrel=6
 pkgdesc="Xymon is a system for monitoring of hosts and networks"
 license=('GPL')
 arch=('i686' 'x86_64')
@@ -23,6 +23,7 @@ source=("https://downloads.sourceforge.net/project/xymon/Xymon/$pkgver/$pkgbase-
         'hobbitstorage.py'
         'hosts.cfg.patch'
         'log_list.sh'
+        'logfetch.c.patch'
         'led_themes.tar.gz'
         'login_notify.sh'
         'logrotate-server.xymon'
@@ -43,6 +44,7 @@ install=xymon-server.install
 
 build() {
     cd ${srcdir}/xymon-$pkgver
+    patch -p2 < $srcdir/logfetch.c.patch
     ENABLESSL=n \
     ENABLELDAP=n \
     ENABLELDAPSSL=n \
@@ -194,13 +196,14 @@ md5sums=('14501ab2cfce9a332c1590543dfcbd0f'
          'b2f98ac0df013332deedc1efae0a270d'
          '606f535a49f32b35802ed9d46bd7d068'
          '98e9242ae346f729b14cb195786571f2'
+         '7d8689cc88ccca5bf7b2b454a909db72'
          'c7178bbf384bbe86c318b60fef6faf10'
          '22d4c9065fd959efe82f121dcb511305'
          'b4e8641e97e6b689dbc634af785e6799'
          'e2844513e2c92e8b5084818f3b2a478d'
          'a19c8c546dcd95049476bb19f9d4e3ae'
          'c60b0d59bb39505ee3d62c6dd65429c5'
-         '6452d891d88bb46d07bcf7790a523ad0'
+         'd4710f9aaa5aef0c9d0a26fa7d94450f'
          'b49e7de696c1a0678ad198bab926266c'
          'e071c387deac6b896b20db19903b7794'
          '1a00c0b9b9b1a37f1513fa8489ce9d31'
diff --git a/abs/core/xymon/logfetch.c.patch b/abs/core/xymon/logfetch.c.patch
new file mode 100644
index 0000000..bc61f00
--- /dev/null
+++ b/abs/core/xymon/logfetch.c.patch
@@ -0,0 +1,10 @@
+--- src/xymon-4.3.28/client/logfetch.c.orig	2018-04-17 23:05:45.429619941 +0000
++++ src/xymon-4.3.28/client/logfetch.c	2018-04-17 23:07:34.895372581 +0000
+@@ -18,6 +18,7 @@
+ #include <sys/stat.h>
+ #include <sys/time.h>
+ #include <stdio.h>
++#include <stdint.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdlib.h>
diff --git a/abs/core/xymon/xymon-gputemp.sh b/abs/core/xymon/xymon-gputemp.sh
index f8af649..db76f78 100644
--- a/abs/core/xymon/xymon-gputemp.sh
+++ b/abs/core/xymon/xymon-gputemp.sh
@@ -17,7 +17,10 @@ if ! test -x /usr/bin/nvidia-smi ; then
 fi
 
 # Use NVidia SMI to determine the model
-gpu_model=`nvidia-smi -L`
+#gpu_model=`nvidia-smi -L`
+# Use lspci to determine the model
+gpu_model=`lspci | grep -i vga | grep -vi non-vga| sort -r | head -n 1 | cut -d: -f3`
+
 if test -z "$gpu_model" ; then
   $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
   Couldn't find nVidia card
@@ -29,24 +32,27 @@ if test -z "$gpu_model" ; then
 fi
 
 # Determine GPU maximum temperature based on GPU model
-if test $(echo $gpu_model | grep -c -i 'GeForce 210') -eq 0 ; then
+if test $(echo $gpu_model | grep -c -i 'GeForce 210') -eq 1 ; then
   # GT 210 maximum GPU temperature is 105 C
   max_temp=105
-elif test $(echo $gpu_model | grep -c -i 'GeForce 220') -eq 0 ; then
+elif test $(echo $gpu_model | grep -c -i 'GeForce 220') -eq 1 ; then
   # GT 220 maximum GPU temperature is 105 C
   max_temp=105
-elif test $(echo $gpu_model | grep -c -i 'GeForce 240') -eq 0 ; then
+elif test $(echo $gpu_model | grep -c -i 'GeForce 240') -eq 1 ; then
   # GT 240 maximum GPU temperature is 105 C
   max_temp=105
-elif test $(echo $gpu_model | grep -c -i 'GeForce 430') -eq 0 ; then
+elif test $(echo $gpu_model | grep -c -i 'GeForce 430') -eq 1 ; then
   # GT 430 maximum GPU temperature is  98 C
   max_temp=98
-elif test $(echo $gpu_model | grep -c -i 'GeForce GTS 450') -eq 0 ; then
+elif test $(echo $gpu_model | grep -c -i 'GeForce GTS 450') -eq 1 ; then
   # GTS 450 maximum GPU temperature is  100 C
   max_temp=100
-elif test $(echo $gpu_model | grep -c -i 'GeForce GT 520') -eq 0 ; then
+elif test $(echo $gpu_model | grep -c -i 'GeForce GT 520') -eq 1 ; then
   # GT 520 maximum GPU temperature is  102 C
   max_temp=102
+elif test $(echo $gpu_model | grep -c -i 'GeForce GT 710') -eq 1 ; then
+  # GT 710 maximum GPU temperature is  95 C
+  max_temp=95
 else
   # Assume 100 is the maximum
   max_temp=100
@@ -72,8 +78,8 @@ if test -x /usr/bin/nvidia-smi ; then
     #`cat /tmp/gputemp.txt`
     #"
     $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date`
-    GPU model is $gpu_model
-    max temp is $max_temp
+    GPU Model -$gpu_model
+    GPU Max Temp (C) - $max_temp
 
     GPUTEMP : $gpu_temp
     "
-- 
cgit v0.12

