From ed672deb7447e8c229fa5bfef54189dceb0841a8 Mon Sep 17 00:00:00 2001 From: Fede85 Date: Thu, 20 Jun 2013 13:24:27 +0200 Subject: modified SDclass.begin() check for sd presence and added the Datalogger example --- libraries/Bridge/FileIO.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libraries/Bridge/FileIO.cpp') diff --git a/libraries/Bridge/FileIO.cpp b/libraries/Bridge/FileIO.cpp index c66f937..c49c2b4 100644 --- a/libraries/Bridge/FileIO.cpp +++ b/libraries/Bridge/FileIO.cpp @@ -160,7 +160,13 @@ const char *File::name() { boolean SDClass::begin() { - return true; + Process chksd; + int res = chksd.runShellCommand(F("cat /sys/bus/scsi/drivers/sd/*/block/sda/size")); + if (res == 0) { + if (chksd.peek() != '0') + return true; + } + return false; } File SDClass::open(const char *filename, uint8_t mode) { -- cgit v1.2.3-18-g5258