blob: 52b7db4f3a120fd6d820270ff081245c8fc249e4 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Trigger udev events"
author "chromium-os-dev@chromium.org"
# We must run eventually even if the UI doesn't come up correctly,
# because network configuration depends on this job.
start on starting failsafe
script
udevadm trigger
udevadm settle
drvfile=/var/lib/preload-wifi-driver
# Create/Update driver name for the built-in WIFI.
# Used to preload WIFI driver in udev.conf
# TODO(ggg): can flimflam share the "user selected" network device?
iwdev=$(iw dev | awk '/Interface/ { print $2 ; exit 0 }')
if [ -n "$iwdev" ] ; then
drv=$(ethtool -i "$iwdev" | awk '/driver:/ { print $2 }')
fi
if [ -n "$drv" ] ; then
drvmod=$(lsmod | awk 'd==$1 { print $1 }' d="$drv")
fi
if [ -n "$drvmod" ] ; then
if [ -s $drvfile ] ; then
olddrv=$(head -1 $drvfile)
fi
# Blacklist brcm drivers
# TODO: investigate true cause of the problem and remove blacklist
if [ "$(echo $drv | head -c4)" = "brcm" ] ; then
rm -f $drvfile
# Only update contents if they've changed.
elif [ "$drv" != "$olddrv" ] ; then
echo "$drv" > $drvfile
fi
else
logger "udev-addon:$iwdev: $drv is not a module."
fi
end script