[1ed414]: sdcard / lejosfs / etc / init.d / ev3init.sh Maximize Restore History

Download this file

ev3init.sh    44 lines (36 with data), 1.2 kB

 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
#!/bin/sh
cat /home/root/lejos/bin/images/startup.ev3i > /dev/fb
bluetoothd -n > /dev/null 2>&1 &
echo "Initialize Bluetooth..."
#Read Hw version from eeprom and save it in HwId file
Hw1=$(eeprog /dev/i2c-1 0x50 -16 -r 0x3F00:1 -x -f -q)
Hw2=$(eeprog /dev/i2c-1 0x50 -16 -r 0x3F01:1 -x -f -q)
Hw1=0x${Hw1//3f00| /}
Hw2=0x${Hw2//3f01| /}
Hw1=${Hw1//[[:space:]]}
Hw2=${Hw2//[[:space:]]}
if [ $((Hw1 ^ Hw2)) == 255 ]; then
echo -e "HwId="${Hw1//0x/} > /var/volatile/HwId
adr=$(eeprog /dev/i2c-1 0x50 -16 -r 0x3F06:6 -x -f -q)
STRING=${adr//3f06| /}
else
echo -e "HwId=03" > /var/volatile/HwId
adr=$(eeprog /dev/i2c-1 0x50 -16 -r 0x3F00:6 -x -f -q)
STRING=${adr//3f00| /}
fi
#----------------------------------------
# OPTIMIZE THIS SECTION
#Save Bluetooth address in file
echo -e ${STRING//[[:space:]]} > /var/volatile/BTser
#Remove first 2 spaces
STRING=${STRING/ /}
#Replace spaces with :
STRING=${STRING// /:}
#Remove last character
STRING="${STRING%?}"
#---------------------------------------------
#Invert string
STRING=`echo $STRING | sed "s/\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\)/\6:\5:\4:\3:\2:\1/"`
sleep 2
hciattach /dev/ttyS2 texas 2000000 "flow" "nosleep" $STRING
sdptool add SP