Boot loader unlocking (Virtualbox + GNU/Linux) - Sony Ericsson XPERIA X10 Mini

Hi all,
i'm very happy to finally see our hated boot loader unlocked!
By the way i was following the_laser steps to unlock it but i'm on a GNU/Linux machine
(Archlinux) so i tried the Virtualbox way noticing that "s1tool" for checking if the phone
is unlockable or not works fine but the batch "msm7227_semc.cmd" isn't at all (maybe
"adb" doesn't communicate very well through Virtualbox USB virtualization, i don't know),
so i port the batch as a shell script and it works.
It's not good to keep it in my laptop so here it is:
Code:
#!/bin/sh
#
# msm7227_semc.sh - a simple step-by-step port of msm7227_semc.cmd
# by [email protected]
#
# 2011 - Alessandro "ff0000.it" Massignan
#
COUNT=0
function error ()
{
MESSAGE=$1
echo "Error: ${MESSAGE}"
exit 1
}
function step ()
{
COUNT=$(( COUNT + 1 ))
MESSAGE=$1
printf "\n${COUNT}. ${MESSAGE}"
read
}
cat <<EOF
******************************************************
*** Process requires standard Android 2.x firmware ***
*** -= now it's up to you! ;-) =- ***
******************************************************
EOF
step "searching for 'adb' executable"
_WHICH=`which which 2>/dev/null` || { error "Missing tool: which"; }
_ADB=`${_WHICH} adb 2>/dev/null` || { error "Missing tool: adb"; }
step "getting root priviledges"
echo "waiting for device..."
$_ADB wait-for-device
echo "pushing exploit..."
$_ADB push bootTools/rageagainstthecage /data/local/tmp/expl || \
{ error "Failed to push the exploit"; }
$_ADB shell "chmod 777 /data/local/tmp/expl" || \
{ error "Failed to change permission on exploit"; }
echo "executing exploit..."
$_ADB shell "/data/local/tmp/expl" || \
{ error "Failed to execute the exploit"; }
echo "waiting for device..."
$_ADB wait-for-device
step "removing NAND MPU restrictions via SEMC backdoor (this is permanent)"
$_ADB push bootTools/fixPart /data/local/tmp/fixPart || \
{ error "Failed to push the backdoor"; }
$_ADB shell "chmod 777 /data/local/tmp/fixPart" || \
{ error "Failed to change permission on backdoor"; }
$_ADB shell "/data/local/tmp/fixPart" || \
{ error "Failed to execute the backdoor"; }
echo "Rebooting..."
$_ADB shell reboot
echo "Waiting for device..."
$_ADB wait-for-device
step "re-getting root priviledges (wait for complete boot process)"
$_ADB shell "/data/local/tmp/expl" || { exit 1; }
echo "Waiting..."
$_ADB wait-for-device
step "getting access to semcboot area"
$_ADB push bootTools/mapper_2.6.29.ko /data/local/tmp/mapper_2.6.29.ko || \
{ error "Failed to push maper module"; }
$_ADB shell "chmod 777 /data/local/tmp/mapper_2.6.29.ko" || \
{ error "Failed to change permission on mapper module"; }
$_ADB shell insmod /data/local/tmp/mapper_2.6.29.ko || \
{ "Failed to load maper module into kernel"; }
step "writing semcboot"
$_ADB push my7227bootwrite_semcSL /data/local/tmp/my7227bootwrite_semcSL || \
{ error "Failed to push semcbooti data"; }
$_ADB shell "chmod 777 /data/local/tmp/my7227bootwrite_semcSL" || \
{ error "Failed to change permission on semcboot data"; }
$_ADB shell "/data/local/tmp/my7227bootwrite_semcSL" || \
{ error "Failed to execute semcboot data"; }
step "All done."
exit 0
copy this one and put it as msm7227_semc.sh in msm7227 directory (the one you obtain extracting the archive built by the_laser, http://forum.xda-developers.com/showthread.php?t=1254225), enter the directory
and execute it:
Code:
[email protected]:msm7227# sh ./msm7227_semc.sh
******************************************************
*** Process requires standard Android 2.x firmware ***
*** -= now it's up to you! ;-) =- ***
******************************************************
1. searching for 'adb' executable
2. getting root priviledges
waiting for device...
pushing exploit...
2324 KB/s (585731 bytes in 0.246s)
executing exploit...
waiting for device...
3. removing NAND MPU restrictions via SEMC backdoor (this is permanent)
12 KB/s (3087 bytes in 0.240s)
success
Rebooting...
Waiting for device...
4. re-getting root priviledges (wait for complete boot process)
Waiting...
5. getting access to semcboot area
154 KB/s (8064 bytes in 0.051s)
6. writing semcboot
1294 KB/s (596916 bytes in 0.450s)
successfully wrote 0003ff00
7. All done.
[email protected]:msm7227#
*** each step has to be confirmed by pressing a key ***
It requires "adb" executable in one of the directory listed in $PATH variable.
It works for me so it has to work for you ;-)
Happy unlocking and endless kudos to the_laser ,
ff0000

THANK YOU! Im on linux and had to use my rubbishy windows machine to do bl unlock also QEMU might be better for USB as the android emulator runs it and that works fine
Sent from my U20i using XDA App

x10man said:
THANK YOU! Im on linux and had to use my rubbishy windows machine to do bl unlock also QEMU might be better for USB as the android emulator runs it and that works fine
Sent from my U20i using XDA App
Click to expand...
Click to collapse
It's been a (long) while since i don't use Qemu (maybe i could give it a chance ;-)... the annoying thing is that folks here at XDA isn't so Opensource-proned and don't tend to share their sources :-/, for this unlocking procedure you've to bow down to Windows for the s1tool and that's so-so-so-so-so-so-so-so-so boring... on the other hand if s1tool's sources is available, someone could port it to GNU/Linux in order to have a complete platform independent task... but that's only my point of view i don't want to mess up with great gifts we receive from XDA
Cheers,
ff0000

Yeah its kinda sad that androids based off of linux but most of its utilities are windoze.... Yeah on sources it is useful to release but sometimes not
Sent from my U20i using XDA App

x10man said:
Yeah its kinda sad that androids based off of linux but most of its utilities are windoze.... Yeah on sources it is useful to release but sometimes not
Sent from my U20i using XDA App
Click to expand...
Click to collapse
I think sharing informations (in this case code sources) is always good to give people the opportunity to learn so to evolve... and i have no relationship with Richard Stallman at all! :-DDD

SteveBallmer said:
Monkey Dance to you! (me no like that idea oo oo ah ah!)
Click to expand...
Click to collapse
thats all i have to say to this.

Sorry. One off troll plus it was a jab at ballmer
Anyway have you tried asking the_laser for sources? He may give you them if you say you are porting to linux
Sent from my U20i using XDA App

x10man said:
Sorry. One off troll plus it was a jab at ballmer
Anyway have you tried asking the_laser for sources? He may give you them if you say you are porting to linux
Sent from my U20i using XDA App
Click to expand...
Click to collapse
No problem mate, i still can't do the monkey dance X-D... i should try in a drunken state X-DDD...
I asked him to include the script in the msm7227 package but it'd be better to ask the source of s1tool so i could totally port (if i'm able to ).
By the way, do any of you try my script?!? Is it working?
Thanks x10man,
ff0000.it

Cool man! I'll give it a shot. You should link to the original thread though

kissmyarch said:
Cool man! I'll give it a shot. You should link to the original thread though
Click to expand...
Click to collapse
Thanks mate,
in these day i'll see if it could be included in the_laser's package but first i've to be sure to be able to port s1tool or we stay with a foot on Windows and the other on GNU/Linux and that's not good

And what about flashtool? Is there a linux alternative? because I'm using it through Virtualbox and it's a little bit annoying.
Sorry I can't try your script since I've already unlocked... but thanks anyway.

ambrosiosanchez said:
And what about flashtool? Is there a linux alternative? because I'm using it through Virtualbox and it's a little bit annoying.
Sorry I can't try your script since I've already unlocked... but thanks anyway.
Click to expand...
Click to collapse
You could use Flashtool in GNU/Linux with Mono, but i never try it (however that's another annoying point)
I run the script on my unlocked phone and it worked fine (the_laser told me that i could run it how many times i want to) ;-)

But guys flashtool is on java! So you run it by
Code:
java -jar flashtool.jar
I've done it before
Oh and ff0000.it could you please include in your first post the download links of what we need to run with your script?
It's nice to have them all in one place rather than searching among several posts. Thanks!

i cant do a full unlock test but i can test on already unlocked if its ok and off topic i am able to do the monkey dance quite well btw there is a hilarious vid on utube called best of ballmer watch it. soooo funny LINUX FTW! btw what distro u on im either openSUSE or crunchbang depends on mood im in

kissmyarch said:
But guys flashtool is on java! So you run it by
Code:
java -jar flashtool.jar
I've done it before
Oh and ff0000.it could you please include in your first post the download links of what we need to run with your script?
It's nice to have them all in one place rather than searching among several posts. Thanks!
Click to expand...
Click to collapse
You're totally right... i was writing about Flashtool and thinking about SuperOneClick... my moronic brain has stricken again!
I added the link to the unlocking guide that has the link to the package ;-)

kissmyarch said:
But guys flashtool is on java! So you run it by
Code:
java -jar flashtool.jar
I've done it before
Oh and ff0000.it could you please include in your first post the download links of what we need to run with your script?
It's nice to have them all in one place rather than searching among several posts. Thanks!
Click to expand...
Click to collapse
Thanks! much easier than Virtualbox

Great! I just had to change the top line to #!/bin/bash (syntacs error with the sh interpreter) and run the script as root.

Related

[development] Ubuntu as an app on Nook Tablet

This is a development thread. Do not post "good job", or "great idea", or "cool, i'm trying this now".. I want feedback.
Introduction
This is a precursor to a possible way of running a custom kernel and ROM on the Nook Tablet in a chroot environment. I've been working on an Android app and almost have a usable installer for my AndBuntu project. If we are sucessful, this installer can be converted to a Un-Nook-er app "AndNook" which may be used to install custom kernels and ROMs with additional work.
So, with that said, lets get to it.
You will need:
This is all the software you will need to run this script. If you don't have a Debian Linux based computer, you can dual boot, install Ubuntu within Windows, or run it from a memory stick.
A rooted Nook Tablet
Android Market installed on the Nook Tablet
Busybox Installed on the Nook Tablet
A Terminal Emulator installed on the Nook Tablet
A VNC viewer Installed on the Nook Tablet
A Linux computer, dual boot or run from a memory stick
Getting started
The basic process will go like this.. Generate an image in Ubuntu, put that on your /sdcard/Ubuntu folder and then execute a script
On the Linux computer execute the following code block
Code:
cd ~/Desktop
sudo apt-get install rootstock
sudo rootstock --dist maverick --seed lxde,tightvncserver,openoffice.org,gimp,ssh --fqdn localhost --login ubuntu --password ubuntu --imagesize 3800M --notarball --fullname "Ubuntu for Android" --kbmodel pc104 --locale en_US.UTF-8 --serial ttyS0 --doswap --swapsize 256M
This will take a while, and it will generate a image file with a bunch of charactors like ***************.img.
rename this file "ubuntu.img" without the quotes
create a folder on the Nook Tablet called "/sdcard/ubuntu". (that's internal storage folder "/ubuntu/")
copy the "ubuntu.img" file to the folder
copy THIS SCRIPT to your sdcard/ubuntu/ folder and name it "uboot".
launch the terminal emulator and execute the following code block
Code:
su
sh /sdcard/ubuntu/uboot
Paste the output of that command here. If it failed stop. If it worked, keep going
in the Ubuntu environment execute the following code block
Code:
/firstRun
tightvncserver
tightvncserver may ask you for a password
Launch your VNC Viewer app
Specify 127.0.0.1 as the connection address. Use your password which you selected in previous code block.
Please note, the script is designed for a Samsung Android device. There is a line in the SH script
Code:
export UbuntuLoopFS=/sdcard/ubuntu/ubuntu.img
This line may require modification.
I'm looking for feedback. If you cannot understand what's going on, please don't post. This is not user friendly.
I take no responsibility or liability for anything which may happen to your device. This may force your device into a boot loop 8 times and your device will be factory restored. If it does, please let me know and I will make changes accordingly.
I am interested in trying this but
How much data will need to be downloaded, I currently only have "borrowed" WiFi and cell phone
And does this give you a fully usable ubuntu with desktop and ability to install linux apps
thanks for info
little8020 said:
I am interested in trying this but
How much data will need to be downloaded, I currently only have "borrowed" WiFi and cell phone
And does this give you a fully usable ubuntu with desktop and ability to install linux apps
thanks for info
Click to expand...
Click to collapse
about 2-400 megs
Not sure if it makes a difference, but the NT mounts the sdcard at /mnt/sdcard
Any way, though, I have a Linux Mint (based on Ubuntu) distro installed through VirtualBox, and I'll throw together an Ubuntu installation as well right now. I'm more than willing to help out.
(misinterpreted the meaning of 'feedback'. Apologies.)
EDIT 2: Turning this into a useful post. Hopefully this is the kind of bull**** you want. If not, I'll try again!
Tried the image build on a system running Oneiric. Receive segfaults when attempting to add CA certs to java.
Code:
Setting up ca-certificates-java (20100412) ...
creating /etc/ssl/certs/java/cacerts...
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
/var/lib/dpkg/info/ca-certificates-java.postinst: line 40: 16110 Segmentation fault LANG=C LC_ALL=C keytool -importcert -trustcacerts -keystore $KEYSTORE -noprompt -storepass "$storepass" -alias "$alias" -file "$cacertdir/$pem" > $log 2>&1
/var/lib/dpkg/info/ca-certificates-java.postinst: line 40: 16113 Segmentation fault LANG=C LC_ALL=C keytool -importcert
trustcacerts -keystore $KEYSTORE -providerClass sun.security.pkcs11.SunPKCS11 -providerArg '${java.home}/lib/security/nss.cfg' -noprompt -storepass "$storepass" -alias "$alias" -file "$cacertdir/$pem" > $log 2>&1
error adding brasil.gov.br/brasil.gov.br.crt
Many segfaults follow. One for each cert it tried to install. Image build abends shortly after with an error code 1 in sub-process /usr/bin/dpkg.
At first I thought this might be due to my use of OpenJDK. I removed OpenJDK, installed Sun/Oracle JDK and experienced same. This may be Oneiric-specific. For giggles I'm trying oneiric as the dist in a follow-up build on this machine, and also moving to a second Ubuntu box that's running Maverick for another try at the original instructions. Will edit this post with future updates.
AdamOutler said:
[*]On the Linux computer execute the following code block
Code:
cd ~/Desktop
sudo apt-get install rootstock
sudo rootstock --dist maverick --seed lxde,tightvncserver,openoffice.org,gimp,ssh, -fqdn localhost --login ubuntu --password ubuntu --imagesize 3800M --notarball --fullname "Ubuntu for Android" --kbmodel pc104 --locale en_US.UTF-8 --serial ttyS0 --doswap --swapsize 256M
This will take a while, and it will generate a image file with a bunch of charactors like ***************.img.
Click to expand...
Click to collapse
Arg, I let this go for ~an hour on my netbook and got a long way through the process before I got:
Code:
/usr/bin/stat: cannot read file system information for `/home/UserUser': No such file or directory
Segmentation fault
Can this be done on a 64-bit installation of ubuntu? I have that on the more powerful desktop downstairs.
You know that this is already in the market... Ubuntu install guide. An image of 10.10 for Arm is linked in the app along with the script to start it. I have it installed and running. Only issue I have is that the resolution is lower than Blaze as the image is designed for phones.
Sent from my BNTV250 using xda premium
liquidzoo said:
Not sure if it makes a difference, but the NT mounts the sdcard at /mnt/sdcard
Any way, though, I have a Linux Mint (based on Ubuntu) distro installed through VirtualBox, and I'll throw together an Ubuntu installation as well right now. I'm more than willing to help out.
Click to expand...
Click to collapse
mint will work.
LouZiffer said:
Personally I'd like the option of a slimmed down version that doesn't include the overhead of X/VNC, though I can understand the advantages of a GUI from a usability standpoint. That's a simple matter of generating an image without those options, but you might want to consider it if you're offering pre-generated images or scripts for download at some point.
Sent from my HTC Evo Design 4G using XDA Premium
Click to expand...
Click to collapse
This is the kind of bull**** I don't want in this thread. Congratulations on wasting a post.
jeph36 said:
Arg, I let this go for ~an hour on my netbook and got a long way through the process before I got:
Code:
/usr/bin/stat: cannot read file system information for `/home/UserUser': No such file or directory
Segmentation fault
Can this be done on a 64-bit installation of ubuntu? I have that on the more powerful desktop downstairs.
Click to expand...
Click to collapse
you need to log in as a full user. UserUser is not a valid user. Useruser does not have a home folder.
AdamOutler said:
you need to log in as a full user. UserUser is not a valid user. Useruser does not have a home folder.
Click to expand...
Click to collapse
It actually was "/home/jeph36/" where 'jeph36' is my normal ubuntu login. When I posted I thought maybe I should change it for some privacy reason, only to later realize that it is my xda user name anyway. I assume by "full user" you just mean the user that I use to login.
Edit: I tried again on the same computer with the same result. I am not sure what is missing. Unfortunately I can not stay up later to try on a different computer or with a new install (new 3-day old baby, work tomorrow, etc). Hopefully someone else has this working by tomorrow afternoon/evening, but if not I will get on it then.
AdamOutler said:
This is a development thread. Do not post "good job", or "great idea", or "cool, i'm trying this now".. I want feedback.
<QUOTE SNIP>
.
Click to expand...
Click to collapse
Saw a few mistakes such as "sh /sdcard/uboot" Shouldnt it be "sh /sdcard/ubunbtu/uboot"? I am currently n the proccess of getting ubuntu up and running in virtualbox and will be trying this out once i get this up and running for you.
Edit: The rootstock command did not work for me on ubuntu 10.04 it just spits out the command usage spill. IT installed rootstock just fine tho. so I am lost at the moment until I get some feedback of my own here. do I need to iunstall anything ontop of my fresh ubuntu install to get this working?
Edit got the command working but its still flawed big time as it keeps kicking out errors at me. You are going to want to take a good look at it and fix it.
Ed ok I managed to create the image file and here is the command i used to do it
Code:
sudo rootstock --dist maverick --seed lxde,tightvncserver,openoffice.org,gimp,ssh, -f localhost --l ubuntu --p ubuntu --imagesize 3800M --notarball --fullname "Ubuntu for Android" --kbmodel pc104 --locale en_US.UTF-8 --serial ttyS0
Not sure if it will work correctly or not but I am going to find out soon.
Edit: Ok got it transfered over and ran the "sh /sdcard/ubuntu/uboot" Command and this is the output from it
Code:
: permission denied
"
"
"
"
"
"
"
"
"
The command executed failed. please search for this command on Google. IF that fails, try [url]www.ubuntuforums.org[/url].
: permission denied
"
"
"
Setting up environmental variables
test: permission denied
Environmental is:
/sdcard/ubuntu/uboot: 96: Syntax error: "else" unexpected (expecting "then")
Montisaquadeis said:
Saw a few mistakes such as "sh /sdcard/uboot" Shouldnt it be "sh /sdcard/ubunbtu/uboot"? I am currently n the proccess of getting ubuntu up and running in virtualbox and will be trying this out once i get this up and running for you.
Edit: The rootstock command did not work for me on ubuntu 10.04 it just spits out the command usage spill. IT installed rootstock just fine tho. so I am lost at the moment until I get some feedback of my own here. do I need to iunstall anything ontop of my fresh ubuntu install to get this working?
Edit got the command working but its still flawed big time as it keeps kicking out errors at me. You are going to want to take a good look at it and fix it.
Ed ok I managed to create the image file and here is the command i used to do it
Code:
sudo rootstock --dist maverick --seed lxde,tightvncserver,openoffice.org,gimp,ssh, -f localhost --l ubuntu --p ubuntu --imagesize 3800M --notarball --fullname "Ubuntu for Android" --kbmodel pc104 --locale en_US.UTF-8 --serial ttyS0
Not sure if it will work correctly or not but I am going to find out soon.
Edit: Ok got it transfered over and ran the "sh /sdcard/ubuntu/uboot" Command and this is the output from it
Code:
: permission denied
"
"
"
"
"
"
"
"
"
The command executed failed. please search for this command on Google. IF that fails, try [url]www.ubuntuforums.org[/url].
: permission denied
"
"
"
Setting up environmental variables
test: permission denied
Environmental is:
/sdcard/ubuntu/uboot: 96: Syntax error: "else" unexpected (expecting "then")
Click to expand...
Click to collapse
try as superuser.. I'm downloading right now, later I'll tell if work
AdamOutler said:
mint will work.
Click to expand...
Click to collapse
Excellent, I will do this tonight and post results.
Montisaquadeis said:
Edit: Ok got it transfered over and ran the "sh /sdcard/ubuntu/uboot" Command and this is the output from it
Code:
: permission denied
"
"
"
"
"
"
"
"
"
The command executed failed. please search for this command on Google. IF that fails, try [url]www.ubuntuforums.org[/url].
: permission denied
"
"
"
Setting up environmental variables
test: permission denied
Environmental is:
/sdcard/ubuntu/uboot: 96: Syntax error: "else" unexpected (expecting "then")
Click to expand...
Click to collapse
I believe it should be sh /mnt/sdcard/ubuntu/uboot (though it appears that may be what you input), and it should be done as root.
Ok after giving terminal emulator root access all those permisson denied turn into not found. so that script dont work either way. the rest of that output stayed the same.
The script must be edited to the absolute path for the Ubuntu image.
good job, great idea, this is cool, i'm trying this now
AdamOutler said:
The script must be edited to the absolute path for the Ubuntu image.
Click to expand...
Click to collapse
I have the image on the sdcard in a folder called ubuntu and the file name is ubuntu.img
I would assume that is where the script is looking for the image and its there on the sdcard in the folder named ubuntu and the file is ubuntu.img
The image parameters were wrong..
sudo rootstock --dist maverick --seed lxde,tightvncserver,openoffice.org,gimp,ssh, -fqdn localhost --login ubuntu --password ubuntu --imagesize 3800M --notarball --fullname "Ubuntu for Android" --kbmodel pc104 --locale en_US.UTF-8 --serial ttyS0 --doswap --swapsize 256M
should have been
Code:
sudo rootstock --dist maverick --seed lxde,tightvncserver,openoffice.org,gimp,ssh -fqdn localhost --login ubuntu --password ubuntu --imagesize 3800M --notarball --fullname "Ubuntu for Android" --kbmodel pc104 --locale en_US.UTF-8 --serial ttyS0 --doswap --swapsize 256M
See that? I didn't either... the comma after "ssh" should not be there.
Not sure if it's going to make a difference, but I am getting an error when running the (corrected) rootstock command:
Unable to open a folder for 4.0 GB Filesystem
No application is registered as handling this file
Click to expand...
Click to collapse
It's still running, so maybe it won't matter. This is on a 20GB (total, split 500M /boot, 10G /, 9.5G /home) VirtualBox Mint system.
And they are still wrong it should be -f localhost --l ubuntu --p ubuntu not -fqdn localhost --login ubuntu --password ubuntu
Montisaquadeis said:
And they are still wrong it should be -f localhost --l ubuntu --p ubuntu not -fqdn localhost --login ubuntu --password ubuntu
Click to expand...
Click to collapse
-f and --fqdn are interchangeable, but you're right, if you use fqdn it needs another dash, though you're wrong about --l and --p, it's either --login and --password or -l and -p Again, they're interchangeable.
The shorter way would be:
sudo rootstock -d maverick -s lxde,tightvncserver,openoffice.org,gimp,ssh, -f localhost -l ubuntu -p ubuntu -i 3800M --notarball -n "Ubuntu for Android" --kbmodel pc104 -x en_US.UTF-8 --serial ttyS0 --doswap --swapsize 256M
Click to expand...
Click to collapse
Though, for some reason, the -s switch doesn't seem to work (on my version) in place of --seed

[TOOLS] [LINUX, MAC, WINDOWS] Knives & Forks - v. 12.02.04

Knives & Forks
WHAT IS IT?
Knives & Forks is a set of Android tools for everyone. Every operating system, every device.
This cross-platform Android toolkit, written in Python, that is designed to work in Linux, Mac OS X or Windows. I wanted to create something that was unique, and offered a consistent and feature-filled set of tools for Android devs no matter what operating system they use, and for as many Android devices as possible.
WHAT DOES IT DO?
I just started work on this project, so it doesn't do very much yet. Right now we are just focusing on getting drivers and adb installed for as many devices as we can on all three platforms. Once we have adb working for everyone, the real fun can begin as we start to add more device tools that will make use of adb, such as rooting. Eventually ROM customization tools will be added, but we are focusing on device tools and cross-platform compatibility at this time.
View the changelog to see a list of included drivers. The only device that I can confirm is compatible with this script in Linux, Mac OS X, and Windows is the Samsung Galaxy S II, Sprint Epic 4G Touch. This just so happens to be my personal phone, but as I gather feedback I will create an official list of supported devices.
WHERE DO I GET IT?
This project is now being hosted by the Android Creative Syndicate. An up to date link to the most current version of the script, installation instructions for Linux, Max OS , and Windows, and other information can be found HERE. Registration is not required at the ACS forum to download or view installation instructions. You are free to reply in the thread you are reading right now if you don't want to register for another forum.
I HAVE IT INSTALLED, NOW WHAT?
You should be able to open up your terminal application (or command prompt) and run some adb commands. In the future we will be automating adb commands for you, but for now you can try the following as a simple test:
Code:
adb reboot
If everything worked, your Android device should reboot. For further reading on what you can do with adb you can read THIS PAGE.
HOW TO SUPPORT THIS PROJECT
FEEDBACK
Download my script, test it, let me know what happens. Let me know what other features/tools I should add.
THANKS
Hit the thanks button if you like what I'm doing here.
DONATIONS - I don't currently have a link to send me money, but I could quickly set something up if somebody decides they want to help me feed my kid. I am recently unemployed, but I am not relying on my scripting skills to feed my family. Save your cash for a more worthy project, or tuck it away and wait until the project turns into something amazing.
INFORMATION
TELL ME ABOUT YOUR ANDROID DEVICES!
If my script isn't getting adb setup for your device, let me know where to download the correct Windows driver and/or what udev rules I need to add in Linux.
The next phase of this project will be automating the rooting process. If you know the process for rooting your device, please share the details.
HOW TO REPLY TO THIS THREAD
Please do not reply by saying something like "This looks awesome, I'm going to download it now!".
Just download it, test it out, and then tell me about it.
If my script works for you, please don't post something like "It worked for me, this is the best thing since sliced bread!".
At the moment all my script will do is install adb and drivers for your device. In order to test please uninstall any drivers you may have already installed, run my script, then reply with the following information:
Operating System (including version and 32-bit or 64-bit architecture)
Android Device
If you open up a terminal/command prompt window and enter the following command, does your device reboot? If not, do you receive any error messages (while running that command or at any phase of running the Kinves & Forks script)?
Code:
adb reboot
CHANGELOG
Code:
------------------------------------------------------------------------------------
Knives & Forks: Changelog
------------------------------------------------------------------------------------
The most current version is available for download from:
http://knivesandforks.info/releases/knives-and-forks-current.php
**** 12.02.04 ****
http://knivesandforks.info/releases/knives-and-forks-12.02.04.php
- LINUX CHANGES:
-- "python2" is now called by "Knives-and-Forks-Linux.sh" instead of "python" on Arch.
- This prevents starting the script with Python 3, which results in errors.
-- Changes to "scripts/linux/install-adb-linux.sh":
- "su" will be used if "sudo" is not installed, or user doesn't have permissions to use it.
- Added 32-bit libs for more 64-bit distros:
- Arch (new in this release)
- CentOS (new in this release)
- Debian
- Fedora (new in this release)
- Ubuntu, Kubuntu, Xubuntu
- Added Debian version of '/etc/udev/rules.d/99-android.rules'
- Added '/lib/udev/rules.d/92-permissions.rules' for Debian.
This should fix permissions, allowing adb to run without sudo or su.
- WINDOWS CHANGES:
-- Fixed a couple of missing quotes which were breaking things under Windows XP
- "%userprofile%" was coming back as "c:\documents" instead of "c:\documents and settings\username" in a couple of places
-- "c:\python27" is now the only directory where we look for python.exe
- It is faster to download and install Python to "c:\Python27" than it is to search for it elsewhere.
- This will also prevent issues where Python 3 was installed instead of Python 2, since the script currently gives errors under Python 3.
-- Updated amd64 and x86 versions of setx.exe for updating system PATH on XP/VISTA/7
-- PATH is updated with adb.exe location after Python is installed.
-- The computer will now reboot after updating the PATH, to make sure it will be updated before running the main program.
**** 12.01.27 ****
http://knivesandforks.info/releases/knives-and-forks-12.01.27.php
- GENERAL CHANGES:
-- After adb is installed, adb will reset the android device by running "adb reboot" instead of displaying a list of attached devices with "adb devices".
adb was occasionally reporting no devices were attached, when they infact were. When this happened "adb reboot" still worked, so it is a better test to see if adb is setup properly.
-- Friendlier messages during adb install and testing
-- Added a startup check to make sure the script is running from the correct directory
-- Removed empty Project directory, as it is not being used yet.
- LINUX CHANGES:
-- Added support for "lxterminal" and "urxvt" in "Knifes-and-Forks-Linux.sh"
-- Changed idVendors for Linux udev rules to lowercase instead of uppercase.
- WINDOWS CHANGES:
-- Startup script searches for python in "C:\Program Files (x86)" then "C:\Program Files" and "c:\" last.
-- Drivers should now install even if the language is not English
-- Added drivers for Casio C771 G'zOne Commando
-- Added LG drivers
-- Replaced setx.exe
**** 12.01.25 ****
http://knivesandforks.info/releases/knives-and-forks-12.01.25.php
- Replaced "Knives-and-Forks-Mac.sh" with "Knives-and-Forks-Mac.app".
Starting the script on a Mac should now be as simple as double-clicking the new .app file.
**** 12.01.24 ****
http://knivesandforks.info/releases/knives-and-forks-12.01.24.php
- Fixed a typo which caused the script to crash when viewing the credits screen.
- Smarter python fix for Windows users.
-- "C:\" and all sub-directories are searched for python.exe.
-- If python is not not found, it will be downloaded from python.org and installed to c:\python27.
-- If python is found (in "C:\python27", "c:\python", "c:\xyz123", "c:\program files\python27" or in any directory with any name anywhere on drive c:) the main menu script will launch.
- Added changelog.txt to the release .zip file.
**** 12.01.23 ****
http://knivesandforks.info/releases/knives-and-forks-12.01.23.php
- Minor update to fix Python installation for Windows users, which was causing the script not to launch.
**** 12.01.22 ****
(FIRST PUBLIC RELEASE)
http://knivesandforks.info/releases/knives-and-forks-12.01.22.php
- Added option to install adb & fastboot for Linux, Windows, Mac
- Added Linux drivers for:
-- ACER
-- ASUS
-- DELL
-- FOXCONN
-- GARMIN-ASUS
-- Google
-- Hisense
-- HTC
-- HUAWEI
-- K-TOUCH
-- KT Tech
-- KYOCERA
-- LENEVO
-- LG
-- MOTOROLA
-- NEC
-- NOOK
-- NVIDIA
-- OTGV
-- PANTECH
-- PEGATRON
-- PHILIPS
-- PMC-SIERRA
-- QUALCOMM
-- SK TELESYS
-- SAMSUNG
-- SHARP
-- SONY ERICSSON
-- TOSHIBA
-- ZTE
- Added Mac drivers for:
-- Nothing. According to Google, "It just works." Let me know if they are right.
- Added a custom Windows installer with drivers for:
-- GOOGLE
-- HTC
-- HUAWEI
-- SAMSUNG
WHERE DID THE OLD POSTS GO?
In an attempt to reduce unnecessary clutter in my original thread, I created supporting threads in each Android device forum. The whole reason behind posting so many times was to keep certain information in the Chef Central post, and certain information out of it in an effort to reduce clutter. Who wants to read through 50 pages of how this, that, and the other thing is or isn't working on devices that you don't own? That system appeared to work very well, but apparently I broke the rules by posting in every Android device forum.
Learn from my mistakes, don't post similarly worded posts all over the place!
ATTENTION PYTHON PROGRAMMERS:
Any idea on what I can do to make the Python files work in Python 2 and Python 3? I have only tested in Python 2.7.2, but I have received reports that Python 3 gives errors. I'm not really doing anything all that fancy, so I'm not sure if something is just a matter or new syntax or something else needs to be imported or what. Any help would be appreciated.
The next release will call "python2" for Arch Linux users since "python" will use python 3.
ATTENTION LINUX USERS:
I am currently testing my Knives & Forks script in some virtual machines using VirtualBox, as well as my local Xubuntu installation.
For distro specific things (installing 32-bit libs, udev changes, etc) in the next release I will be detecting the distro using the following code:
Code:
echo " -- DETECTING LINUX DISTRO --"
if [ "`cat /etc/issue | grep Arch | wc -l`" == "1" ]; then
DISTRO_NAME="Arch"
elif [ "`cat /etc/issue | grep Cent | wc -l`" == "1" ]; then
DISTRO_NAME="CentOS"
elif [ "`cat /etc/issue | grep Debian | wc -l`" == "1" ]; then
DISTRO_NAME="Debian"
elif [ "`cat /etc/issue | grep Fedora | wc -l`" == "1" ]; then
DISTRO_NAME="Fedora"
elif [ "`cat /etc/issue | grep Ubuntu | wc -l`" == "1" ]; then
# DETECTS UBUNTU, KUBUNTU, XUBUNTU, ETC
DISTRO_NAME="Ubuntu"
else
DISTRO_NAME="UNKNOWN"
fi
echo " - $DISTRO_NAME"
Please let me know what other distros your using and if you are able to find the name using the "/etc/issue" method I am using in the above if statements.
I wrote a bash function to check if sudo is installed, and then to see if the current user has permissions to use sudo. If sudo is not installed, or if the current user does not have permission to use it, su will be used instead. This will be included in my next update, but I wanted to post it here first:
Code:
echo " -- CHECKING TO SEE IF 'SUDO' IS INSTALLED --"
CURRENT_USER=$USER
USE_SUDO="NO"
if [ -f "/usr/bin/sudo" ]; then
echo " - 'sudo' is installed."
echo ""
echo " -- CHECKING FOR PERMISSION TO USE 'SUDO' --"
echo ""
echo " If prompted, enter the password for the user '$CURRENT_USER'."
echo ""
if [ "$(sudo whoami)" != "root" ]; then
echo ""
echo " - Sorry, '$CURRENT_USER' does not have permission to use 'sudo'."
echo " - 'su' will be uses instead of 'sudo'."
echo ""
else
echo " - '$CURRENT_USER' has permission to use 'sudo'."
USE_SUDO="YES"
echo ""
fi
else
echo " - 'sudo' is not installed."
echo " - 'su' will be used instead of 'sudo'."
echo ""
fi
DO_SU()
{
echo ""
if [ $USE_SUDO == "YES" ]; then
# echo " -- USING 'SUDO' TO RUN '$1' --"
echo ""
echo " If prompted, enter the password for the user '$CURRENT_USER'."
echo ""
sudo $1
else
# echo " -- USING 'SU' TO RUN '$1' --"
echo ""
echo " If prompted, enter the password for the user 'root'."
echo ""
su -c "$1"
fi
echo ""
}
# EXAMPLE USAGE OF THE DO_SU() FUNCTION:
# NOTE THAT THE COMMAND TO RUN WITH SU OR SUDO HAS TO BE IN QUOTES
DO_SU "whoami"
I also found out why debian users were being forced to use sudo or su in order to use adb. The next release will include this fix, but for those who might be interested in making this change manually:
Open "/lib/udev/rules.d/91-permissions.rules" as root (su or sudo) in your favorite text editor and find this line
Code:
usbfs-like devices SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, \ MODE=”0664″
Change MODE to "0666"
Code:
usbfs-like devices SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, \ [B]MODE=”0666“[/B]
Instead of replacing or modifying your "/lib/udev/rules.d/91-permissions.rules" file, the next version of my script will actually create a "/lib/udev/rules.d/92-permissions.rules" for Debian users that contains only the following:
Code:
# usbfs-like devices
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
MODE="0666"
This file will load right after the 91-permissions.rules and replace just the usbfs-like devices settings. I'm just doing this with my script so I don't accidently break anything on your system. If you are making the changes manually, editing the 91-permissions.rules file should be all you need to do.
Save your changes and then restart udev as root (using sudo or su)
Code:
/etc/init.d/udev restart
-- or --
Code:
service udev restart
This assumes of course that you already have a working udev rule for your android device, and that adb is working only with su or sudo currently. Once this change is made you should be able to use adb without being forced to use su or sudo.
First post updated with latest release, version 12.02.04.
Lots of changes for XP and various Linux distros. See changelog for more information, but things should work better in Arch, CentOS, Debian, Fedora, and Ubuntu (including Kubuntu, Xubuntu, etc).
Hi, I just downloaded the latest file (12.02.04) but it's only 4 KB.
Could you check please?
Thank you!
Trying to unzip the file in Ubuntu 11.10 and this what I get:
Archive: knives-and-forks-12.02.04.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of knives-and-forks-12.02.04.zip or
knives-and-forks-12.02.04.zip.zip, and cannot find knives-and-forks-12.02.04.zip.ZIP, period.
Any help?
I had a typo in the .zip filename, so if you tried to download the file yesterday you basically just downloaded an error message that the .php counter script gave when it couldn't find the file. I will have to take a look at that later because it is supposed to display the message not make you download it.
The problem is now fixed, sorry about that.
Thanks for update.
Downloaded and installed.
Now I can adb from linux.
Have one more question. I hope you can help me with that as well.
I don't see my device (E4GT) as external hard drive or USB drive when debuging is on to copy files to it.
When debuging is off it shows 2 Android devices but when I click on them I'm getting this message:
Error initializing camera: -60: Could not lock the device
Any ideas?
My guess is maybe they didn't get unmounted properly that last time you had it plugged in, but I have no idea why you would get an error message about the camera. I have not seen that one.
Try installing Dropbox and backing up anything important, then formatting the sdcard and try mounting again.
Maybe somebody else has had that error and has a better idea,
I'll try to format sd card tonight when I get home.
But what would be the problem with internal storage?
And what should or could I try to proper mount it?
agat63 said:
I'll try to format sd card tonight when I get home.
But what would be the problem with internal storage?
And what should or could I try to proper mount it?
Click to expand...
Click to collapse
First thing to check is that it isn't ROM related. Boot into recovery and try to mount as a usb drive and see if it works or not. If it does, I would say wipe and flash another ROM. If it doesn't work from recovery, then it could be a result of not unmounting before unplugging from your computer.
Sometimes if you have your phone mounted as a USB drive, or even just a regular flash drive, and it you unplug it before it is done unmounting (or if you don't use the safely remove hardward feature of Windows) the filesystem can get trashed. It hasn't happened alot with me, and I have seen the problem happen mostly when a flash drive is unplugged before the OS can finish writing to it.
After you get all of your important stuff backed up somewhere like dropbox, reboot into your recovery and repartition the sd card and/or your internal storage, whatever is giving you the problem. When you reboot into android you should be able to use it as normal, and dropbox should automatically copy everything back that you backed up.
This problem isn't really related to my script, so I if you can't get the issue resolved make a new post in Android QA or somewhere else. PM me if you post elsewhere and I can see if I can help you out there.
I didn't mean to say that the problem is related to your script.
Your script works just fine and I'm able to adb.
I'm kinda new to linux and still learning it.
I needed help and advise for how to connect phone to pc in linux.
It works in windows for me.
When I get on my PC I'm gnats give this awhirl. Ad for your mounting disk drives if ur on any ics rom it wont and I don't know how to enlighten me someone but if its gingerb then make sure u mount with the phones option when u plug in on ur handset ther should be some kind of way to switch between teather, disk and charge only? Wat fone u got?
Does this knife and forks compile? What does it do? Sorry to sound like a knob.
Sent from my GT-I9100 using XDA Premium App
This worked for my att gs2.
Sent from my GT-I9100 using Tapatalk
By using the Android Font you are violating their copyright rules. But you are free to modify the Android Robot, as long as you refer to them and say that you have permission.
Bad-Wolf said:
By using the Android Font you are violating their copyright rules. But you are free to modify the Android Robot, as long as you refer to them and say that you have permission.
Click to expand...
Click to collapse
The post where I found the font said it was an Android logo inspired font, and not the actual android logo font.
I have changed the font I'm using, and have updated my logo graphic to fight off any further concerns.
Colliebudz said:
Does this knife and forks compile? What does it do? Sorry to sound like a knob.
Click to expand...
Click to collapse
At the moment it simply automates getting adb setup on Linux, Mac, and Linux.
I have plans to add support for device rooting next, followed by some other adb commands, then rom customization tools as the last stage of development.
Pushing files to the phone, running shell commands, etc, requires that adb is setup properly, so that is where the focus is at right now. Getting the adb & driver installation scripts setup to run on all three platforms is also helping take care of some general troubleshooting, which is good to get out of the way before the main script gets tons of extra features.
All of this info should be in the first post, I'll try to clarify things when I make the next update.
Waddle said:
This worked for my att gs2.
Sent from my GT-I9100 using Tapatalk
Click to expand...
Click to collapse
Thanks for the feedback. What OS?

[Q] Possible to execute ADB commands from a C# Form?

Basically I have been working on a Boot animation changer for the Nexus 7 and the program so far is coded in a C# form for windows.
I have coded everything fine up till now. And I'm a little stuck.
I need to run a ADB command to push a file from my Program files x86 to the nexus 7 and write over the original Boot file.
But is there a simple and easy solution for writing this code? Or do I need to make a console application which does this process when started?
Thanks.
( I can push files manually via ADB, but the point is to make the tool " one click " If you get my drift. )
QuantumCipher said:
Basically I have been working on a Boot animation changer for the Nexus 7 and the program so far is coded in a C# form for windows.
I have coded everything fine up till now. And I'm a little stuck.
I need to run a ADB command to push a file from my Program files x86 to the nexus 7 and write over the original Boot file.
But is there a simple and easy solution for writing this code? Or do I need to make a console application which does this process when started?
Thanks.
( I can push files manually via ADB, but the point is to make the tool " one click " If you get my drift. )
Click to expand...
Click to collapse
Simply execute adb via shell command?
cakebomb said:
Simply execute adb via shell command?
Click to expand...
Click to collapse
Oh so I can actually run the command from the C# application instead of the console? Just write the argument?
QuantumCipher said:
Oh so I can actually run the command from the C# application instead of the console? Just write the argument?
Click to expand...
Click to collapse
I don't know, how to do it in C#, I just know VB.
But you should be able to run adb (shell) with process.start or something and then just type the commands behind adb (shell), like if you want to run 'cmd.exe shutdown -s'.
And if not let your program create and run a batch file, which starts adb and copys the files to the phone, this is definitely possible.
Sent from my GT-I9100 using xda app-developers app
QuantumCipher said:
Oh so I can actually run the command from the C# application instead of the console? Just write the argument?
Click to expand...
Click to collapse
not 100% sure but should be something like
this is just an example and may be wrong, better check out exact arguments or google
using System;
using System.Diagnostics;
namespace adb.test
{
class ProcessStart
{
static void Main(string[] args)
{
Process adb = new Process();
adb.StartInfo.FileName = "adb.exe";
adb.StartInfo.Arguments = "shell";
adb.Start();
}
}
}
hopefully this will help you.
ADB VB Express 2008 - WM-Explorer
Hi,
this function is maked by my for WM-Explorer (WM8850 tablets - nanospic.ro ) in VB Express 2008
Dim CurrentPath As String = Environment.CurrentDirectory & "\"
Public Function ADB_Send_Cmd(ByVal cmd As String, ByVal timeout As Integer) As String
Dim dos_out As String = "dos_out.pms"
Dim bat_file As String = "getcmd.bat"
Dim sir As String
sir = "adb.exe " & cmd & " > " & dos_out
System.IO.File.WriteAllText(CurrentPath & bat_file, sir)
Shell(CurrentPath & bat_file, AppWinStyle.Hide, True, timeout)
Application.DoEvents()
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("adb")
For Each p As Process In pProcess
p.Kill()
p.WaitForExit()
Next
Application.DoEvents()
Dim sr As StreamReader = File.OpenText(CurrentPath & dos_out)
Dim out As String = sr.ReadToEnd
sr.Close()
System.IO.File.Delete(CurrentPath & bat_file)
System.IO.File.Delete(CurrentPath & dos_out)
ADB_Send_Cmd = out
End Function
and how to use this function :
cmd = "devices"
rezultat = ADB_Send_Cmd(cmd, 20000)
'rezultat' may be :
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
xxxxxxxxx
cakebomb said:
I don't know, how to do it in C#, I just know VB.
But you should be able to run adb (shell) with process.start or something and then just type the commands behind adb (shell), like if you want to run 'cmd.exe shutdown -s'.
And if not let your program create and run a batch file, which starts adb and copys the files to the phone, this is definitely possible.
Sent from my GT-I9100 using xda app-developers app
Click to expand...
Click to collapse
Xadder said:
not 100% sure but should be something like
this is just an example and may be wrong, better check out exact arguments or google
using System;
using System.Diagnostics;
namespace adb.test
{
class ProcessStart
{
static void Main(string[] args)
{
Process adb = new Process();
adb.StartInfo.FileName = "adb.exe";
adb.StartInfo.Arguments = "shell";
adb.Start();
}
}
}
hopefully this will help you.
Click to expand...
Click to collapse
diabetu said:
Hi,
this function is maked by my for WM-Explorer (WM8850 tablets - nanospic.ro ) in VB Express 2008
Dim CurrentPath As String = Environment.CurrentDirectory & "\"
Public Function ADB_Send_Cmd(ByVal cmd As String, ByVal timeout As Integer) As String
Dim dos_out As String = "dos_out.pms"
Dim bat_file As String = "getcmd.bat"
Dim sir As String
sir = "adb.exe " & cmd & " > " & dos_out
System.IO.File.WriteAllText(CurrentPath & bat_file, sir)
Shell(CurrentPath & bat_file, AppWinStyle.Hide, True, timeout)
Application.DoEvents()
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("adb")
For Each p As Process In pProcess
p.Kill()
p.WaitForExit()
Next
Application.DoEvents()
Dim sr As StreamReader = File.OpenText(CurrentPath & dos_out)
Dim out As String = sr.ReadToEnd
sr.Close()
System.IO.File.Delete(CurrentPath & bat_file)
System.IO.File.Delete(CurrentPath & dos_out)
ADB_Send_Cmd = out
End Function
and how to use this function :
cmd = "devices"
rezultat = ADB_Send_Cmd(cmd, 20000)
'rezultat' may be :
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
xxxxxxxxx
Click to expand...
Click to collapse
Thanks for the effort guys I found a way round it all and learnt a few new things about the android system ways and file permissions Ill be posting the app on here today or tomorrow may add a few more features to make it more worth while for users.
(Y)
QuantumCipher said:
Thanks for the effort guys I found a way round it all and learnt a few new things about the android system ways and file permissions Ill be posting the app on here today or tomorrow may add a few more features to make it more worth while for users.
(Y)
Click to expand...
Click to collapse
I am attempting a similar feat and I was wondering what your work around is?
My batch file terminates issues cmd commands at the shell prompt.
I am merely using a "Unlock" and "Lock" Form button to issue several commands to ADB Shell to Change the HTC One Max Flag for Locked Bootloader status. I would like to hard code the shell commands to execute with form button press but I have yet to find a way. Below are 2 sequenced events i need to occur on button press. I am using Visual Studio 2013
Mark Boot loader as Locked Code is:
Code:
adb shell
su
(if needed to get a # prompt)
echo -ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796
exit
exit
adb reboot bootloader
(This is for the user to verify the Bootloader flag has changed)
Mark Boot loader as Unlocked Code is:
Code:
adb shell
su
(if needed to get a # prompt)
echo -ne "HTCU" | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796
exit
exit
adb reboot bootloader
Thanks for your help
DeadPhoenix said:
I am attempting a similar feat and I was wondering what your work around is?
My batch file terminates issues cmd commands at the shell prompt.
I am merely using a "Unlock" and "Lock" Form button to issue several commands to ADB Shell to Change the HTC One Max Flag for Locked Bootloader status. I would like to hard code the shell commands to execute with form button press but I have yet to find a way. Below are 2 sequenced events i need to occur on button press. I am using Visual Studio 2013
Mark Boot loader as Locked Code is:
Code:
adb shell
su
(if needed to get a # prompt)
echo -ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796
exit
exit
adb reboot bootloader
(This is for the user to verify the Bootloader flag has changed)
Mark Boot loader as Unlocked Code is:
Code:
adb shell
su
(if needed to get a # prompt)
echo -ne "HTCU" | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796
exit
exit
adb reboot bootloader
Thanks for your help
Click to expand...
Click to collapse
does this help?
http://forum.xda-developers.com/showthread.php?t=2042227
QuantumCipher said:
does this help?
http://forum.xda-developers.com/showthread.php?t=2042227
Click to expand...
Click to collapse
I was looking at more of something like this.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
The reason your linked thread won't work is because once you enter the ADB Shell environment your are no longer issuing commands via the cmd.exe process. There for any command sent from that process are not interpreted by the console as valid as you are in ADB Shell. At least that is my understanding. The Namespace in my link seems to have what I need but I am having a hard time breaking down what I need as I am so new to C# programming.
DeadPhoenix said:
I was looking at more of something like this.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
Click to expand...
Click to collapse
OKay ive just refrenced that in my new tool ..Ill look in a few hours buddy going ski center now
DeadPhoenix said:
I was looking at more of something like this.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
The reason your linked thread won't work is because once you enter the ADB Shell environment your are no longer issuing commands via the cmd.exe process. There for any command sent from that process are not interpreted by the console as valid as you are in ADB Shell. At least that is my understanding. The Namespace in my link seems to have what I need but I am having a hard time breaking down what I need as I am so new to C# programming.
Click to expand...
Click to collapse
Right I had a quick look and I think I know what you mean.. Theres a few ways I can think of ..
1. Is Make a thread process and covert your commands like adb reboot to Cmd process like my tutorial.
And for the shell as you said there is AndroidLIB.DLL You need to set the adb shell up from that so you can execute that longer command.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
Something like this :
But obviously change this code to use adbshellcommand
Code:
AdbCommand adbCmd = Adb.FormAdbCommand(device, true, "input", "keyevent", (int)KeyEventCode.HOME);
If you get stuck Ill right the code out later as I was thinking about adding shell to my console app.
QuantumCipher said:
Right I had a quick look and I think I know what you mean.. Theres a few ways I can think of ..
1. Is Make a thread process and covert your commands like adb reboot to Cmd process like my tutorial.
And for the shell as you said there is AndroidLIB.DLL You need to set the adb shell up from that so you can execute that longer command.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
Something like this :
But obviously change this code to use adbshellcommand
Code:
AdbCommand adbCmd = Adb.FormAdbCommand(device, true, "input", "keyevent", (int)KeyEventCode.HOME);
If you get stuck Ill right the code out later as I was thinking about adding shell to my console app.
Click to expand...
Click to collapse
Here is my code for the button I am using
Code:
private void lockboot_Click(object sender, EventArgs e)
{
string serial;
android = AndroidController.Instance;
android.UpdateDeviceList();
serial = android.ConnectedDevices[0];
device = android.GetConnectedDevice(serial);
AdbCommand adbCmd = Adb.FormAdbShellCommand(device, true, "echo", "-ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796");
Adb.ExecuteAdbCommand(adbCmd);
lbllocked.Visible = true;
lblunlock.Visible = false;
textboxcolor.BackColor = Color.Red;
}
It Compiles with no issues however the command is not executing properly. The Bootloader show be flagged unlocked when I boot in to Bootloader. It is however remaining unchanged.
DeadPhoenix said:
Here is my code for the button I am using
Code:
private void lockboot_Click(object sender, EventArgs e)
{
string serial;
android = AndroidController.Instance;
android.UpdateDeviceList();
serial = android.ConnectedDevices[0];
device = android.GetConnectedDevice(serial);
AdbCommand adbCmd = Adb.FormAdbShellCommand(device, true, "echo", "-ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796");
Adb.ExecuteAdbCommand(adbCmd);
lbllocked.Visible = true;
lblunlock.Visible = false;
textboxcolor.BackColor = Color.Red;
}
It Compiles with no issues however the command is not executing properly. The Bootloader show be flagged unlocked when I boot in to Bootloader. It is however remaining unchanged.
Click to expand...
Click to collapse
Any Suggestions?

help for a script

hi all
i have an galaxy SIII
i am using script manager.
i want to write a script and i have 2 questions
- how to write a script who open an url with the web browser
- is there an function to send a ping to see if an local adress avalaible (192.168.1.X) if not avalaible is there an return error ?
(sorry to seem stupid but i am coming from windows and i am a bit lost for the moment )
thank u for giving me a your time
no suggestion ?
or advise
Google something like "android open browser from shell". You can do it using intents.
Also:
Code:
ping --help
this work in an script u put
am start -a android.intent.action.VIEW -n com.android.browser/.BrowserActivity http://www.google.fr
for chrome i find this
am start -a android.intent.action.VIEW -n com.android.chrome/.Main -d http://xxxxxxxx
but i not find for opera if someone have it
finally
opera =
am start -a android.intent.action.VIEW -n com.opera.browser/com.opera.Opera -d http://www.google.xxxx
hope this help someone
lol now i really need help coz i found nothing
i want to know which ip is reachable from 192.168.1.(1 to 9)
in a script to automate that and give me wish is reachable for use it in a command to browser.
(i know ping from terminal emulator but it's not what i am looking for)
forgive my english i hope you understand what i want ant hope too u help me with this
kondronaute said:
i want to know which ip is reachable from 192.168.1.(1 to 9)
in a script to automate that and give me wish is reachable for use it in a command to browser...
Click to expand...
Click to collapse
That's easy, check:
Code:
for var in {1..9}
do
echo "Looking for 192.168.1.$var..." #optional... jejeje
if ping 192.168.1.$var -c 1 > /dev/null
then
#Reachable, put here your command
else
#Unreachable, you can show an error here
fi
done
RoberGalarga said:
That's easy, check:
Code:
for var in {1..9}
do
echo "Looking for 192.168.1.$var..." #optional... jejeje
if ping 192.168.1.$var -c 1 > /dev/null
then
#Reachable, put here your command
else
#Unreachable, you can show an error here
fi
done
Click to expand...
Click to collapse
but ping command is not reconized by script manager i can only do it with terminal emulator ....
Really? I didn't know that (weird, BTW). Check if you need to use another command with Script Manager, or if you need to add something.
I dunno another way to achieve your goal... only using ping
lol i have a headeach with this and find nothing
RoberGalarga said:
Really? I didn't know that (weird, BTW). Check if you need to use another command with Script Manager, or if you need to add something.
I dunno another way to achieve your goal... only using ping
Click to expand...
Click to collapse
finally i have possibility to run ping you must just in option of script manager chek "override $PATH"
after 2 or 3 aspirin this work for me
#!/system/bin/sh
for i in $(seq 2 10);
do
host="192.168.1.$i"
ping -c 1 -W 1 $host > /dev/null &&
am start -a android.intent.action.VIEW -n com.android.browser/.BrowserActivity http://$host ;
done
i dont know why i have error with else and if with android shell ????
i thank u again for your help and hope the masters here help us a bit to understand, it's difficult coz there are differences with simple linux and this for french using windows :laugh:
Try if this help.
i have this kind of probleme http://forum.xda-developers.com/showthread.php?t=1045006
but i am usin the script manager editor on my phone !!!!!
i have not Windows EOL formatting
please if u are guru of busybox your help is needed to use if else and fi in a script.
must i download another version of busybox or add a command ????
i am fully rooted the path in script manager is good
edit = after trying and googleing
after if you must put [[your code without space before and after]] and after then (yourcode) :laugh:
hope i find the rest...
kondronaute said:
i have not Windows EOL formatting
Click to expand...
Click to collapse
Are you sure? Because if you have created the script in windows, you have that EOL formatting (whatever that means :silly. Try this:
Open Terminal Emulator, and type
Code:
echo "hello there" > /sdcard/newScript.sh
This will create a new and clean script in your SD Card.
Then, go to Script Manager, and edit that script. You can start deleting the text ("hello there") and adding this:
Code:
testvar=1
if [ "$testvar" = "1" ] ; then
echo "All is right"
fi
Ok, run the script. If you can see the text "All is right", that's it, problem solved
RoberGalarga said:
Are you sure? Because if you have created the script in windows, you have that EOL formatting (whatever that means :silly. Try this:
Open Terminal Emulator, and type
Code:
echo "hello there" > /sdcard/newScript.sh
This will create a new and clean script in your SD Card.
Then, go to Script Manager, and edit that script. You can start deleting the text ("hello there") and adding this:
Code:
testvar=1
if [ "$testvar" = "1" ] ; then
echo "All is right"
fi
Ok, run the script. If you can see the text "All is right", that's it, problem solved
Click to expand...
Click to collapse
you save my last neuron
thanks
edit =
my fault is i create a text file under windows (easier and can copy and past easily) after i put the file on my phone and copy past the code in a new script.
i not think that when i just copy past i past the EOL formatting ( i dont know what is that but its a bad thing )
that's mean i must abandon windows and migrate totally to linux
anyway that make me crazy and i am happy to sort it.
you are very helpfull many thanks again
new edit = i understand now why they say notepad++ is necessary

[Ruby] Installing gems on android.

Hello friends!
I am using Termux in order to run ruby.
I installed ruby successfully with "apt" command, and it functions fine.
Current ruby version:
Code:
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [arm-linux-androideabi]
The problem is, I can't really install gems. I tried to install bettercap for the experiment, but it failed. This is what I get:
Code:
$ gem install bettercap
Fetching: colorize-0.8.1.gem (100%)
Successfully installed colorize-0.8.1
Fetching: network_interface-0.0.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing bettercap:
ERROR: Failed to build gem native extension.
current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/gems/network_interface-0.0.1/ext/network_interface_ext
/data/data/com.termux/files/usr/bin/ruby -r ./siteconf20161129-14856-1cclchu.rb extconf.rb
mkmf.rb can't find header files for ruby at /data/data/com.termux/files/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/gems/network_interface-0.0.1 for inspection.
Results logged to /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/extensions/arm-linux/2.3.0/network_interface-0.0.1/gem_make.out
I found some instructions if I ran "gem help install" but I couldn't really understand what to do in order to fix that.
Can anyone help me to solve this? BTW I have a rooted device so I can use "su" and "sudo" and all that stuff...
Thanks for people who answer~
FurySh0ck said:
Code:
mkmf.rb can't find header files for ruby at /data/data/com.termux/files/usr/lib/ruby/include/ruby.h
Click to expand...
Click to collapse
You can install ruby.h with:
Code:
apt install ruby-dev
.
fornwall said:
You can install ruby.h with: .
Click to expand...
Click to collapse
I installed ruby-dev but it still won't work. It tells me it saved a log file which contains the explanation to the failure. I'll post the whole code, but please pay attention to the last part of it:
Code:
apt install bettercap
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package bettercap
$ gem install bettercap
Building native extensions. This could take a while...
ERROR: Error installing bettercap:
ERROR: Failed to build gem native extension.
current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/gems/network_interface-0.0.1/ext/network_interface_ext
/data/data/com.termux/files/usr/bin/ruby -r ./siteconf20161206-31345-1xerjr9.rb extconf.rb
[*] Running checks for netifaces code...
[*] Warning : this platform as not been tested
checking for getifaddrs()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/data/data/com.termux/files/usr/bin/$(RUBY_BASE_NAME)
/data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /data/data/com.termux/files/usr/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
from extconf.rb:43:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/extensions/arm-linux/2.3.0/network_interface-0.0.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/gems/network_interface-0.0.1 for inspection.
Results logged to /data/data/com.termux/files/usr/lib/ruby/gems/2.3.0/extensions/arm-linux/2.3.0/network_interface-0.0.1/gem_make.out
Any solutions in mind?
BTW Thanks for your time, I appreciate anyone who tries to help.

Categories

Resources