1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
#
#
#    Copyright 2010 TheSeven
#
#
#    This file is part of TheSeven's iPod tools.
#
#    TheSeven's iPod tools are free software: you can redistribute them and/or
#    modify them under the terms of the GNU General Public License as
#    published by the Free Software Foundation, either version 2 of the
#    License, or (at your option) any later version.
#
#    TheSeven's iPod tools are distributed in the hope that they will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#    See the GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License along
#    with TheSeven's iPod tools.  If not, see <http://www.gnu.org/licenses/>.
#
#


import struct
import libembios
import sys

dev = libembios.Embios()
dev.lib.dev.timeout = 3000


dev.write(0x3c50000c, struct.pack("I", 0x80000000))
dev.write(0x3cf00064, struct.pack("I", 0x00000017))
# 10 msec delay
dev.write(0x3cf00064, struct.pack("I", 0x0000001f))
dev.i2cwrite(0, 0x94, 0x00, struct.pack("B", 0x99))
dev.i2cwrite(0, 0x94, 0x2e, struct.pack("B", 0x30))
dev.i2cwrite(0, 0x94, 0x32, struct.pack("B", 0x07))
dev.i2cwrite(0, 0x94, 0x33, struct.pack("B", 0xff))
dev.i2cwrite(0, 0x94, 0x34, struct.pack("B", 0xf8))
dev.i2cwrite(0, 0x94, 0x35, struct.pack("B", 0xdc))
dev.i2cwrite(0, 0x94, 0x36, struct.pack("B", 0xfc))
dev.i2cwrite(0, 0x94, 0x37, struct.pack("B", 0xac))
dev.i2cwrite(0, 0x94, 0x3a, struct.pack("B", 0xf8))
dev.i2cwrite(0, 0x94, 0x3c, struct.pack("B", 0xd3))
dev.i2cwrite(0, 0x94, 0x3d, struct.pack("B", 0x23))
dev.i2cwrite(0, 0x94, 0x3e, struct.pack("B", 0x81))
dev.i2cwrite(0, 0x94, 0x3f, struct.pack("B", 0x46))
dev.i2cwrite(0, 0x94, 0x00, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x03, struct.pack("B", 0xaa))
dev.i2cwrite(0, 0x94, 0x04, struct.pack("B", 0x2e))
dev.i2cwrite(0, 0x94, 0x05, struct.pack("B", 0x0b))
dev.i2cwrite(0, 0x94, 0x07, struct.pack("B", 0x18))
dev.i2cwrite(0, 0x94, 0x02, struct.pack("B", 0x01))
dev.i2cwrite(0, 0x94, 0x0f, struct.pack("B", 0x80))
dev.i2cwrite(0, 0x94, 0x0b, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x0c, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x1a, struct.pack("B", 0x80))
dev.i2cwrite(0, 0x94, 0x1b, struct.pack("B", 0x80))
dev.i2cwrite(0, 0x94, 0x1c, struct.pack("B", 0x80))
dev.i2cwrite(0, 0x94, 0x1d, struct.pack("B", 0x80))
dev.i2cwrite(0, 0x94, 0x02, struct.pack("B", 0x00))
# 75 msec delay
dev.i2cwrite(0, 0x94, 0x1a, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x1b, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x1c, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x1d, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x06, struct.pack("B", 0x00))

dev.i2cwrite(0, 0x94, 0x0f, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x14, struct.pack("B", 0xf0))
dev.i2cwrite(0, 0x94, 0x15, struct.pack("B", 0x00))
dev.i2cwrite(0, 0x94, 0x16, struct.pack("B", 0x40))