Skip to content

Commit

Permalink
add info header to the script files
Browse files Browse the repository at this point in the history
  • Loading branch information
isra67 committed Feb 23, 2017
1 parent d6048d2 commit 23bb9ad
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 54 deletions.
38 changes: 0 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,3 @@ Intercom - Indoor part
RASPBERRY Pi 2 Model B:
- Python Kivy
- omxplayer


Install:
- add root
- install kivy:
https://kivy.org/docs/installation/installation-rpi.html
- install PJSIP:
!!! netreba FFMPEG ani ASTERISK !!!
apt-get install -y alsa-base alsa-utils alsa-tools libasound-dev
apt-get install -y libasound2-plugins libasound2 libasound2-dev mpg321

wget http://www.libsdl.org/release/SDL2-2.0.5.tar.gz
tar xvzf SDL2-2.0.5.tar.gz
./autogen
./configure
make -j4 && make install

http://www.pjsip.org/download.htm:
wget http://www.pjsip.org/release/2.6/pjproject-2.6.tar.bz2
tar xvf pjproject-2.6.tar.bz2
cd pjproject-2.6
./configure --disable-floating-point --disable-speex-aec --disable-large-filter --disable-l16-codec --disable-ilbc-codec --disable-g722-codec --disable-g7221-codec --disable-ffmpeg --disable-v4l2 --disable-openh264 --disable-video
make dep -i && make -j4 -i (&& make install)




USB audio:
- upravit:
(http://raspberrypi.stackexchange.com/questions/40831/how-do-i-configure-my-sound-for-jasper-on-raspbian-jessie)
/etc/modprobe.d/alsa-base.conf

# This sets the index value of the cards but doesn't reorder.
options snd_usb_audio index=0
options snd_bcm2835 index=1

# Does the reordering.
options snd slots=snd_usb_audio,snd_bcm2835
7 changes: 6 additions & 1 deletion backlight.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

# #################################################################################
#
# Indoor system script
# switch on|off screen backlight
#
# #################################################################################

#echo 0 > /sys/class/backlight/rpi_backlight/bl_power
echo $1 > /sys/class/backlight/rpi_backlight/bl_power
7 changes: 7 additions & 0 deletions brightness.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

# #################################################################################
#
# Indoor system script
# set screen brightness
#
# #################################################################################

echo $1 > /sys/class/backlight/rpi_backlight/brightness
42 changes: 42 additions & 0 deletions clrscr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# #################################################################################
#
# Indoor system script
# clear screen
#
# #################################################################################

echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo " #####################################################################################" > /dev/tty1
echo " # #" > /dev/tty1
echo " # I N D O O R #" > /dev/tty1
echo " # #" > /dev/tty1
echo " # . . . #" > /dev/tty1
echo " # Alphatech 2017 #" > /dev/tty1
echo " #####################################################################################" > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
echo > /dev/tty1
#clear > /dev/tty1
#setterm -cursor off > /dev/tty1
7 changes: 7 additions & 0 deletions dbuscntrl.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

# #################################################################################
#
# Indoor system script
# omxplayer dbus-control
#
# #################################################################################

#set -x

OMXPLAYER_DBUS_ADDR="/tmp/omxplayerdbus.${USER:-root}"
Expand Down
7 changes: 7 additions & 0 deletions hid_init.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# #################################################################################
#
# Indoor system script
# set USB audio defaults
#
# #################################################################################

HID=./hid
OUTPUT_CONTROL=0x1019
EQ_GAIN_LOW=0x10D7
Expand Down
2 changes: 1 addition & 1 deletion indoor.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ btn_door_1 = Open Door 1
btn_door_2 = Open Door 2
screen_mode = 4
btn_call_answer = Answer Call
btn_docall = Do Call :-)
btn_docall = Do Call

[common]
server_ip_address_1 = 192.168.1.250
Expand Down
7 changes: 4 additions & 3 deletions pjindoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def callback_btn_docall(self):

def gotResponse(self, req, results):
"relay result"
Logger.debug('Relay: req=' + req + ' res=' + results)
Logger.debug('Relay: req=' + str(req) + ' res=' + results)


def setRelayRQ(self, relay):
Expand All @@ -767,7 +767,7 @@ def setRelayRQ(self, relay):

def callback_btn_door1(self):
"door 1 button"
Loger.debug(BUTTON_DOOR_1)
Logger.debug(BUTTON_DOOR_1+':')
self.setRelayRQ('relay1')


Expand Down Expand Up @@ -1303,7 +1303,7 @@ def on_config_change(self, cfg, section, key, value):
# self.myAlertListBox('Log history', recent_log)
elif token == ('service', 'app_rst'):
if 'button_app_rst' == value:
self.myAlertBox('WARNING', 'Application is going to restart!', self.popupClosed)
self.myAlertBox('WARNING', 'Application is going to restart!', self.popupClosed, False)
elif token == ('system', 'inet'):
self.changeInet = True
elif 'gui' in section or token == ('sip', 'sip_mode'):
Expand Down Expand Up @@ -1412,4 +1412,5 @@ def myAlertListBox(self, titl, ldata, cb=None, ad=True):
# ###############################################################

if __name__ == '__main__':
send_command('./clrscr.sh')
IndoorApp().run()
12 changes: 7 additions & 5 deletions setipaddress.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#! /bin/bash

# #################################################################################
#
# Indoor system script
# set IP address (network settings)
#
# #################################################################################

IFILE="/etc/network/interfaces"
DFILE="/etc/resolv.conf"
DNS=`cat $DFILE | grep "nameserver $7" | awk 'NR==1 {print $2}'`

#echo $1 $2 $3 $4 $5

# file backup
cat $IFILE > "$IFILE.backup"
cat $DFILE > "$DFILE.backup"
Expand Down Expand Up @@ -35,17 +40,14 @@ else
echo "iface eth0 inet static" >> $IFILE
echo "address $2" >> $IFILE
echo "netmask $3" >> $IFILE
# echo "broadcast $4" >> $IFILE
echo "gateway $4" >> $IFILE
# echo "network $6" >> $IFILE

# DNS setting
if [ $5 = "" ]; then
echo "nic"
else
echo "nameserver $5" > $DFILE
fi

fi

/etc/init.d/networking restart
8 changes: 8 additions & 0 deletions setvolume.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#! /bin/bash

# #################################################################################
#
# Indoor system script
# set audio volume
#
# #################################################################################

VOLUMEID=`amixer controls | grep "PCM Playback Volume" | sed -e 's/,/\n/g' | awk 'NR==1 {print $1}' | sed 's/numid=//'`

amixer cset numid=$VOLUMEID $1%
Expand Down
3 changes: 0 additions & 3 deletions share/indoor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ pustaj() {

sleep 1

clear > /dev/tty1
setterm -cursor off > /dev/tty1

## working dir
cd /root/indoorpy
./hid_init.sh
Expand Down
8 changes: 8 additions & 0 deletions sysinfo.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#! /bin/bash

# #################################################################################
#
# Indoor system script
# get basic system info: date, RPi S/N, network settings
#
# #################################################################################

SERIAL=`cat /proc/cpuinfo | grep -i '^serial' | grep -Eo '[a-fA-F0-9]{16}$'`
DAT=$(date "+%Y-%m-%d")
IP_ADDR=`hostname -I`
Expand Down
11 changes: 8 additions & 3 deletions unblank.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

#cat /sys/module/kernel/parameters/consoleblank
echo 0 >/sys/class/graphics/fb0/blank
#cat /sys/module/kernel/parameters/consoleblank
# #################################################################################
#
# Indoor system script
# unblank screen
#
# #################################################################################

echo 0 > /sys/class/graphics/fb0/blank
9 changes: 9 additions & 0 deletions volumeinfo.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#! /bin/bash

# #################################################################################
#
# Indoor system script
# get USB Audio devide ID, volume, min&max value
#
# #################################################################################

VOLUMEID=`amixer controls | grep "PCM Playback Volume" | sed -e 's/,/\n/g' | awk 'NR==1 {print $1}' | sed 's/numid=//'`
VOLUMEVAL=`amixer cget numid=$VOLUMEID | grep ": values" | sed 's/ : values=//' | sed -e 's/,/\n/g' | awk 'NR==1 {print $1}'`
MINVAL=`amixer cget numid=$VOLUMEID | grep "access" | sed -e 's/,/\n/g' | awk 'NR==4 {print $1}' | sed 's/min=//'`
MAXVAL=`amixer cget numid=$VOLUMEID | grep "access" | sed -e 's/,/\n/g' | awk 'NR==5 {print $1}' | sed 's/max=//'`

echo $VOLUMEID $VOLUMEVAL $MINVAL $MAXVAL

0 comments on commit 23bb9ad

Please sign in to comment.