~ubuntu-branches/ubuntu/feisty/read-edid/feisty

« back to all changes in this revision

Viewing changes to get-edid-powerpc

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2004-07-30 13:04:02 UTC
  • Revision ID: james.westby@ubuntu.com-20040730130402-9bkmpn9a5sw2a9j1
Tags: 1.4.1-2ubuntu1
* get-edid-powerpc: New shell implementation using /proc/device-tree.
* debian/control: Add powerpc to Architecture.
* debian/copyright: Document licence of get-edid-powerpc.
* debian/rules: Adjust to install get-edid-powerpc as get-edid on powerpc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
 
 
3
# Copyright (c) 2004 Colin Watson <cjwatson@debian.org>.
 
4
#
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; either version 2 of the License, or
 
8
# (at your option) any later version.
 
9
#
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with this program; if not, write to the Free Software
 
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 
 
19
set -e
 
20
 
 
21
TREE=/proc/device-tree
 
22
 
 
23
# Apparently some 2.4 kernels put OF aliases in aliases@0.
 
24
if [ -d /proc/device-tree/aliases ]; then
 
25
    ALIASES=aliases
 
26
elif [ -d /proc/device-tree/aliases@0 ]; then
 
27
    ALIASES=aliases@0
 
28
else
 
29
    echo "Can't find Open Firmware aliases directory" >&2
 
30
    exit 2
 
31
fi
 
32
 
 
33
if [ -f "$TREE/$ALIASES/screen" ]; then
 
34
    SCREEN="`cat $TREE/$ALIASES/screen`"
 
35
else
 
36
    echo "Can't find Open Firmware screen alias" >&2
 
37
    exit 2
 
38
fi
 
39
 
 
40
# Aliases start with a slash.
 
41
if [ -d "$TREE$SCREEN" ]; then
 
42
    EDID=
 
43
    # List gathered from files in drivers/video/ in the 2.6.7 kernel
 
44
    # source.
 
45
    for file in DFP,EDID LCD,EDID EDID EDID1 EDID2 EDID,B EDID,A; do
 
46
        if [ -f "$TREE$SCREEN/$file" ]; then
 
47
            EDID="$TREE$SCREEN/$file"
 
48
            break
 
49
        fi
 
50
    done
 
51
    if [ -z "$EDID" ]; then
 
52
        echo "Can't find EDID file in $TREE$SCREEN" >&2
 
53
        exit 1
 
54
    fi
 
55
else
 
56
    echo "Can't find target of Open Firmware screen alias ($TREE$SCREEN)" >&2
 
57
    exit 2
 
58
fi
 
59
 
 
60
cat "$EDID"