From 4a8570387ee816fffac1c16b867b9adff80d2746 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 15 Feb 2014 17:31:03 -0500 Subject: [PATCH] sdcards drive numbering --- main/views.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main/views.py b/main/views.py index 9e79bea..761dfc2 100755 --- a/main/views.py +++ b/main/views.py @@ -210,15 +210,24 @@ def get_disk_rw(): data = pipe.read().strip().split('\n') pipe.close() + rws = [] for i in data: if i.isalpha(): - data = [] pipe = os.popen("cat /proc/diskstats | grep -w '" + i + "'|awk '{print $4, $8}'") rw = pipe.read().strip().split() pipe.close() - data.append([i, rw[0], rw[1]]) - + rws.append([i, rw[0], rw[1]]) + + if not rws: + pipe = os.popen("cat /proc/diskstats | grep -w '" + data[0] + "'|awk '{print $4, $8}'") + rw = pipe.read().strip().split() + pipe.close() + + rws.append([data[0], rw[0], rw[1]]) + + data = rws + except Exception,err: data = str(err)