-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quote shell variables. Avoid wildcards.
- Loading branch information
Rouven Spreckels
committed
Sep 20, 2019
1 parent
d98ed4e
commit 8ce9d01
Showing
11 changed files
with
62 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
*/10-huawei-wmi.rules | ||
*/constants | ||
*/available | ||
*/privilege | ||
*/reinstate | ||
*/debian/huawei-wmi-privilege.service | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
10-huawei-wmi.rules lib/udev/rules.d | ||
constants usr/lib/huawei-wmi | ||
available usr/lib/huawei-wmi | ||
privilege usr/lib/huawei-wmi | ||
reinstate usr/lib/huawei-wmi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#! /bin/sh -e | ||
|
||
readonly DEF=/etc/default/huawei-wmi/ | ||
readonly WMI=/sys/devices/platform/huawei-wmi/ | ||
|
||
readonly CCT=charge_control_thresholds | ||
readonly DCT=charge_thresholds | ||
readonly FLS=fn_lock_state | ||
|
||
available() { | ||
[ \( -e "$WMI$CCT" -o -e "$WMI$DCT" \) -a -e "$WMI$FLS" ] | ||
} | ||
|
||
available || sleep 1 | ||
available || { | ||
echo No Huawei WMI available >&2 | ||
exit 1 | ||
} | ||
|
||
for wmi_xct in "$WMI$CCT" "$WMI$DCT" | ||
do | ||
if [ -e "$wmi_xct" ] | ||
then | ||
readonly cct=$(basename "$wmi_xct") | ||
else | ||
readonly dct=$(basename "$wmi_xct") | ||
fi | ||
done | ||
|
||
[ "$cct" -a "$dct" -a "$cct" != "$dct" ] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,11 @@ | ||
#! /bin/sh -e | ||
|
||
. /usr/lib/huawei-wmi/constants | ||
. /usr/lib/huawei-wmi/available | ||
|
||
[ -e $WMI$CCT -a -e $WMI$FLS ] || sleep 1 | ||
[ -e "$DEF$dct" ] && mv --force -- "$DEF$dct" "$DEF$cct" | ||
|
||
[ -e $WMI$CCT -a -e $WMI$FLS ] || { | ||
echo >&2 "No Huawei WMI available" | ||
exit 1 | ||
} | ||
[ -e "$DEF$cct" ] || cp -- "$WMI$cct" "$DEF" | ||
chmod g=u -- "$DEF$cct" | ||
|
||
if [ -e $DEF$CCT ] | ||
then | ||
wmi_cct=$(basename $WMI$CCT) | ||
for def_cct in $DEF$CCT | ||
do | ||
[ $(basename $def_cct) = $wmi_cct ] || mv --force $def_cct $DEF$wmi_cct | ||
done | ||
else | ||
cp $WMI$CCT $DEF | ||
chmod g=u $DEF$CCT | ||
fi | ||
|
||
chgrp huawei-wmi $WMI$CCT $WMI$FLS | ||
chmod g=u $WMI$CCT $WMI$FLS | ||
chgrp huawei-wmi -- "$WMI$cct" "$WMI$FLS" | ||
chmod g=u -- "$WMI$cct" "$WMI$FLS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#! /bin/sh -e | ||
|
||
. /usr/lib/huawei-wmi/constants | ||
. /usr/lib/huawei-wmi/available | ||
|
||
echo Old charge control thresholds $(cat $WMI$CCT) | ||
cp $DEF$CCT $WMI | ||
echo New charge control thresholds $(cat $WMI$CCT) | ||
echo Old battery charge-thresholds "$(cat -- "$WMI$cct")" | ||
cp -- "$DEF$cct" "$WMI" | ||
echo New battery charge-thresholds "$(cat -- "$WMI$cct")" |