#!/bin/sh # start pigpiod daemon pigpiod -t 0 -f -l -s 10 # wait for pigpiod to initialize - indicated by 'pigs t' exit code of zero count=10 # approx time limit in seconds while ! pigs t >/dev/null 2>&1 ; do if [ $((count--)) -le 0 ]; then printf "\npigpiod failed to initialize within time limit\n" exit 1 fi # printf "\nWaiting for pigpiod to initialize\n" sleep 1 done printf "\npigpiod is running\n" # load uinput module - required to be able to send keystrokes # then set the permission to group writable, so you don't need to run sbpd with root permissions sudo modprobe uinput sudo chmod g+w /dev/uinput # The full list of Jivelite key commands can be found here: # https://github.com/ralph-irving/tcz-lirc/blob/master/jivekeys.csv # button 1 # button-section, defines the GPIO and key-commands SW1=16 # GPIO (BCM, not Board) SH1=KEY:KEY_1 # key-command for SHORT press (here: preset 1) LO1=KEY:KEY_Q # key-command for LONG press (here: power) LMS1=300 # milliseconds for long press # button 2 SW2=26 SH2=KEY:KEY_2 # key-command for SHORT press (here: preset 2) LO2=KEY:KEY_LEFT # key-command for LONG press (here: key left) LMS2=300 # button 3 SW3=27 SH3=KEY:KEY_3 # key-command for SHORT press (here: preset 3) LO3=KEY:KEY_RIGHT # key-command for LONG press (here: key right) LMS3=300 # button 4 SW4=12 SH4=KEY:KEY_4 # key-command for SHORT press (here: preset 4) LO4=KEY:KEY_H # key-command for LONG press (here: go_home) LMS4=300 # button rotary 1 SW5=5 SH5=KEY:KEY_SPACE # key-command for SHORT press(play/pause) LO5=KEY:KEY_LEFTBRACE # key-command for LONG press(special menu) LMS5=250 # button rotary 2 SW6=17 SH6=KEY:KEY_ENTER # key-command for SHORT press(enter, OK) LO6=KEY:KEY_ESC # key-command for LONG press(back) LMS6=250 #CMD="sbpd -v -f /home/tc/sbpd_commands.cfg \ #CMD="sbpd -v \ #b,$SW1,$SH1,2,0,$LO1,$LMS1 \ # b=button, $SW1=switchnumber of button-section #b,$SW2,$SH2,2,0,$LO2,$LMS2 \ #b,$SW3,$SH3,2,0,$LO3,$LMS3 \ #b,$SW4,$SH4,2,0,$LO4,$LMS4 \ #b,$SW5,$SH5,2,0,$LO5,$LMS5 \ #b,$SW6,$SH6,2,0,$LO6,$LMS6 \ #e,13,6,VOLU,1 \ # e=encoder, 13 and 6 are GPIO #e,24,23,KEY:KEY_DOWN-KEY_UP,4 " # e=encoder, 24 and 23 are GPIO CMD="sbpd -v \ b,$SW1,$SH1,2,0,$LO1,$LMS1 \ b,$SW2,$SH2,2,0,$LO2,$LMS2 \ b,$SW3,$SH3,2,0,$LO3,$LMS3 \ b,$SW4,$SH4,2,0,$LO4,$LMS4 \ b,$SW5,$SH5,2,0,$LO5,$LMS5 \ b,$SW6,$SH6,2,0,$LO6,$LMS6 \ e,13,6,VOLU,1 \ e,24,23,KEY:KEY_DOWN-KEY_UP,4 " echo $CMD $CMD > /dev/null 2>&1 & #$CMD &