diff --git a/README.md b/README.md index decd8d7..119a3df 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file diff --git a/backlight.sh b/backlight.sh index f3f2e16..0d3081c 100755 --- a/backlight.sh +++ b/backlight.sh @@ -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 \ No newline at end of file diff --git a/brightness.sh b/brightness.sh index eaf3cd6..04a4cca 100755 --- a/brightness.sh +++ b/brightness.sh @@ -1,3 +1,10 @@ #!/bin/bash +# ################################################################################# +# +# Indoor system script +# set screen brightness +# +# ################################################################################# + echo $1 > /sys/class/backlight/rpi_backlight/brightness \ No newline at end of file diff --git a/clrscr.sh b/clrscr.sh new file mode 100755 index 0000000..ad8677c --- /dev/null +++ b/clrscr.sh @@ -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 diff --git a/dbuscntrl.sh b/dbuscntrl.sh index 731e6d2..00ff72e 100755 --- a/dbuscntrl.sh +++ b/dbuscntrl.sh @@ -1,5 +1,12 @@ #!/bin/bash +# ################################################################################# +# +# Indoor system script +# omxplayer dbus-control +# +# ################################################################################# + #set -x OMXPLAYER_DBUS_ADDR="/tmp/omxplayerdbus.${USER:-root}" diff --git a/hid_init.sh b/hid_init.sh index 3840c67..e6612c8 100755 --- a/hid_init.sh +++ b/hid_init.sh @@ -1,3 +1,10 @@ +# ################################################################################# +# +# Indoor system script +# set USB audio defaults +# +# ################################################################################# + HID=./hid OUTPUT_CONTROL=0x1019 EQ_GAIN_LOW=0x10D7 diff --git a/indoor.ini b/indoor.ini index 4242123..dd854e6 100644 --- a/indoor.ini +++ b/indoor.ini @@ -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 diff --git a/pjindoor.py b/pjindoor.py index b194655..b393474 100644 --- a/pjindoor.py +++ b/pjindoor.py @@ -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): @@ -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') @@ -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'): @@ -1412,4 +1412,5 @@ def myAlertListBox(self, titl, ldata, cb=None, ad=True): # ############################################################### if __name__ == '__main__': + send_command('./clrscr.sh') IndoorApp().run() diff --git a/setipaddress.sh b/setipaddress.sh index ded3ef4..eab19ac 100755 --- a/setipaddress.sh +++ b/setipaddress.sh @@ -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" @@ -35,9 +40,7 @@ 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 @@ -45,7 +48,6 @@ else else echo "nameserver $5" > $DFILE fi - fi /etc/init.d/networking restart diff --git a/setvolume.sh b/setvolume.sh index 2e2fd73..717b2b8 100755 --- a/setvolume.sh +++ b/setvolume.sh @@ -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% diff --git a/share/indoor.sh b/share/indoor.sh index 8c107f7..2856c85 100755 --- a/share/indoor.sh +++ b/share/indoor.sh @@ -16,9 +16,6 @@ pustaj() { sleep 1 -clear > /dev/tty1 -setterm -cursor off > /dev/tty1 - ## working dir cd /root/indoorpy ./hid_init.sh diff --git a/sysinfo.sh b/sysinfo.sh index 8153055..08cb21e 100755 --- a/sysinfo.sh +++ b/sysinfo.sh @@ -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` diff --git a/unblank.sh b/unblank.sh index b558650..aa718cf 100755 --- a/unblank.sh +++ b/unblank.sh @@ -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 diff --git a/volumeinfo.sh b/volumeinfo.sh index 1f5cb27..1cf8b66 100755 --- a/volumeinfo.sh +++ b/volumeinfo.sh @@ -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