From 249bba03f1051f4984538f66b9e7d36674c61e5c Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 24 Dec 2011 11:56:46 +0000 Subject: 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 --- utils/ypr0tools/files/etc/mods/safe_mode.raw | Bin 0 -> 230400 bytes utils/ypr0tools/files/etc/mods/safe_mode.sh | 111 +++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 utils/ypr0tools/files/etc/mods/safe_mode.raw create mode 100755 utils/ypr0tools/files/etc/mods/safe_mode.sh (limited to 'utils/ypr0tools/files/etc/mods') diff --git a/utils/ypr0tools/files/etc/mods/safe_mode.raw b/utils/ypr0tools/files/etc/mods/safe_mode.raw new file mode 100644 index 0000000000..1c1aa61dd1 Binary files /dev/null and b/utils/ypr0tools/files/etc/mods/safe_mode.raw differ 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 @@ +#!/bin/sh + +# YP-R0 Safe Mode!! +# - Part of the "Device Rescue Kit", modded ROM v2.20 and onwards +# Version: v0.3 +# v0.2 - initial version +# v0.3 - USB cable check implemented +# by lorenzo92 aka Memory +# memoryS60@gmail.com + +CustomIMG="/mnt/media1/safe_mode.raw" +DefIMG="/etc/mods/safe_mode.raw" + +timer=0 +# Seconds before turning the device OFF +timeout=2 + +shutdown () { + sync + reboot +} + +cableDaemon () { + cd /usr/local/bin + while [ 1 ] + do + if [ $timer -gt $timeout ] + then + shutdown + fi + + if ./minird 0x0a | grep -q 0x00 + then + timer=$(($timer+1)) + else + timer=0 + fi + sleep 1 + done +} + +# Back button is a \x08\x00\x00\x00 string... +# ...since bash removes null bytes for us, we must only care the single byte +var=$(dd if=/dev/r0Btn bs=4 count=1) +# Here a workaround to detect \x08 byte :S +var2=$(echo -e -n "\x08") +if [[ "$var" = "$var2" ]] +then + echo "Safe mode (USB) activated..." + # Put the backlight at the minimum level: no energy waste, please ;) + # Using low level interface + + cd /usr/local/bin + ./afewr 0x1b 0x3 0x8 + + # Long press reset time 5 secs + [ -e /etc/mods/reset_time_mod.sh ] && /bin/sh /etc/mods/reset_time_mod.sh + + # Clear the screen and show a nice picture :D + + echo -n "1" > /sys/class/graphics/fb0/blank + echo -n "0" >> /sys/class/graphics/fb0/blank +# echo -n "1" > /sys/class/graphics/fb2/blank +# echo -n "0" >> /sys/class/graphics/fb2/blank + if [ -e $CustomIMG ] + then + cat $CustomIMG > "/dev/fb0" + else + cat $DefIMG > "/dev/fb0" + fi + + # Here the real USB connection stuff + # This is slightly modified by me; it was contained in the cramfs shipped with + # YP-R0 opensource package... + + lsmod | grep g_file_storage + if [ $? == 0 ] + then + umount /mnt/media1/dev/gadget + fi + #if [ -d /mnt/media0 ] + #then + umount /mnt/media1 + umount /mnt/media0 + #umount /mnt/mmc + #fi + lsmod | grep rfs + if [ $? == 0 ] + then + rmmod rfs + fi + lsmod | grep g_file_storage + if [ $? == 0 ] + then + rmmod gadgetfs + rmmod g_file_storage + rmmod arcotg_udc + fi + lsmod | grep g_file_storage + if [ $? != 0 ] + then + modprobe g-file-storage file=/dev/stl3,/dev/stl2,/dev/mmcblk0 removable=1 + fi + + # Let's implement the check if usb cable is still inserted or not... + cableDaemon + + return 1 +else + return 0 +fi -- cgit v1.2.3