A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 75 lines 2.9 kB view raw
1###################################################################### 2# __________ __ ___. 3# Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7# \/ \/ \/ \/ \/ 8# 9# * Samsung YP-R0 Rockbox as an application loader * 10# Lorenzo Miori (C) 2011 11###################################################################### 12 13# This is expected to be sourced by the shell, which is then 14# expected to run $MAINFILE 15 16# Check for menu button being pressed. Return immediately to launch the OF 17if [ -e "/dev/r1Button" ] 18then 19 # running on YP-R1 model (volume up button) 20 BTN=$(echo -e -n "\x03") 21 VAL=$(dd if=/dev/r1Button bs=4 count=1) 22else 23 # running on YP-R0 model (menu button) 24 BTN=$(echo -e -n "\x07") 25 VAL=$(dd if=/dev/r0Btn bs=4 count=1) 26fi 27 28if [[ "$VAL" = "$BTN" ]] 29then 30 return 31fi 32 33 34# Blank-Unblank video to get rid of Samsung BootLogo, but turn off backlight before to hide these things :) 35echo -n "0" > /sys/devices/platform/afe.0/bli 36echo -n "1" > /sys/class/graphics/fb0/blank 37echo -n "0" >> /sys/class/graphics/fb0/blank 38 39amixer sset 'Soft Mute' 0 40amixer sset 'Master' 85% 41# These are needed only for the R1. TODO: Move all of this into the firmware 42if [ -e "/usr/local/bin/r1" ] 43then 44 amixer cset numid=7,iface=MIXER,name='Master Power witch' 2 45 amixer cset numid=6,iface=MIXER,name='Master Handfree Switch' 0 46 amixer cset numid=5,iface=MIXER,name='Master Mute' 0 47 amixer cset numid=9,iface=MIXER,name='Master samplerate' 44100 48 amixer cset numid=2,iface=MIXER,name='Master Volume' 28 49 amixer cset numid=1,iface=MIXER,name='PCM PlayBack Switch' 2 50 amixer cset numid=8,iface=MIXER,name='FM Mute' 0 51 amixer cset numid=4,iface=MIXER,name='Capture FM Switch' 0 52 amixer cset numid=3,iface=MIXER,name='Capture Mic Switch' 0 53fi 54 55# We set-up various settings for the cpu governor: default are 56# Every 1,5 s the kernel evaluates if it's the case to down/up clocking the cpu 57echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 58echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load 59echo "150000" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate 60echo "95" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold 61 62# bind these two to the root so that they're writable 63mount --bind /mnt/media0/.rockbox /.rockbox 64mount --bind /mnt/media0/Playlists /Playlists 65 66MAINFILE="/mnt/media0/.rockbox/rockbox" 67# Attempt to copy the executable in the /tmp directory 68# This allows an easier USB Mass Storage Mode to be achieved (file handles) 69cp $MAINFILE /tmp/rockbox 70if [ $? -eq 0 ] 71then 72 MAINFILE="/tmp/rockbox" 73fi 74MAINFILE_ARGV='' 75MAINFILE_REDIRECT='>/dev/null 2>&1'