Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't export USB mass storage when connected to wall charger
  • Loading branch information
Bernd Wachter committed Oct 9, 2012
1 parent f3556f2 commit fdaf6b2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions initfs/skeleton/init
Expand Up @@ -7,7 +7,7 @@
# Peter Antoniac <peter.antoniac@nokia.com>
# Timo Kokkonen <timo.t.kokkonen@nokia.com>
# Janne Lääkkö <janne.laakko@nokia.com>
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
Expand Down Expand Up @@ -82,8 +82,13 @@ trap_func()

usb_is_plugged()
{
usb=$(cat /sys/class/power_supply/usb/present)
return $usb
# type is USB_DCP with wall charger, USB otherwise (including disconnected)
if [ "$(cat /sys/class/power_supply/usb/type)" == "USB" ]; then
usb=$(cat /sys/class/power_supply/usb/present)
return $usb
else
return 0
fi
}

wait_mmc()
Expand Down Expand Up @@ -267,4 +272,3 @@ reboot_to_harmattan 5
while true; do
sleep 99999
done

0 comments on commit fdaf6b2

Please sign in to comment.