initial commit
This commit is contained in:
commit
bf22700562
6 changed files with 306 additions and 0 deletions
137
charge-fso.sh
Normal file
137
charge-fso.sh
Normal file
|
@ -0,0 +1,137 @@
|
|||
#/bin/bash
|
||||
# Reset
|
||||
|
||||
#echo -n Reset...
|
||||
#i2cset -y -m 0x80 2 0x6b 0x04 80
|
||||
#echo -n Done. Sleep 1...
|
||||
#sleep 1
|
||||
#echo -n Done.
|
||||
|
||||
echo "Charger: " $(cat /sys/devices/platform/musb_hdrc/charger)
|
||||
|
||||
# Disable charger for configuration:
|
||||
i2cset -y 2 0x6b 0x01 0xcc # No limit, 3.4V weak threshold, enable term, charger disable
|
||||
|
||||
|
||||
# Register 0x04
|
||||
# 8: reset
|
||||
# 4: 27.2mV # charge current
|
||||
# 2: 13.6mV
|
||||
# 1: 6.8mV
|
||||
# 8: N/A
|
||||
# 4: 13.6mV # termination current
|
||||
# 2: 6.8mV
|
||||
# 1: 3.4mV
|
||||
# 7-1250 6-1150 5-1050 4-950 3-850 2-750 1-650 0-550
|
||||
# 7-400 6-350 5-300 4-250 3-200 2-150 1-100 0-50
|
||||
i2cset -y -m 0xFF 2 0x6b 0x04 0x50;
|
||||
|
||||
# Register 0x02
|
||||
# 8: .640 V
|
||||
# 4: .320 V
|
||||
# 2: .160 V
|
||||
# 1: .080
|
||||
# 8: .040
|
||||
# 4: .020 (+ 3.5)
|
||||
# 2: otg pin active at high (default 1)
|
||||
# 1: enable otg pin
|
||||
i2cset -y -m 0xfc 2 0x6b 0x02 0x8c;
|
||||
# 4.2 = 3.5 + .640 + .040 + .02 = 8c
|
||||
# 4.16 = 3.5 + .640V + .020 = 84
|
||||
# 4.1 = 3.5 + .320 + .160 + .08 + .04 = 78
|
||||
# 4.0 = 3.5 + .320 + .160 + .02 = 64
|
||||
# 3.9 = 3.5 + .320 + .080 = 50
|
||||
|
||||
# Register 0x1
|
||||
# 8: 00 = 100, 01 = 500, 10 = 800mA
|
||||
# 4: 11 = no limit
|
||||
# 2: 200mV weak threshold default 1
|
||||
# 1: 100mV weak treshold defsult 1 (3.4 - 3.7)
|
||||
# 8: enable termination
|
||||
# 4: charger disable
|
||||
# 2: high imp mode
|
||||
# 1: boost
|
||||
i2cset -y 2 0x6b 0x01 0xc8;
|
||||
|
||||
# Register 0x00
|
||||
# 8: Read: OTG Pin Status
|
||||
# Write: Timer Reset
|
||||
# 4: Enable Stat Pin
|
||||
# 2: Stat : 00 Ready 01 In Progress
|
||||
# 1: : 10 Done 11 Fault
|
||||
# 8: Boost Mode
|
||||
# 4: Fault: 000 Normal 001 VBUS OVP 010 Sleep Mode
|
||||
# 2: 011 Poor input or Vbus < UVLO
|
||||
# 1: 100 Battery OVP 101 Thermal Shutdown
|
||||
# 110 Timer Fault 111 NA
|
||||
i2cset -y 2 0x6b 0x00 0x00;
|
||||
|
||||
echo -n "Charge parameters programmed. Sleep 1..."
|
||||
sleep 1
|
||||
echo "Status: " $(i2cget -y 2 0x6b 0x00)
|
||||
i2cset -y 2 0x6b 0x00 0x80 # timer reset
|
||||
cat /sys/devices/platform/musb_hdrc/charger >/dev/null
|
||||
|
||||
# Initialize variables
|
||||
THROTTLE=0
|
||||
FULL=0
|
||||
MODE="STANDBY"
|
||||
WALLCHARGER=0
|
||||
|
||||
# Assuming a nice round number 20mOhm for bq27200 sense resistor
|
||||
RS=20
|
||||
|
||||
get_nac ()
|
||||
{
|
||||
NAC=$(i2cget -y 2 0x55 0x0c w)
|
||||
NAC=$(($NAC * 3570 / $RS / 1000))
|
||||
}
|
||||
get_rsoc ()
|
||||
{
|
||||
RSOC=$(i2cget -y 2 0x55 0x0b)
|
||||
RSOC=$((RSOC))
|
||||
}
|
||||
get_volt ()
|
||||
{
|
||||
VOLT=$(i2cget -y 2 0x55 0x08 w)
|
||||
VOLT=$(($VOLT))
|
||||
}
|
||||
|
||||
STATUS=$(i2cget -y 2 0x6b 0x00)
|
||||
while true ; do
|
||||
sleep 15;
|
||||
STATUS=$(i2cget -y 2 0x6b 0x00)
|
||||
#echo $STATUS
|
||||
|
||||
i2cset -y -m 0x80 2 0x6b 0x00 0x80; # timer reset
|
||||
get_nac
|
||||
get_rsoc
|
||||
get_volt
|
||||
|
||||
if [ $MODE == "STANDBY" ] ; then
|
||||
if [ $STATUS == 0x10 ] || [ $STATUS == 0x90 ] ; then
|
||||
MODE="CHARGING"
|
||||
echo $(date) "standby -> CHARGING. Current available capacity: " $NAC "mAh" >> /home/user/MyDocs/charger.log
|
||||
WALLCHARGER=$(cat /sys/devices/platform/musb_hdrc/charger)
|
||||
fi
|
||||
fi
|
||||
if [ $MODE == "CHARGING" ] ; then
|
||||
if [ $STATUS == 0x00 ] ; then
|
||||
MODE="STANDBY"
|
||||
echo $(date) "charging -> STANDBY. Current available capacity: " $NAC "mAh" >> /home/user/MyDocs/charger.log
|
||||
WALLCHARGER=0
|
||||
# This will stop USB from eating power as long as you haven't plugged it into a PC
|
||||
echo 0 > /sys/devices/platform/musb_hdrc/connect
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $STATUS == 0xa0 ] && [ $FULL == 0 ] ; then
|
||||
echo "Charge done"
|
||||
echo $(date) "FULL: " $NAC "mAh" >> /home/user/MyDocs/charger.log
|
||||
FULL=1
|
||||
fi
|
||||
if [ $STATUS == 0x00 ] && [ $FULL == 1 ] ; then
|
||||
FULL=0
|
||||
fi
|
||||
echo Status: $STATUS Mode: $MODE Full: $FULL WallCharger: $WALLCHARGER Battery Voltage: $VOLT NAC: $NAC Battery level: $RSOC %
|
||||
done
|
15
charge-joerg.sh
Normal file
15
charge-joerg.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
i2cset -y -m 0x77 2 0x6b 0x04 0xc9;
|
||||
# next register 0x03 is device ID, always 4b and r/o; so we skip to 0x04
|
||||
i2cset -y -m 0xff 2 0x6b 0x02 0x8c;
|
||||
# 0x8c = 3v5 + .640 + .040 + .020 = 4V200, BE CAREFUL and DON'T CHANGE
|
||||
# unless you know what you're doing. 4V2 is ABS MAX!
|
||||
i2cset -y -m 0xff 2 0x6b 0x01 0xc8;
|
||||
i2cset -y -m 0xc0 2 0x6b 0x00 0x00;
|
||||
|
||||
# tickle watchdog, while status indicates 'charging from wallcharger'
|
||||
while [ $(i2cget -y 2 0x6b 0x00) = 0x90 ] ; do
|
||||
sleep 28;
|
||||
# reset watchdog timer:
|
||||
i2cset -y -m 0x80 2 0x6b 0x00 0x80;
|
||||
done
|
||||
echo "charging finished, status(reg0)=$(i2cget -y 2 0x6b 0x00)"
|
20
charge-pancake.sh
Normal file
20
charge-pancake.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
i2cset -y -m 0x77 2 0x6b 0x04 0xc9;
|
||||
status=$(i2cget -y 2 0x6b 0x00)
|
||||
echo status=$status
|
||||
|
||||
# next register 0x03 is device ID, always 4b and r/o; so we skip to 0x04
|
||||
i2cset -y -m 0xff 2 0x6b 0x02 0x8c;
|
||||
# 0x8c = 3v5 + .640 + .040 + .020 = 4V200, BE CAREFUL and DON'T CHANGE
|
||||
# unless you know what you're doing. 4V2 is ABS MAX!
|
||||
i2cset -y -m 0xff 2 0x6b 0x01 0xc8;
|
||||
i2cset -y -m 0xc0 2 0x6b 0x00 0x00;
|
||||
|
||||
# tickle watchdog, while status indicates 'charging from wallcharger'
|
||||
#while [ $(i2cget -y 2 0x6b 0x00) = 0x90 ] ; do
|
||||
while [ $(i2cget -y 2 0x6b 0x00) = 0x10 ] ; do
|
||||
echo charging...
|
||||
sleep 28;
|
||||
# reset watchdog timer:
|
||||
i2cset -y -m 0x80 2 0x6b 0x00 0x80;
|
||||
done
|
||||
echo "charging finished, status(reg0)=$(i2cget -y 2 0x6b 0x00)"
|
11
charge-pyneo.sh
Normal file
11
charge-pyneo.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
i2cset -y -m 0x77 2 0x6b 0x04 0x50;
|
||||
i2cset -y -m 0xff 2 0x6b 0x02 0x8c;
|
||||
i2cset -y -m 0xff 2 0x6b 0x01 0xc8;
|
||||
i2cset -y -m 0xc0 2 0x6b 0x00 0x00;
|
||||
|
||||
while true ; do
|
||||
i2cset -y -m 0x80 2 0x6b 0x00 0x80;
|
||||
sleep 28;
|
||||
done
|
121
n900-rootfs.sh
Normal file
121
n900-rootfs.sh
Normal file
|
@ -0,0 +1,121 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
ROOTDIR="n900-chroot"
|
||||
|
||||
PACKAGES="ifupdown,openssh-server,udev,procps,netbase,vim,console-setup-mini,man-db,iproute"
|
||||
PACKAGES="$PACKAGES,module-init-tools,wget,openssh-client,locales,sysklogd,klogd,input-utils,dnsutils"
|
||||
PACKAGES="$PACKAGES,alsa-base,ntpdate,debconf-english,screen,less,console-tools,iputils-ping,vpnc,rsync"
|
||||
PACKAGES="$PACKAGES,i2c-tools,watchdog"
|
||||
cdebootstrap --flavour=minimal --include=$PACKAGES sid "$ROOTDIR"
|
||||
|
||||
#cp -a /lib/modules/2.6.28-omap1/ "$ROOTDIR/lib/modules/"
|
||||
#cp -a /lib/firmware/* "$ROOTDIR/lib/firmware/"
|
||||
#curl http://my.arava.co.il/~matan/770/n900/power_supply.ko > $ROOTDIR/lib/modules/2.6.28-omap1/power_supply.ko
|
||||
#curl http://my.arava.co.il/~matan/770/n900/bq27x00_battery.ko > $ROOTDIR/lib/modules/2.6.28-omap1/bq27x00_battery.ko
|
||||
curl http://mister-muffin.de/n900/modules-2.6.28-omap1.tar.gz | chroot $ROOTDIR tar -C /lib/modules/ -xzf -
|
||||
curl http://mister-muffin.de/n900/firmware.tar.gz | chroot $ROOTDIR tar -C /lib/ -xzf -
|
||||
|
||||
sed -i 's/\(PermitEmptyPasswords\) no/\1 yes/' $ROOTDIR/etc/ssh/sshd_config
|
||||
sed -i 's/\(root:\)[^:]*\(:\)/\1\/\/plGAV7Hp3Zo\2/' $ROOTDIR/etc/shadow
|
||||
|
||||
chroot $ROOTDIR useradd user -p //plGAV7Hp3Zo -s /bin/bash --create-home
|
||||
|
||||
cat > $ROOTDIR/etc/watchdog.conf << __EOF__
|
||||
watchdog-device = /dev/twl4030_wdt
|
||||
interval = 10
|
||||
realtime = yes
|
||||
priority = 1
|
||||
__EOF__
|
||||
|
||||
sed -i "s/\(FSCKFIX=\)no/\1yes/" $ROOTDIR/etc/default/rcS
|
||||
|
||||
chroot $ROOTDIR apt-get update
|
||||
|
||||
chroot $ROOTDIR apt-get install xserver-xorg-video-omap3 xserver-xorg-input-evdev xserver-xorg-input-tslib libts-bin nodm
|
||||
|
||||
cat > $ROOTDIR/etc/default/nodm << __END__
|
||||
NODM_ENABLED=true
|
||||
NODM_USER=user
|
||||
NODM_XINIT=/usr/bin/xinit
|
||||
NODM_FIRST_VT=0
|
||||
NODM_XSESSION=/etc/X11/Xsession
|
||||
NODM_X_OPTIONS='-nolisten tcp'
|
||||
NODM_MIN_SESSION_TIME=60
|
||||
__END__
|
||||
|
||||
cat > $ROOTDIR/etc/X11/xorg.conf << __EOF__
|
||||
Section "Monitor"
|
||||
Identifier "Configured Monitor"
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Default Screen"
|
||||
Device "Configured Video Device"
|
||||
EndSection
|
||||
|
||||
Section "Device"
|
||||
Identifier "Configured Video Device"
|
||||
Driver "omapfb"
|
||||
Option "fb" "/dev/fb0"
|
||||
EndSection
|
||||
|
||||
# this is only needed when using the maemo kernel
|
||||
Section "InputClass"
|
||||
Identifier "Keyboard"
|
||||
MatchProduct "omap_twl4030keypad"
|
||||
MatchDevicePath "/dev/input/event*"
|
||||
Option "XkbModel" "nokiarx51"
|
||||
Option "XkbLayout" "de"
|
||||
EndSection
|
||||
__EOF__
|
||||
|
||||
cat > $ROOTDIR/etc/network/interfaces << __EOF__
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# usb
|
||||
auto usb0
|
||||
iface usb0 inet static
|
||||
address 192.168.2.2
|
||||
network 192.168.2.0
|
||||
netmask 255.255.255.0
|
||||
broadcast 192.168.2.255
|
||||
gateway 192.168.2.1
|
||||
dns-nameservers 192.168.2.1
|
||||
dns-search universe
|
||||
|
||||
# disable automatic stuff for other devices (so no net.agent script running for them)
|
||||
noauto phonet0 upnlink0 wlan0 wmaster0
|
||||
__EOF__
|
||||
|
||||
cat > $ROOTDIR/etc/default/keyboard << __EOF__
|
||||
XKBMODEL="nokiarx51"
|
||||
XKBLAYOUT="de"
|
||||
XKBVARIANT=""
|
||||
XKBOPTIONS=""
|
||||
__EOF__
|
||||
|
||||
cat > $ROOTDIR/etc/modules << __EOF__
|
||||
bq27x00_battery
|
||||
g_nokia
|
||||
__EOF__
|
||||
|
||||
cat > $ROOTDIR/root/charging.sh << __EOF__
|
||||
#!/bin/sh
|
||||
|
||||
i2cset -y -m 0x77 2 0x6b 0x04 0x50;
|
||||
i2cset -y -m 0xff 2 0x6b 0x02 0x8c;
|
||||
i2cset -y -m 0xff 2 0x6b 0x01 0xc8;
|
||||
i2cset -y -m 0xc0 2 0x6b 0x00 0x00;
|
||||
|
||||
while true ; do
|
||||
i2cset -y -m 0x80 2 0x6b 0x00 0x80;
|
||||
sleep 28;
|
||||
done
|
||||
__EOF__
|
||||
|
||||
echo -n "14188 155 -3112200 52 -8740 33129794 65536" > $ROOTDIR/etc/pointercal
|
||||
|
||||
chroot $ROOTDIR apt-get remove cdebootstrap-helper-rc.d
|
||||
|
||||
chroot $ROOTDIR apt-get clean
|
2
notes
Normal file
2
notes
Normal file
|
@ -0,0 +1,2 @@
|
|||
http://tablets-dev.nokia.com/nokia_N900.php
|
||||
http://tablets-dev.nokia.com/maemo-dev-env-downloads.php
|
Loading…
Reference in a new issue