Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) # -*- shell-script -*-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) # bash completion script for cpupower
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) # Taken from git.git's completion script.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) _cpupower_commands="frequency-info frequency-set idle-info idle-set set info monitor"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) _frequency_info ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 	local flags="-f -w -l -d -p -g -a -s -y -o -m -n --freq --hwfreq --hwlimits --driver --policy --governors --related-cpus --affected-cpus --stats --latency --proc --human --no-rounding"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	local prev="${COMP_WORDS[COMP_CWORD-1]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 	local cur="${COMP_WORDS[COMP_CWORD]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 	case "$prev" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 		frequency-info) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) _frequency_set ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	local flags="-f -g --freq --governor -d --min -u --max -r --related"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	local prev="${COMP_WORDS[COMP_CWORD-1]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	local cur="${COMP_WORDS[COMP_CWORD]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	case "$prev" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 		-f| --freq | -d | --min | -u | --max)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 		if [ -d /sys/devices/system/cpu/cpufreq/ ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 			COMPREPLY=($(compgen -W '$(cat $(ls -d /sys/devices/system/cpu/cpufreq/policy* | head -1)/scaling_available_frequencies)' -- "$cur"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 		fi ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 		-g| --governor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 		if [ -d /sys/devices/system/cpu/cpufreq/ ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 			COMPREPLY=($(compgen -W '$(cat $(ls -d /sys/devices/system/cpu/cpufreq/policy* | head -1)/scaling_available_governors)' -- "$cur"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 		fi;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 		frequency-set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) _idle_info()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	local flags="-f --silent"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	local prev="${COMP_WORDS[COMP_CWORD-1]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	local cur="${COMP_WORDS[COMP_CWORD]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	case "$prev" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		idle-info) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) _idle_set()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	local flags="-d --disable -e --enable -D --disable-by-latency -E --enable-all"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	local prev="${COMP_WORDS[COMP_CWORD-1]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	local cur="${COMP_WORDS[COMP_CWORD]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	case "$prev" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		idle-set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) _set()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	local flags="--perf-bias, -b"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	local prev="${COMP_WORDS[COMP_CWORD-1]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	local cur="${COMP_WORDS[COMP_CWORD]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	case "$prev" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) _monitor()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	local flags="-l -m -i -c -v"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	local prev="${COMP_WORDS[COMP_CWORD-1]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	local cur="${COMP_WORDS[COMP_CWORD]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	case "$prev" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		monitor) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) _taskset()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	local prev_to_prev="${COMP_WORDS[COMP_CWORD-2]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	local prev="${COMP_WORDS[COMP_CWORD-1]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	local cur="${COMP_WORDS[COMP_CWORD]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	case "$prev_to_prev" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		-c|--cpu) COMPREPLY=($(compgen -W "$_cpupower_commands" -- "$cur")) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	case "$prev" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		frequency-info) _frequency_info ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		frequency-set) _frequency_set ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		idle-info) _idle_info ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		idle-set) _idle_set ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		set) _set ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		monitor) _monitor ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) _cpupower ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	local i
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	local c=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	local command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	while test $c -lt $COMP_CWORD; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		if test $c == 1; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 			command="${COMP_WORDS[c]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		c=$((++c))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	# Complete name of subcommand if the user has not finished typing it yet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	if test $c -eq $COMP_CWORD -a -z "$command"; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		COMPREPLY=($(compgen -W "help -v --version -c --cpu $_cpupower_commands" -- "${COMP_WORDS[COMP_CWORD]}"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	# Complete arguments to subcommands.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	case "$command" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		-v|--version) return ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		-c|--cpu) _taskset ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		help) COMPREPLY=($(compgen -W "$_cpupower_commands" -- "${COMP_WORDS[COMP_CWORD]}")) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		frequency-info) _frequency_info ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		frequency-set) _frequency_set ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		idle-info) _idle_info ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		idle-set) _idle_set ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		set) _set ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		monitor) _monitor ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) complete -o bashdefault -o default -F _cpupower cpupower 2>/dev/null \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)     || complete -o default -F _cpupower cpupower