op_osupgrade: add some sanity checks
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_videofir.sh
1 #!/bin/sh
2
3 set -e
4
5 if [ $# -ne 1 ]; then
6         echo "usage: $0 <fir_file_basename>"
7         exit 1
8 fi
9
10 if [ "$1" = `basename "$1"` ]; then
11         base_path="/etc/pandora/conf/dss_fir/$1"
12 else
13         base_path="$1"
14 fi
15
16 apply_filter()
17 {
18         file="${1}"
19         if [ ! -f "$file" ]; then
20             file="${1}_up"
21         fi
22         if [ -f "$file" ]; then
23                 # hardcode overlay for now.. We'll update this as needed
24                 echo "writing fir:"
25                 head -n1 "$file"
26                 sed -n 3,10p "$file" > "/sys/devices/platform/omapdss/overlay1/filter_coef_up_h"
27                 sed -n 12,19p "$file" > "/sys/devices/platform/omapdss/overlay1/filter_coef_up_v3"
28                 sed -n 21,28p "$file" > "/sys/devices/platform/omapdss/overlay1/filter_coef_up_v5"
29         else
30             echo "No filter with that name"
31         fi
32 }
33
34 apply_filter "${base_path}"