diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-12-24 11:56:46 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-12-24 11:56:46 +0000 |
commit | 249bba03f1051f4984538f66b9e7d36674c61e5c (patch) | |
tree | b9a0d78e05269ed2043521ab0dfdad83aeaf2aff /utils/ypr0tools/files/etc/mods/safe_mode.sh | |
parent | 567e0ad93ef3048f2266932b10dcdb309b1a77c9 (diff) | |
download | rockbox-249bba03f1051f4984538f66b9e7d36674c61e5c.tar.gz rockbox-249bba03f1051f4984538f66b9e7d36674c61e5c.zip |
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/ypr0tools/files/etc/mods/safe_mode.sh')
-rwxr-xr-x | utils/ypr0tools/files/etc/mods/safe_mode.sh | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/utils/ypr0tools/files/etc/mods/safe_mode.sh b/utils/ypr0tools/files/etc/mods/safe_mode.sh new file mode 100755 index 0000000000..122b2eabfe --- /dev/null +++ b/utils/ypr0tools/files/etc/mods/safe_mode.sh | |||
@@ -0,0 +1,111 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # YP-R0 Safe Mode!! | ||
4 | # - Part of the "Device Rescue Kit", modded ROM v2.20 and onwards | ||
5 | # Version: v0.3 | ||
6 | # v0.2 - initial version | ||
7 | # v0.3 - USB cable check implemented | ||
8 | # by lorenzo92 aka Memory | ||
9 | # memoryS60@gmail.com | ||
10 | |||
11 | CustomIMG="/mnt/media1/safe_mode.raw" | ||
12 | DefIMG="/etc/mods/safe_mode.raw" | ||
13 | |||
14 | timer=0 | ||
15 | # Seconds before turning the device OFF | ||
16 | timeout=2 | ||
17 | |||
18 | shutdown () { | ||
19 | sync | ||
20 | reboot | ||
21 | } | ||
22 | |||
23 | cableDaemon () { | ||
24 | cd /usr/local/bin | ||
25 | while [ 1 ] | ||
26 | do | ||
27 | if [ $timer -gt $timeout ] | ||
28 | then | ||
29 | shutdown | ||
30 | fi | ||
31 | |||
32 | if ./minird 0x0a | grep -q 0x00 | ||
33 | then | ||
34 | timer=$(($timer+1)) | ||
35 | else | ||
36 | timer=0 | ||
37 | fi | ||
38 | sleep 1 | ||
39 | done | ||
40 | } | ||
41 | |||
42 | # Back button is a \x08\x00\x00\x00 string... | ||
43 | # ...since bash removes null bytes for us, we must only care the single byte | ||
44 | var=$(dd if=/dev/r0Btn bs=4 count=1) | ||
45 | # Here a workaround to detect \x08 byte :S | ||
46 | var2=$(echo -e -n "\x08") | ||
47 | if [[ "$var" = "$var2" ]] | ||
48 | then | ||
49 | echo "Safe mode (USB) activated..." | ||
50 | # Put the backlight at the minimum level: no energy waste, please ;) | ||
51 | # Using low level interface | ||
52 | |||
53 | cd /usr/local/bin | ||
54 | ./afewr 0x1b 0x3 0x8 | ||
55 | |||
56 | # Long press reset time 5 secs | ||
57 | [ -e /etc/mods/reset_time_mod.sh ] && /bin/sh /etc/mods/reset_time_mod.sh | ||
58 | |||
59 | # Clear the screen and show a nice picture :D | ||
60 | |||
61 | echo -n "1" > /sys/class/graphics/fb0/blank | ||
62 | echo -n "0" >> /sys/class/graphics/fb0/blank | ||
63 | # echo -n "1" > /sys/class/graphics/fb2/blank | ||
64 | # echo -n "0" >> /sys/class/graphics/fb2/blank | ||
65 | if [ -e $CustomIMG ] | ||
66 | then | ||
67 | cat $CustomIMG > "/dev/fb0" | ||
68 | else | ||
69 | cat $DefIMG > "/dev/fb0" | ||
70 | fi | ||
71 | |||
72 | # Here the real USB connection stuff | ||
73 | # This is slightly modified by me; it was contained in the cramfs shipped with | ||
74 | # YP-R0 opensource package... | ||
75 | |||
76 | lsmod | grep g_file_storage | ||
77 | if [ $? == 0 ] | ||
78 | then | ||
79 | umount /mnt/media1/dev/gadget | ||
80 | fi | ||
81 | #if [ -d /mnt/media0 ] | ||
82 | #then | ||
83 | umount /mnt/media1 | ||
84 | umount /mnt/media0 | ||
85 | #umount /mnt/mmc | ||
86 | #fi | ||
87 | lsmod | grep rfs | ||
88 | if [ $? == 0 ] | ||
89 | then | ||
90 | rmmod rfs | ||
91 | fi | ||
92 | lsmod | grep g_file_storage | ||
93 | if [ $? == 0 ] | ||
94 | then | ||
95 | rmmod gadgetfs | ||
96 | rmmod g_file_storage | ||
97 | rmmod arcotg_udc | ||
98 | fi | ||
99 | lsmod | grep g_file_storage | ||
100 | if [ $? != 0 ] | ||
101 | then | ||
102 | modprobe g-file-storage file=/dev/stl3,/dev/stl2,/dev/mmcblk0 removable=1 | ||
103 | fi | ||
104 | |||
105 | # Let's implement the check if usb cable is still inserted or not... | ||
106 | cableDaemon | ||
107 | |||
108 | return 1 | ||
109 | else | ||
110 | return 0 | ||
111 | fi | ||