aboutsummaryrefslogtreecommitdiff
path: root/libraries/Bridge/FileIO.cpp
diff options
context:
space:
mode:
authorFede85 <f.vanzati@gmail.com>2013-06-20 13:24:27 +0200
committerFede85 <f.vanzati@gmail.com>2013-06-20 13:24:27 +0200
commited672deb7447e8c229fa5bfef54189dceb0841a8 (patch)
treecb37bd09ae201ad91c7f15b8c987d7226988a103 /libraries/Bridge/FileIO.cpp
parent0a594d273d7e6cb7decff31653c116cafed0e096 (diff)
modified SDclass.begin() check for sd presence and added the Datalogger example
Diffstat (limited to 'libraries/Bridge/FileIO.cpp')
-rw-r--r--libraries/Bridge/FileIO.cpp8
1 files changed, 7 insertions, 1 deletions
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) {