-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathstartBiosemi.sh
executable file
·47 lines (46 loc) · 1.53 KB
/
startBiosemi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /usr/bin/env bash
cd `dirname "${BASH_SOURCE[0]}"`
buffdir="$( pwd )"
echo $buffdir
bciroot=~/output
subject='test';
if [ $# -gt 0 ]; then subject=$1; fi
session=`date +%y%m%d`
if [ $# -gt 1 ]; then session=$2; fi
block=`date +%h%m`_$$
if [ $# -gt 2 ]; then block=$2; fi
outfile=$bciroot/$subject/$session/$block/raw_gdf/$subject.gdf
logfile=$bciroot/$subject/$session/$block.log
echo outfile: $outfile
echo logfile : $logfile
mkdir -p $bciroot/$subject/$session/$block/raw_gdf
touch $logfile
buffexe=$buffdir'/buffer/bin/biosemi2ft';
if [ `uname -s` == 'Linux' ]; then
if [ -r $buffdir/buffer/bin/glnx86/biosemi2ft ]; then
cd $buffdir'/buffer/bin/glnx86';
fi
if [ -r $buffdir/buffer/glnx86/biosemi2ft ]; then
cd $buffdir'/buffer/glnx86';
fi
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:`pwd`
buffexe='./biosemi2ft'
else # Mac
if [ -r $buffdir/buffer/bin/maci/biosemi2ft ]; then
# Argh, annoyingly the driver only works if run in it's own directory
cd $buffdir/buffer/bin/maci
fi
if [ -r $buffdir/buffer/maci/biosemi2ft ]; then
# Argh, annoyingly the driver only works if run in it's own directory
cd $buffdir/buffer/maci
fi
# add exec directory to library load path
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:`pwd`
buffexe='./biosemi2ft';
fi
$buffexe ${buffdir}/biosemi.cfg $outfile > $logfile
if [ $? == 1 ] ; then
echo Couldnt start the AMP driver. Possible reasons
echo 1) The amplifier isnt connected or turned on?
echo 2) You cannot read the USB device. On linux try: sudo ./startBiosemi.sh
fi