[FIXED] FROYO Calibration Error -> open input device: Inappropriate ioctl for device - Touch HD Android Development

[FIXED] FROYO Calibration Error -> open input device: Inappropriate ioctl for device
well, there are several threads about calibration problems ...
but nothing in detail ...
here we go....
basic is froyo 2.2 with haret 1.4 + no "ts-calibrate" file existing on fat32 (sdcard)
in init (startup) the calibration command failed to work ...
as you can see (below) - there in the script the calibration call via:
tssc-calibrate
then i can also see the message for clicking the 5 points, blabla...
(but the "white touch area" like as it is on diamond is not there ... and no time and it is jumping to next procedure in init script. the most users doesn't see that, because it does fast switch/show another lines ....)
then i see an error: (this comes from command "tssc-calibrate")
open input device: Inappropriate ioctl for device
any idea how to fix ?
Code:
for i in /sys/class/input/input* ; do
if [ "`cat $i/name`" = "tssc-manager" ] ; then
touchscreendir=$i
echo "Touchscreen device directory is $i"
fi
done
if [ -f /sdcard/ts-calibration ] ; then
echo "Using Saved Touchscreen Calibration"
echo 128,128,1903,128,128,1907,1903,1907,1024,1024 > $touchscreendir/calibration_screen
cat /sdcard/ts-calibration > $touchscreendir/calibration_points
else
mkdir /dev/graphics
mknod /dev/graphics/fb0 c 29 0
clear
echo; echo; echo; echo; echo; echo; echo; echo "Calibrating Touchscreen:"
echo "Click the Five Targets in order -- Top Left, Top Right, Middle, Bottom Left, Bottom Right"
echo "(Tap lightly. The screen is quite sensitive.)"
tssc-calibrate
echo 0,0,0,0,0,0,0,0,0,0 | cmp -s $touchscreendir/calibration_points # determine if calibration is still null -- means failed calibration
if [ $? -eq 0 ] ; then
echo "Touchscreen Calibration Failed"
else
echo "Touchscreen Calibration Successful; Saving..."
cat $touchscreendir/calibration_points > /sdcard/ts-calibration
fi
fi
EDIT:
FIXED in latest kernel version "htc-msm-linux-20100818_154417-package.tar" and newer ...
for calibration - you must delete the "ts_calibrate" file on your sdcard.
cu camel

hey mate,
any news on this? Wish I could help you but I know nothing about this programming of this sort...as a matter of fact, who is putting this together? I mean, who is putting the versions online, shouldn't they know?
:|

i' now in vacation, but will take care if i'm back ...

this problem is fixed in latest kernel.
if you use kernel "htc-msm-linux-20100818_154417-package.tar" or newer it is fixed.
the touchscreen problem (finger touch does recognize extra touch on left side ..) is not fixed now.

I am new, is it that we have to calibrate before we install?

hktotti said:
I am new, is it that we have to calibrate before we install?
Click to expand...
Click to collapse
On your first boot with the new zimage, it will ask you to calibrate the screen. If you made a mistake (or you did not calibrate at all), delete the ts-calibration file on your sd-card and start android again

Related

Disabling compcache on MCR 3.1 ?

How would i disable compcache on modaco custom rom 3.1 without using the kitchen?
Edit your /system/init.d/ramzswap.sh and comment out the following lines (by putting a "#" sign in front of them.)
Once your file is edited, it should look like this:
Code:
/system/xbin/insmod /system/lib/modules/tun.ko
#/system/xbin/insmod /system/lib/modules/lzo_decompress.ko
#/system/xbin/insmod /system/lib/modules/lzo_compress.ko
#/system/xbin/insmod /system/lib/modules/xvmalloc.ko
#/system/xbin/insmod /system/lib/modules/ramzswap.ko disksize_kb=131072
#/system/xbin/swapon /dev/block/ramzswap0
#echo "10" > /proc/sys/vm/swappiness
echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Once you've saved the file, reboot your phone and you're good.
I tried doing the same thing. I commented out those exact lines and when I reboot it shows I still have a swap file, just half the size it was before. Huh?

Shell Programming Error

I recently wrote a shell program to turn the front LEDs on and off for a flashlight, without having two scripts (one off, one on, which did work). Although the script seems sound to me, i get an error when I run it:
Stderr [: Not Found
Stderr [: Not Found
The script is as follows:
led_status=$(cat /sys/class/leds/flashlight/brightness);
if [ 1 ]
then
if [ "$led_status" = "0" ]
then
echo 3 > /sys/class/leds/flashlight/brightness
fi
fi
if [ "$led_status" = "3" ]
then
echo 0 > /sys/class/leds/flashlight/brightness
fi
I tried the script stripped down a little:
Code:
led_status=$(cat /sys/class/leds/flashlight/brightness);
if [ "$led_status" = "0" ];
then
echo 3 > /sys/class/leds/flashlight/brightness
else
echo 0 > /sys/class/leds/flashlight/brightness
fi
But I get permission denied trying to run it with better terminal pro from emmc with su. I'm not going to be much help, but I'm interested to know if you get this working, and how to run it, and from where.
GScript is the app I use to run scripts as su. It works fine.
But for some reason, I still get the error:
stderr: [: Not Found
I don't know what it's trying to find tbh, but that bracket seems to be a problem.
Code:
led_status=$(cat /sys/class/leds/flashlight/brightness);
if [ "$led_status" = "0" ];
then
echo 3 > /sys/class/leds/flashlight/brightness
else
echo 0 > /sys/class/leds/flashlight/brightness
fi
I just put that code in to gscript and was able to run it fine. It turned both leds on(Really bright) and then I ran it again and it shut both of them off...
Cool script but y not just use an app like lamppu with widgets to do this? or do you have something else your putting together that this is part of?
Hmm. I wonder why mine isn't working then. And I would, but I'm trying to learn more about android and how it works, and running into an error where a bracket becomes a problem confused me to be honest.

[SOLVED] Shell scripting problem: unexpected "fi"

SOLVED: The file had Windows EOL formatting. *nix no likely that.
In the init script there are several instances of if statements like this:
Code:
testvar=1
if [ "$testvar" = "1" ] ; then
echo "Testvar is equal to one"
fi
Yet, when I put if statements exactly like this into a shell script and execute them in an adb shell (or connectbox shell), I get the following error:
line 4: syntax error: unexpected "fi" (expecting "then")
I've also taken if statements directly from init and they throw the same error.
Any busybox gurus here know what's up with this?
toadlife said:
In the init script there are several instances of if statements like this:
Code:
testvar=1
if [ "$testvar" = "1" ] ; then
echo "Testvar is equal to one"
fi
Yet, when I put if statements exactly like this into a shell script and execute them in an adb shell (or connectbox shell), I get the following error:
line 4: syntax error: unexpected "fi" (expecting "then")
I've also taken if statements directly from init and they throw the same error.
Any busybox gurus here know what's up with this?
Click to expand...
Click to collapse
Remove the ; and enter the then
Code:
testvar=1
if [ "$testvar" = "1" ]
then
echo "Testvar is equal to one"
fi
Nope. Still throws the same error.
This is driving me nuts. What I'm doing is editing the /init script. The loops work just fine when executed at bootup in / init, but remounting the filesystem, editing /init and rebooting just the test a change takes forever.
For now I've got my changes to init working, but it would be nice to be able to test before editing /init
I just realized that I forgot to put `#!/bin/sh` at the top of my script. But doing so doesn't seem to help. Instead I get not found error.
Weird!
toadlife said:
Nope. Still throws the same error.
This is driving me nuts. What I'm doing is editing the /init script. The loops work just fine when executed at bootup in / init, but remounting the filesystem, editing /init and rebooting just the test a change takes forever.
For now I've got my changes to init working, but it would be nice to be able to test before editing /init
Click to expand...
Click to collapse
Code:
testvar=1
if [ $testvar = `1` ] (`=~ key)
then
echo "Testvar is equal to one"
fi
[/QUOTE]
It gives the echo, but also 1: not found.
Here is the actual code I put into my init:
(this works)
Code:
#Super cool battery thingy
RUNSCBS=`/bin/grep -o "run.scbs=.*" /proc/cmdline | /bin/sed -e "s/.*run.scbs=//g" -e "s/ .*//g"`
if [ "$RUNSCBS" = "1" ] ; then
dev=$(cat /sys/class/scbs/0/dev | sed -e "s/:/ /g")
mknod /dev/scbs0 c $dev
scbs -d -co /sdcard/scbs.conf
fi
# Debug logs
TAKELOGS=`/bin/grep -o "take.logs=.*" /proc/cmdline | /bin/sed -e "s/.*take.logs=//g" -e "s/ .*//g"`
if [ "$TAKELOGS" = "1" ] ; then
logfiledate=`expr substr \`date -Iseconds|tr -d :|tr -d \+|tr -d \-|tr -d T\` 1 14`
tar -cz -f "$card"/debuglogs_"$logfiledate".tar.gz "$card"/debuglogs_*.txt
cat /proc/kmsg>"$card"/debuglogs_kmsg_"$logfiledate".txt &
logcat -v time >"$card"/debuglogs_logcat_time_"$logfiledate".txt &
logcat -v time -b radio>"$card"/debuglogs_logcat_time_radio_"$logfiledate".txt &
fi
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
arrrghhh said:
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
Click to expand...
Click to collapse
AFAIK, they go forever. I started doing it last night by just putting the static command in the /init and the logging was still going when I got up this morning.
This morning wanted to see if I could make logging and scbs triggerable by an option in the command line.
Both are working for me now.
Know if where talking about scripts, i have a question too.
This is my RIL logs script:
Code:
#! /system/bin/sh
i="0"
while [ $i -lt 2 ]
do
date=`date +%Y%m%d%H%M`
if [ -d /sdcard/logs/ril/$date/ ]
then
echo "/sdcard/logs/ril/$date/ exists!"
else
mkdir /sdcard/logs/ril/$date/
echo " Made direction /sdcard/logs/ril/$date!"
fi
logcat -v time > /sdcard/logs/ril/$date/logcat-time.txt &
logcat -v time -b radio > /sdcard/logs/ril/$date/logcat-time.txt &
sleep 18000 && kill -0 $! && kill $!
cd /sdcard/logs/ril/
tar -czf ril$date.tar.gz $date
rm -r $date
cd /
done
The thing, i believe, is that only the logcat -v time -b radio is killed and when it's sleeping it's not doing that in the background.
Sleeping for 18000 seconds (5h), because if it's running for a day the logcat log will be more than 10 mb or so.
lol.
Your date string...
Code:
date +%Y%m%d%H%M
...is a bit simpler than mine...
Code:
expr substr `date -Iseconds|tr -d :|tr -d \+|tr -d \-|tr -d T` 1 14
(I couldn't figure out the `date` syntax)
Christiaan91 said:
Know if where talking about scripts, i have a question too.
This is my RIL logs script:
Code:
#! /system/bin/sh
i="0"
while [ $i -lt 2 ]
do
date=`date +%Y%m%d%H%M`
if [ -d /sdcard/logs/ril/$date/ ]
then
echo "/sdcard/logs/ril/$date/ exists!"
else
mkdir /sdcard/logs/ril/$date/
echo " Made direction /sdcard/logs/ril/$date!"
fi
logcat -v time > /sdcard/logs/ril/$date/logcat-time.txt &
logcat -v time -b radio > /sdcard/logs/ril/$date/logcat-time.txt &
sleep 18000 && kill -0 $! && kill $!
cd /sdcard/logs/ril/
tar -czf ril$date.tar.gz $date
rm -r $date
cd /
done
The thing, i believe, is that only the logcat -v time -b radio is killed and when it's sleeping it's not doing that in the background.
Sleeping for 18000 seconds (5h), because if it's running for a day the logcat log will be more than 10 mb or so.
Click to expand...
Click to collapse
Hmm. I haven't set up gscript myself yet, but you might need to nohup the logcats to get them to stay once gscript shuts down.
arrrghhh said:
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
Click to expand...
Click to collapse
I have found one issue. It's seems that whenever scbs runs, locat fails to open the log devices. I just disabled scbs and logcat worked. I'm going to try swapping the code around so scbs runs after the logging starts.
It seems scbs blows up logcat, even when it is triggered after logging starts. Ughhh.
Entropy512 said:
Hmm. I haven't set up gscript myself yet, but you might need to nohup the logcats to get them to stay once gscript shuts down.
Click to expand...
Click to collapse
logcat will be going, even when you close the terminal, but when you deleted the files they stop. So that's not a problem, cuz i won't delete.
BTW: is it possible to silently run scripts? Like this one?
./pathtoscript1 & ./pathtoscript2 & ./pathtoscript3
Christiaan91 said:
logcat will be going, even when you close the terminal, but when you deleted the files they stop. So that's not a problem, cuz i won't delete.
BTW: is it possible to silently run scripts? Like this one?
./pathtoscript1 & ./pathtoscript2 & ./pathtoscript3
Click to expand...
Click to collapse
What do you mean "silently run" - do you mean disable any printing to stdout?
./pathtoscript1 &>/dev/null & ; ./pathtoscript2 &>/dev/null &
should do the trick The &>/dev/null routes all output to /dev/null
Man, you guys go way overboard on this stuff. This is my gscript logging script.
Code:
cd /sdcard
mv logg.txt logg.0.txt
mv logr.txt logr.0.txt
nohup logcat -v time > logg.txt &
nohup logcat -v time -b radio > logr.txt &
nohup klogd > klog.txt
highlandsun said:
Man, you guys go way overboard on this stuff. This is my gscript logging script.
Code:
cd /sdcard
mv logg.txt logg.0.txt
mv logr.txt logr.0.txt
nohup logcat -v time > logg.txt &
nohup logcat -v time -b radio > logr.txt &
nohup klogd > klog.txt
Click to expand...
Click to collapse
Yeah, well we don't all have kung-fu coding ablities like you, so we go overboard with what we can overboard with.
Besides, I think it might be beneficial to put something like the code I wrote into the official init, so noobs can more easily provide debug logs.
One thing to keep in mind, busybox = /bin/sh, statically compiled sh is /system/bin/sh. I got tired of not having arrow key support whenever I su'ed (since /bin/su spawns a root /system/bin/sh regardless of what's in /etc/passwd) so I bind mounted /bin/sh (which is a symlink to busybox) over the one in /system in my user.conf. I haven't come across any ill effect, but if you feel that the shell difference may be causing issues, you could try that route, since it's very easy to undo.
-- Starfox
Starfox said:
One thing to keep in mind, busybox = /bin/sh, statically compiled sh is /system/bin/sh. I got tired of not having arrow key support whenever I su'ed (since /bin/su spawns a root /system/bin/sh regardless of what's in /etc/passwd) so I bind mounted /bin/sh (which is a symlink to busybox) over the one in /system in my user.conf. I haven't come across any ill effect, but if you feel that the shell difference may be causing issues, you could try that route, since it's very easy to undo.
-- Starfox
Click to expand...
Click to collapse
Thanks for the tip. I'll give that a shot.
LOL. I'm an idiot
Figured out what the problem was. The file had Windows EOL formatting.
That's what I get for using Windows to edit shell scripts.

[HOW TO] Extract rom.zip from RUU.exe

Hi,
I'm trying to port One V rom to the Desire (my first rom cooking experience).
So I made a small bash script to extract rom.zip file from RUU.exe.
Code:
#!/bin/bash
DEST_DIR=./
WINE_DIR=~/.wine/drive_c/users/*/Temp
ROM=""
PID=0
function usage {
echo "Extract RUU 0.2 of 25 June 2012, by Luc Chante"
echo ""
echo "Usage: extract-ruu [OPTION]... RUU"
echo "Options: "
echo " -d DIR|FILE where to extract the file rom.zip"
echo " ./ by default"
echo " -w DIR directory for wine temporary files"
echo " ~/.wine/drive_c/users/*/Temp by default"
exit 1
}
[ $# -gt 0 ] || usage
while [ $# -gt 1 ]; do
if [ $1 = "-d" ]; then
[ $# -gt 0 ] || usage
shift
DEST_DIR=$1
elif [ $1 = "-w" ]; then
[ $# -gt 0 ] || usage
shift
WINE_DIR=$1
fi
shift
done
[ $# -gt 0 ] || usage
if [ ! -d $WINE_DIR ]; then ls -d $WINE_DIR; exit 1; fi
wine $1 &
PID=$!
TMP=`mktemp`
while [ ${#ROM} -eq 0 ]; do
ROM=`find $WINE_DIR -type f -cnewer $TMP -name rom.zip`
done
kill -9 $PID
if [ -f $ROM ]; then
cp -i $ROM $DEST_DIR
echo "Rom extracted"
else
echo "Rom not found"
fi
Put these lines into a file named extract-ruu, make it executable and juste do :
./extract-ruu RUU_XXXXXXXXXXXXXXX.exe
Wait for a while ... and it's over
don't ever execute with super-user rights !!! (because of kill -9 $PID)
[edit]: version 0.2
- correction of a bug (DEST & DEST_DIR)
- test with a recent file to force 'find' to find the most recent rom.zip file
!!!
I couldn't get the old OpenRUU script to extract my RUU, but this did its job perfectly! props.
Dude you can do it easy with no script, just run the RUU.exe, when the screen pops up with the picture of the device go to the start menu (Windows 7) and type in search *temp* and press enter. When the folder opens search it for ROM.zip and there you go.
CdTDroiD said:
Dude you can do it easy with no script, just run the RUU.exe, when the screen pops up with the picture of the device go to the start menu (Windows 7) and type in search *temp* and press enter. When the folder opens search it for ROM.zip and there you go.
Click to expand...
Click to collapse
The RUU I was using wasn't starting in Vista (I've had too many phone flashing troubles with 7), so I figured I'd just extract it out in Ubuntu. So when I tried that without any script, it decided to crash (which it was going to do anyway since it was missing DLLs) before I could grab the rom.zip out of temp files.
I was tired of it so I just used this so I could just fastboot it and be done.
CdTDroiD said:
Dude you can do it easy with no script, just run the RUU.exe, when the screen pops up with the picture of the device go to the start menu (Windows 7) and type in search *temp* and press enter. When the folder opens search it for ROM.zip and there you go.
Click to expand...
Click to collapse
What about XP?
GrandMstrBud said:
What about XP?
Click to expand...
Click to collapse
Same procedure but you need to go to temp folder in windows XP. Then search for ROM.zip
Sent from my HTC Desire using xda premium
Why you don't port from desire v?
Sent from my HTC Desire using xda premium
rommanager said:
Why you don't port from desire v?
Sent from my HTC Desire using xda premium
Click to expand...
Click to collapse
because its desire v
Sent from my HTC Desire
rommanager said:
Why you don't port from desire v?
Sent from my HTC Desire using xda premium
Click to expand...
Click to collapse
I abandoned the job ...
Desire V seems to be unportable onto the Desire.
And by the way, I'm a linux user, so I don't have Windows 7 "start menu". I made this script under linux.
Maybe the Desire VT328w...
Hey! I was excited to find this thread, because the RUU I'm trying to use will not run or give me the zip in Windows 7, but I am having problems with your script in ubuntu as well. After running ./extract_ruu, I get this:
wine: cannot find L"C:\\windows\\system32\\RUU_PRIMO_C_ICS_40A_Sprint_WWE_VM_1.08.652.6_Radio_1.00.00.0521_2_NV_VM_3.46_0503_PRL61008_release_262414_signed.exe"
dankstahz said:
Hey! I was excited to find this thread, because the RUU I'm trying to use will not run or give me the zip in Windows 7, but I am having problems with your script in ubuntu as well. After running ./extract_ruu, I get this:
wine: cannot find L"C:\\windows\\system32\\RUU_PRIMO_C_ICS_40A_Sprint_WWE_VM_1.08.652.6_Radio_1.00.00.0521_2_NV_VM_3.46_0503_PRL61008_release_262414_signed.exe"
Click to expand...
Click to collapse
Just run it like I said before
Sent from my Galaxy Nexus using Tapatalk 2
The way you said isn't working for me, It be nice if a script was available to extract the rom.zip.
CdTDroiD said:
Just run it like I said before
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
dankstahz said:
Hey! I was excited to find this thread, because the RUU I'm trying to use will not run or give me the zip in Windows 7, but I am having problems with your script in ubuntu as well. After running ./extract_ruu, I get this:
wine: cannot find L"C:\\windows\\system32\\RUU_PRIMO_C_ICS_40A_Sprint_WWE_VM_1.08.652.6_Radio_1.00.00.0521_2_NV_VM_3.46_0503_PRL61008_release_262414_signed.exe"
Click to expand...
Click to collapse
Hi, sorry to answer so late.
Have you a fully functional wine install ?
Because it works just fine for me :
$ extract-ruu RUU_PRIMO_U_ICS_40A_HTC_Europe_1.56.401.2_Radio_20.66.30.0831U_3831.15.00.19_M_release_254696_signed.exe
fixme:storage:create_storagefile Storage share mode not implemented.
/home/luc/.local/bin/extract-ruu : ligne 53 : 5971 Processus arrêté wine $1
Rom extracted
idem with
$ extract-ruu -d test RUU_PRIMO_U_ICS_40A_HTC_Europe_1.56.401.2_Radio_20.66.30.0831U_3831.15.00.19_M_release_254696_signed.exe
Just in case, I'm using archlinux.
[edit]: I also tried with RUU_PRIMO_U_ICS_40A_HTC_Europe_2.22.401.1_Radio_20.76.30.0835U_3831.19.00.120_release_273801_signed.exe succesfully.
How hard is it for someone to use VirtualBox on Linux?
Sent from my Nexus One using Tapatalk 2
eLukas said:
Hi,
Put these lines into a file named extract-ruu, make it executable and juste do :
./extract-ruu RUU_XXXXXXXXXXXXXXX.exe
Wait for a while ... and it's over
don't ever execute with super-user rights !!! (because of kill -9 $PID)
[edit]: version 0.2
- correction of a bug (DEST & DEST_DIR)
- test with a recent file to force 'find' to find the most recent rom.zip file
Click to expand...
Click to collapse
DUDE, you ROCK, your script so saved me and my One X..... Thanks
Thanks, your script saved my one V. Now giving it for repairs. Thank you very much.
anybody any more didn't meet
It says that I can't run this on my 64 bit windows.. is there anything I can do?
eLukas said:
Hi,
I'm trying to port One V rom to the Desire (my first rom cooking experience).
So I made a small bash script to extract rom.zip file from RUU.exe.
Code:
#!/bin/bash
DEST_DIR=./
WINE_DIR=~/.wine/drive_c/users/*/Temp
ROM=""
PID=0
function usage {
echo "Extract RUU 0.2 of 25 June 2012, by Luc Chante"
echo ""
echo "Usage: extract-ruu [OPTION]... RUU"
echo "Options: "
echo " -d DIR|FILE where to extract the file rom.zip"
echo " ./ by default"
echo " -w DIR directory for wine temporary files"
echo " ~/.wine/drive_c/users/*/Temp by default"
exit 1
}
[ $# -gt 0 ] || usage
while [ $# -gt 1 ]; do
if [ $1 = "-d" ]; then
[ $# -gt 0 ] || usage
shift
DEST_DIR=$1
elif [ $1 = "-w" ]; then
[ $# -gt 0 ] || usage
shift
WINE_DIR=$1
fi
shift
done
[ $# -gt 0 ] || usage
if [ ! -d $WINE_DIR ]; then ls -d $WINE_DIR; exit 1; fi
wine $1 &
PID=$!
TMP=`mktemp`
while [ ${#ROM} -eq 0 ]; do
ROM=`find $WINE_DIR -type f -cnewer $TMP -name rom.zip`
done
kill -9 $PID
if [ -f $ROM ]; then
cp -i $ROM $DEST_DIR
echo "Rom extracted"
else
echo "Rom not found"
fi
Put these lines into a file named extract-ruu, make it executable and juste do :
./extract-ruu RUU_XXXXXXXXXXXXXXX.exe
Wait for a while ... and it's over
don't ever execute with super-user rights !!! (because of kill -9 $PID)
[edit]: version 0.2
- correction of a bug (DEST & DEST_DIR)
- test with a recent file to force 'find' to find the most recent rom.zip file
Click to expand...
Click to collapse
This is what i've done: (WIN8x64)
Created a file. Download from the attachments
Place them in C:/cygwin (yes, you need cygwin)
open cygwin, type cd C:/cygwin
Then, ./ruuextract *RUUNAME*
Worked
CdTDroiD said:
Dude you can do it easy with no script, just run the RUU.exe, when the screen pops up with the picture of the device go to the start menu (Windows 7) and type in search *temp* and press enter. When the folder opens search it for ROM.zip and there you go.
Click to expand...
Click to collapse
I tried that with Wildfire S and when I flash it in CWM it says E:Can't open /sdcard/rom.zip (Bad) at the begging.

[TIP] Running random scripts at boot

HTC One M8.
I have done HTCdev with http://htc-one.wonderhowto.com/how-to/unlock-bootloader-root-your-htc-one-m8-0154444/
then rooted
Then did S-OFF with http://firewater-soff.com/instructions/
Then, to be able to write to /system, you need more steps. From recovery, it works easily. From live running system, the default stock ROM has a write protection. This WP can be removed easily by loading a kernel module:
http://forum.xda-developers.com/showthread.php?t=2701816
then:
Code:
insmod /mnt/sdcard/Download/wp_mod_m8.ko
mount -o remount,rw /system
Now, I want to run random scripts.
First, check if the stock ROM has the same issue as my previous phone:
Code:
[email protected]_m8:/ # echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/vendor/bin
[email protected]_m8:/ # ls -l /system/sbin
/system/sbin: No such file or directory
1|[email protected]_m8:/ #
That's exactly what we need: a folder that is in PATH, that does not exist, and should exist somewhere we can create it. So:
Code:
insmod /mnt/sdcard/Download/wp_mod_m8.ko
mount -o remount,rw /system
mkdir /data/local/bin
ln -s /data/local/bin/ /system/sbin
Then, create two small scripts in there: do vi /system/sbin/vibrate , then i to enter insert mode, paste this code, esc, :x ... or use any other editor if you want:
Code:
#!/system/xbin/ash
#
i="$1"
[ "$i" = "" ] && i=400
# default value for voltage_level at boot is 3100 mV.
v=3100
vmin=1200
[ $i -gt 0 ] 2>/dev/null || {
echo "Invalid argument '$i'; should be a number below 9999 ms."
exit 1
}
[ $i -gt 9999 ] && {
echo "Invalid argument '$i'; should be below 9999 ms."
exit 1
}
[ "$2" != "" ] && {
[ $2 -ge $vmin ] 2>/dev/null || {
echo "Invalid argument '$2'; should be a number between $vmin and ${v} mV."
exit 1
}
[ $2 -gt $v ] && {
echo "Invalid argument '$2'; should be below ${v} mV."
exit 1
}
}
[ "$i" = "" ] && { echo "Provide argument: time in ms." ; exit 1 ; }
[ "$2" = "" ] && {
echo "Voltage not provided. Using default $v mV."
} || {
v=$2
echo "Using voltage argument $v mV."
}
echo $v > /sys/devices/virtual/timed_output/vibrator/voltage_level
echo "$i" > /sys/devices/virtual/timed_output/vibrator/enable
It was an old code for HTC Sensation; voltage does not work anymore, but duration does.
A shorter script for flash, and create the init script:
Code:
echo "echo 255 > /sys/class/leds/flashlight/brightness" > /system/sbin/flashlight
echo "#!/system/bin/sh
# /system/etc/init.qcom.bt.sh
/data/local/bin/vibrate
/system/sbin/flashlight" > /data/local/bin/rc.init
chmod 755 /system/sbin/flashlight
chmod 755 /system/sbin/vibrate
chmod 755 /data/local/bin/rc.init
Now, the tricky part: make the init script run at boot. Edit /system/etc/init.qcom.bt.sh , and below the comment, insert this line:
Code:
/data/local/bin/rc.init &
Reboot, enjoy Your phone flashes and vibrates at boot. As is, this is almost useless. But, now you can create system scripts, and run them at boot ... you can do pretty much anything you do on a classic Linux machine.
Because scripts are put in a folder which is in the default system $PATH, all apps or widgets can run those scripts. This vibrate script can be called for example from a Tasker or ScriptManager widget.
I love vibrate, because it's a small noise; I tail it to any command that is likely to take more than 1mn to run. Having a ScriptManager widget running it also helps me check the system load. If phone seems slow, and vibration does not happen at once, then the phone has big load, and I shall wait for things to settle.
/system/etc/init.qcom.bt.sh was not a random choice. To understand why: open /init.target.rc , and now, search a script that is run ... at boot ... with user root ... and that lays in /system. Many scripts are run as user, or stored outside /system.
Now, it's up to you to create scripts that are usefull to you.
Hey thanks for the directions but I tried running the command mnt/sdcard/download/wp_mod.ko and I got a "failed exec format error"....
rgolnazarian said:
Hey thanks for the directions but I tried running the command mnt/sdcard/download/wp_mod.ko and I got a "failed exec format error"....
Click to expand...
Click to collapse
This is completely unrelated and offtopic. Either your file does not have exec bit, or wrong interpreter, or stored on partition that has noexec.
Hmmm ... why is the quoted message different from the one I received by email ???
Any way, even if you are in /, "mnt/sdcard/download/wp_mod.ko" is an invalid command. A module can not be executed, it must be inserted; see tutos about it.

Categories

Resources