-
-
Save x0wllaar/1bcb64cf59994e8543b30418b6b2a81c to your computer and use it in GitHub Desktop.
Lubuntu on Miix 320
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
Section "Monitor" | |
Identifier "<default monitor>" | |
DisplaySize 339 212 # 144 DPI | |
Option "Rotate" "right" | |
EndSection | |
Section "Device" | |
Identifier "Intel Graphics" | |
Driver "intel" | |
Option "AccelMethod" "sna" | |
Option "TearFree" "true" | |
EndSection |
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
#! /bin/bash | |
#Based on https://github.com/Icenowy/axpd/blob/master/axpd.sh | |
hex2dec(){ | |
echo 'ibase=16; obase=A; '"$1" | bc | |
} | |
checkbit(){ | |
[ $(( $1 & $(( 1 << $2 )) )) != 0 ] | |
} | |
rmmod -f battery 2>/dev/null | |
modprobe i2c-dev 2>/dev/null | |
modprobe test_power 2>/dev/null | |
for i in 4 12 6 | |
do | |
if find /sys | grep axp288_charger | grep -q i2c-$i/ | |
then | |
export ADDR=$i | |
fi | |
done | |
i2cset -f -y -r 6 0x34 0xb8 0xe8 | |
while true | |
do | |
rmmod battery 2>/dev/null | |
echo LION > /sys/module/test_power/parameters/battery_technology | |
source_status_reg=$(i2cget -f -y $ADDR 0x34 0x00) | |
charger_status_reg=$(i2cget -f -y $ADDR 0x34 0x01) | |
if checkbit $source_status_reg 4 | |
then | |
echo on > /sys/module/test_power/parameters/usb_online | |
if checkbit $charger_status_reg 6 | |
then | |
echo charging > /sys/module/test_power/parameters/battery_status | |
else | |
echo not-charging > /sys/module/test_power/parameters/battery_status | |
fi | |
else | |
echo off > /sys/module/test_power/parameters/usb_online | |
echo discharging > /sys/module/test_power/parameters/battery_status | |
fi | |
if checkbit $source_status_reg 2 | |
then | |
echo on > /sys/module/test_power/parameters/ac_online | |
else | |
echo off > /sys/module/test_power/parameters/ac_online | |
fi | |
hex=$(i2cget -f -y $ADDR 0x34 0xb9 | cut -c 3- | tr a-z A-Z) | |
capacity=$(expr $(hex2dec $hex) - 128) | |
if [ $capacity -ge 0 ] | |
then | |
echo $capacity > /sys/module/test_power/parameters/battery_capacity | |
fi | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment