~ubuntu-branches/ubuntu/quantal/linux-backports-modules-3.5.0/quantal-updates

« back to all changes in this revision

Viewing changes to updates/cw-3.6/udev/compat_firmware.sh

  • Committer: Package Import Robot
  • Author(s): Leann Ogasawara
  • Date: 2012-10-10 22:28:55 UTC
  • Revision ID: package-import@ubuntu.com-20121010222855-qepocc61xktv6gs9
Tags: 3.5.0-17.1
* Open Quantal LBM
* Add compat-wireless 3.6
  -LP: #1066123

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
# This is ported from Ubuntu but ubuntu uses these directories which
 
4
# other distributions don't care about:
 
5
# FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \
 
6
#               /lib/firmware/$(uname -r) /lib/firmware"
 
7
# If your distribution looks for firmware in other directories
 
8
# feel free to extend this and add your own directory here.
 
9
#
 
10
FIRMWARE_DIRS="/lib/firmware"
 
11
 
 
12
err() {
 
13
        echo "$@" >&2
 
14
        logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true
 
15
}
 
16
 
 
17
if [ ! -e /sys$DEVPATH/loading ]; then
 
18
        err "udev firmware loader misses sysfs directory"
 
19
        exit 1
 
20
fi
 
21
 
 
22
for DIR in $FIRMWARE_DIRS; do
 
23
        [ -e "$DIR/$FIRMWARE" ] || continue
 
24
        echo 1 > /sys$DEVPATH/loading
 
25
        cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
 
26
        echo 0 > /sys$DEVPATH/loading
 
27
        exit 0
 
28
done
 
29
 
 
30
echo -1 > /sys$DEVPATH/loading
 
31
err "Cannot find  firmware file '$FIRMWARE'"
 
32
mkdir -p /dev/.udev/firmware-missing
 
33
file=$(echo "$FIRMWARE" | sed 's:/:\\x2f:g')
 
34
ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file
 
35
exit 1