[Q] adb shell busybox vi? Should this work? - General Questions and Answers

I want to edit with busybox vi running from the phone within an adb shell.
I am running a DOS box cmd window or a cygwin rxvt shell window, both don't work, where I connect to the phone with an adb shell. Then I run busybox vi. The vi runs but the default termcap or terminfo or whatever it is doesn't seem to be right because busybox vi comes up but I can't seem to get the ESC key to take so I can switch between command and insert modes of operation. On the phone it works correctly.
I hate editing on the phone. I would much rather work on the workstation.
I've read on a wiki busybox vi page that busybox vi only supports vt102. Any ideas if this should work or what I could try?
Thanks in advance.

Same here. I spend half the morning playing with TERMs, trying to get a dos or cygwin terminal to run vi. vi runs fine in Terminal emulator, but like you, I don't wan to edit on the phone.
I found JOE (Joe's Own Editor) ported to Android. I installed it because it supposedly uses TERM=unknown. That didn't work from DOS either. But it did work from a cygwin bash shell, with TERM=linux in the adb shell. Now there is the learning curve to use JOE...
I too would be happy to hear which TERM setting will work with a DOS adb shell.

Face same situation here. Is it resolved?
If not, how you gurus work around on this basic issue?
I don't know much about VNC yet. Could it be a viable direction that worth spending effort?

Adb shell and Vi - info
I too just spent a lot of time trying to get vi to work under "adb shell". ESC was especially a problem. Ultimately, I wasn't able to get it to work correctly, but SSH seems to work fine.
There are a lot of details about what I learned on Stackoverflow (I'm a new member here, so I can't post the link, but you can search for it -- the title is "adb shell: can't use the ESCAPE KEY").
Has anyone gotten this to work correctly? Or is it simply an incomplete/buggy implementation of adb's shell?
Thanks,
Barry

Related

BASH like default shell

Hello, i would like to have BASH like default shell,how can i do that? I try extract bash from debian armel image and it doesnt work. And debian image doesnt solution.Thank you for answer.
Theres always ash, which ain't too bad, just type ash at a command prompt. Gives you tab completion and you can use the ball to scroll back thru history which saves much typing

Finally got a bluetooth keyboard working

I've had the little targus keypad (bluetooth HID; not SPP) and and Apple bluetooth keyboard (salvaged from an Apple loving friend after he let the battries leak). Now that I finally plucked up the courage to root my Nexus and install the hidd binary I can (with a little bit of effort) finally type effectively if I need to (mostly for connectbot when I need to ssh into remote servers)
I need to issue hidd --connect [BLUETOOTH ADDRESS] each time I want to connect, but I'm happy to do that until it gets a little more elegantly plumbed in.
In fact I'm using it right now
wanna d/l genesisoid or whatever its called and see if you can use that bluetooth keyboard to play some sega roms?
One of the upcoming Motorola devices lists HID as a supported profile. I am all hot and sweaty with anticipation hoping it will be part of Android and not something Motorola added. I am writing a SPP IME (there is KeyPro in the market but the IME is just a side benefit of the actual project) but would be so much happier with official HID support.
SilentMobius said:
Now that I finally plucked up the courage to root my Nexus and install the hidd binary I can (with a little bit of effort) finally type effectively if I need to (mostly for connectbot when I need to ssh into remote servers)
Click to expand...
Click to collapse
I'm trying the same. Where did you get the hidd binary? Or do you mind describing how you built it? Thanks in advance!
I go my info from here:
http://i-miss-erin.blogspot.com/2009/09/connect-bluetooth-keyboard-in-android.html
I already had hcitool from the extras package when I rooted, just needed the hidd binary.
Got mine working too! thanks for the help
Script / app for connecting this?
I just got mine working too!
Wish someone could write an app for this so I wouldn't have to use the console every time I want to connect..
If you have the think outside / igo bluetooth keyboard, word of warning! Be very very careful opening and closing this baby all the time. Don't let it get smashed in your bag. I'm on my 2nd one.. and this one is showing signs of failure. I have to bend the casing a bit to get my return / windows key to work. The inside cables have a tendency to slip out if things get mashed, and trust me, this is one keyboard you don't want to be opening up with a screwdriver..
I did.. got mine working again.. but only after bending the case after it was all put back together again. :-/
Great little keyboard though! Use it with my tablet pc too.
C
FYI the ASE allows you to execute shell scripts from home screen icons.
If you chmod the binary to suid it will run as root
chmod 4777 hidd
Then stick a script in /sdcard/ase/scripts
hidd --connect <BTADDR>
And long press on the home screen->shortcut->ase->your script
Cool. Any idea if it will work with portable bluetooth keyboards? Like the iGo Stowaway?
SilentMobius said:
FYI the ASE allows you to execute shell scripts from home screen icons.
If you chmod the binary to suid it will run as root
chmod 4777 hidd
Then stick a script in /sdcard/ase/scripts
hidd --connect <BTADDR>
And long press on the home screen->shortcut->ase->your script
Click to expand...
Click to collapse
I used gscript didn't have to do the chmod 4755 (has a run as root checkbox)
but still the same, thanks for the tip!
I would love to see a tutorial for the nexus one bluetooth keyboard pairing. I tried to follow the website but got nowhere. Whenever i run:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
on my mobile i get the error :no such file or directory. I even created the danm directory and still get nowhere.
Anyone give me a hint? i want to figure this one out!
ok i got past that problem dumb me and my spacebar.
Anyhow now im trying to adb push hidd but im getting an
error: device not found
i have a cyangenmod nexusone with a ubnuntu 9.10 machine.
Thanks!
Alright i just copied and pasted the three files to the folder that was specified. Now everything works other than hidd specificaly hidd -connect gives me a
hidd: not found
Im now stuck here
Draaktatsu said:
Alright i just copied and pasted the three files to the folder that was specified. Now everything works other than hidd specificaly hidd -connect gives me a
hidd: not found
Im now stuck here
Click to expand...
Click to collapse
did you change the permissions for hidd?
chmod 4755 hidd
Tried it just now, says:No such file or directory.
Maybe i have a bad file? Im stumped
LOL, I just paired and connected a Bluetooth mouse. LOL Not very useable though, moving the mouse is equivalent to rolling the trackball.
On cyanogenmod 5.0.4.1 I just had to push over the hidd program as the others were already there.
For everyone that's having problems, the methods described here work like a charm, make sure you turn off Internet Tethering (if you have it) and turn on development debugging mode.
Can't somebody write a simple keyboard pairing program for us? Seems like it would be fairly simple to write a root app that would do this but I'm no programmer, especially in Java.
BrandonG777 said:
LOL, I just paired and connected a Bluetooth mouse. LOL Not very useable though, moving the mouse is equivalent to rolling the trackball.
On cyanogenmod 5.0.4.1 I just had to push over the hidd program as the others were already there.
For everyone that's having problems, the methods described here work like a charm, make sure you turn off Internet Tethering (if you have it) and turn on development debugging mode.
Can't somebody write a simple keyboard pairing program for us? Seems like it would be fairly simple to write a root app that would do this but I'm no programmer, especially in Java.
Click to expand...
Click to collapse
Better yet would be to edit the source of the Settings app to put seamless support for HID in there. I'm going to look at writing a KB pairing program next week, I think.
The normal pairing in Android setting works for pairing keyboards just fine, its the android native hidd equivalent we need.
OK... finally got hidd recognised by deleting the .bin extension.
Now the problem is I get this error:
Can't open HIDP control socket: Operation not permitted
Anyone?
what is ase? i cant find it in market. i created the script and put it in the folder but i just need whatever ase is to create the shortcut

Replacement for craptacular adb shell

Hey everybody. I'm on windows and adb's shell just keeps on pissing me off. Mainly, how pressing tab actually inserts a tab rather than tab completion . I'd really like to do something about this.
Here's a list of the things i've tried to get rid of this super-annoying behaviour.
-rolled a cross-compiler toolchain (glibc-based) for my phone (HTC Magic) and cross-compiled bash (in a vm). I actually made this work even with dynamic linking, and can start bash from within an instance of "adb shell". Unfortunatly, this doesn't change the tab behaviour, which appears to be baked into adb rather than a problem with the default shell.
-I thought i'd try something fancy by doing...
adb shell mkfifo /fifo
adb shell "bash > /fifo < fifo 2> /fifo"
adb forward tcp:9001 dev:/fifo
and starting putty in raw mode, connecting to localhost:9001. Unfortunatly, all is what happens is i get an echo of what i type and if i press enter a few times putty spits out ": command not found". I can't see why this shouldn't work but I suspect i'm Doing It Wrong.
-Searching the forum revealed puttycyg, which is actually really handy but unfortunatly suffers from the same tab completion problem as using adb shell in cmd.exe
How do you guys do it? Am I onto something with the adb forward thing? If so, how do I make that work?
I have also compiled bash but I have tab completion though adb. I do however use Linux as my desktop OS and am connecting through Konsole. So you could just try to install KDE for Windows. I know that I've looked for good terminal applications for windows but found none. They're all **** compared to what's available on nix.
This is my simple bashrc:
Code:
# If interactive do nothing.
[ -z "$PS1" ] && return
export HOME="/sdcard/"
PS1='[email protected]\h:\w\$ '
Also it's full of aliases for busybox. By replacing built in ls and similar you even get nice colors But still no line editing for some reason. I figure I might just need a proper libreadline or similar for that.
If anybody's interested in how I got this working, i cross-compiled socat for the droid. Required configuring with --disable-termios and manually editing config.h to set the #define for CRDLY_SHIFT and a couple other *_SHIFT macros to some values i found in Config/linux-2.6.24.h (or something similar, posting from memory here)
Once socat is on the phone, I made it pipe data from a bash shell to a unix socket it is listening on:
socat unix-listen:/dev/adbsock,fork exec:"/bin/bash -li",pty,stderr,setsid,sigint
(command shamelessly copied from http://superuser.com/questions/123790/socat-and-rich-terminals-with-ctrlc-ctrlz-ctrld-propagation ).
Then, on the pc i run adb forward tcp:9001 localfilesystem:/tmp/adbsock
And if i connect putty to localhost:9001 in raw mode (disabling line editing and local echo) I get a fairly complete bash shell that you can not only use tab completion on but even vi works
Again, posting from memory here so if anyone wants to try this and is running into problems i can dig it up from my ~/.bash_history.
Any chance you can post your socat port?
The tab completion thing is driving me insane! I don't understand why the ADB shell in *nix is proper, but the windows version sucks so much hairy donkey balls.
I've been using Ansicon so I at least get color in my shell, but ADB still mangles tab, and I don't even want to talk about what it does to Nano. Ugh!
Oh wow, this takes me back. I don't even have my android phone anymore (cancelled the contract due to terribly crap network service, and (unfortunately) the iPhone was the best phone in its price range from my new carrier).
So I don't have any files to give to you...
But, from what I can remember, to make it work, I built a cross binutils and gcc loosely following the instructions from the LFS book, compiled glibc + a few other libs socat wanted with it, and then socat itself, and then bash. I then copied the cross libc.so.6, ld-linux.so.2 (or whatever it's called on ARM) and all the libs socat wanted to /lib on the phone, and the socat and bash binaries to /bin. It's convenient that android keeps its important stuff in /system because it means you can avoid screwing around with your toolchain to make it look for a dynamic linker in some location other than /lib.
From memory socat was the only thing I had problems compiling, and thankfully I've already posted roughly what i had to do to it to make it build (because there's no way I remember lol)
Sorry I can't be more helpful!

[WIP] Run Script via ADB as Root

What we need is a program to simplify remote modifications.
Here's why:
You can't run a command via adb that passes variables without actually entering the shell.
You can push a script, but it wont run unless you chmod which requires root.
There is no way (currently) for a batch script to run as run.
I was thinking it would be very easy to write a median to allow us to do such.
I know some devs here use .Net, I am familiar with .Net myself but I've been very busy.
I'm comfortable using whatever language, if anyone wishes to help out while I'm in the middle of my move, that would be great. I'd be able to jump in and help out in about a week or two.
Here's some documentation:
http://msdn.microsoft.com/en-us/library/yz3fhfz1(v=VS.71).aspx
Even just a simple EXE that allows a script to be pushed, chmodded, and executed would be perfect.
There are many routes that can be taken, this is just one.
Why dont you put what ever scripts you need in a folder on your phone and just run them locally via adb.
adb shell "[path]/[path]/script.acss"
Variables can be pushed in with new scripts almost instantly.
Is this what your thinking?
Sent from my SM-N900T using Tapatalk

[Q] Please help! I have been trying for 4 hours...

I have looked, and searched and looked and searched and looked some more... and I cant fine one ****ing sure fire way to root my Samsung Galaxy S 4g. There are so many links to this and that with no explanation and its killing me. and before I get flamed, I'd like to say I have a mac, so obviously if I had a windows phone I would have had this all done lickedy split already.
So if someone could walk me through the steps to rooting my phone and getting power user on my t-mobile samsung galaxy s 4g for mac that would be wonderful. please and thank you!
jowings18 said:
I have looked, and searched and looked and searched and looked some more... and I cant fine one ****ing sure fire way to root my Samsung Galaxy S 4g. There are so many links to this and that with no explanation and its killing me. and before I get flamed, I'd like to say I have a mac, so obviously if I had a windows phone I would have had this all done lickedy split already.
So if someone could walk me through the steps to rooting my phone and getting power user on my t-mobile samsung galaxy s 4g for mac that would be wonderful. please and thank you!
Click to expand...
Click to collapse
I'm no Mac user, but this should help....
http://forum.xda-developers.com/showthread.php?t=997475
--Quote from Papermakesplanes:--
1. Install Mono
2. Install the thing you're trying to run under Mono, like SuperOneClick
3. Open Terminal in your Mac
4. In Terminal, type: cd /Applications/SuperOneClickFolder or whatever your folder is
5. In Terminal, type mono SuperOneClick.exe or whatever the name of your executable is. As you can see, this is super similar to doing the Run... commands in Windows, except it's mono instead of run
6. Your file should open now. But, you really don't want to be opening terminal and opening software by command line, do you?
7. Right click on SuperOneClick.exe and go to More -> Automator -> Create Workflow. If this doesn't work for you (it didn't for me...), then open up Automator, Create New Workflow, and drag in the .exe you want to run into the Workflow area
8. Add a "Run Shell Script" to this workflow. In the Shell Script area, type exactly what you typed into the Terminal earlier:
cd /Applications/ApplicationFolder
mono Application.exe
--End of Quote--
im 19 now... I was a techy nerd when i was like 14. I built all my computers and new everything and anything. As I grew older i got into cars and kinda forgot all the techy stuff... so this doesnt help me at all
why can't I just plug in my my and do a oneclick root or a z4 root. I feel like it shoukd be easy but it seems like galaxy s 4g userd are either hella complicated or hella pro pc and dont have a lot of support for mac
jowings18 said:
im 19 now... I was a techy nerd when i was like 14. I built all my computers and new everything and anything. As I grew older i got into cars and kinda forgot all the techy stuff... so this doesnt help me at all
why can't I just plug in my my and do a oneclick root or a z4 root. I feel like it shoukd be easy but it seems like galaxy s 4g userd are either hella complicated or hella pro pc and dont have a lot of support for mac
Click to expand...
Click to collapse
-All you really have to do is install mono, then download SuperOneClick (make sure the file is named that too) and put it in Applications/SuperOneClickfolder.
-Open terminal, and type in cd /Applications/SuperOneClickFolder, and then mono SuperOneClick.exe
-"Right click on SuperOneClick.exe and go to More -> Automator -> Create Workflow. If this doesn't work for you (it didn't for me...), then open up Automator, Create New Workflow, and drag in the .exe you want to run into the Workflow area."
-"Add a "Run Shell Script" to this workflow. In the Shell Script area, type exactly what you typed into the Terminal earlier:
cd /Applications/ApplicationFolder
mono Application.exe"
I don't know how to simplify it any further, sorry.

Categories

Resources