Using VI in Terminal Emulator - G1 Android Development

I was wondering if anyone can help me figure out how to use vi in the terminal emulator. I just can't figure out how to properly save something i'm editing, and things like that.

(esc)wq!
where w is write, q quit, ! force.

press trackball + 1 (to esc)
than :wq!
to write and save

I read on some changelog (jesusfreak I think) that said busyboxs vi didnt write or something and that it was fixed.... just throwing that out there. It could of been a dream too. Hope this helps

thats weird, trackball + 1 doesn't do anything for me, only way ifigured out how to close is doing trackball + z which it then returns
[1] + Stopped vi
Edit:
Ah i think i get it now ^0^

in linux ctrl(android trackball) + z suspends the running process. When you suspend a program that way, type jobs to see what all you have suspended. You can bring them back by typeing fg job#.
http://www.tech-geeks.org/contrib/mdrone/LinuxWorkshop/newbie-linux-manual/sections/job.html

Related

GBA emulator

Well, i just tried http://www.sunbug.net/products/emul/PocketGBA.html
It works like a charm but..
You're able to bind Button A / B and stuff to your PDA's hardware buttons or how it's called...
It works but
Press A to attack someone ---> This works
Hold A to do a combo attack ---> This dont works
Anyone got a fix for this ? or a better emulator please reply
<3

Bluetooth Keyboard working brilliantly with G1!!!

go here:
http://i-miss-erin.blogspot.com/2009/09/connect-bluetooth-keyboard-in-android.html
when i tried remounting as rw, it wouldnt work, so i tried pushing the files anyway and for whatever reason it wrote no problem. now that i think about it, it could be that when i adb pushed, i was booted into the recovery console, but i dont remember.
anyway, you have to go through the bluez commands every time you connect, and it would be wonderful if someone would write a script, but its really really awesome!
also, whenever you run the hcitool scan command, the keyboard needs to be discoverable.
Im using a rocketfish bluetooth keyboard, no problems. So far, I've discovered the following keymaps:
Home = home key
End = red end key/sleep key
F1 = Menu
holding down the home key pulls up the mru, and while holding down the home key, you can navigate around using the arrow keys and hit enter to select.
holding down ctrl and shift and using the arrows lets you select text!
im running cyanogens 4.2.8, btw.
sharin' the love...
enjoy!
berish said:
go here:
http://i-miss-erin.blogspot.com/2009/09/connect-bluetooth-keyboard-in-android.html
when i tried remounting as rw, it wouldnt work, so i tried pushing the files anyway and for whatever reason it wrote no problem. now that i think about it, it could be that when i adb pushed, i was booted into the recovery console, but i dont remember.
anyway, you have to go through the bluez commands every time you connect, and it would be wonderful if someone would write a script, but its really really awesome!
also, whenever you run the hcitool scan command, the keyboard needs to be discoverable.
Im using a rocketfish bluetooth keyboard, no problems. So far, I've discovered the following keymaps:
Home = home key
End = red end key/sleep key
F1 = Menu
holding down the home key pulls up the mru, and while holding down the home key, you can navigate around using the arrow keys and hit enter to select.
holding down ctrl and shift and using the arrows lets you select text!
im running cyanogens 4.2.8, btw.
sharin' the love...
enjoy!
Click to expand...
Click to collapse
Wow!
Thats alot of work just to use a ky to type or whatever you said =/
The batt isnt good enough to be using all this juice unless you got one of em solar batteries from mars
dunno 'bout you, but i've been using it for over an hour at a stretch, with headphones plugged in and listening while typing, and lost about 10% battery...
and yes, if it was just to type out a text message, its obviously ridiculous, but if you use it to take notes or something else more text intensive, its well worth the minute it takes to set up...
berish said:
dunno 'bout you, but i've been using it for over an hour at a stretch, with headphones plugged in and listening while typing, and lost about 10% battery...
and yes, if it was just to type out a text message, its obviously ridiculous, but if you use it to take notes or something else more text intensive, its well worth the minute it takes to set up...
Click to expand...
Click to collapse
Your using the stock batt? Your texting on it?
might be good for a game though.
I wonder how many G1 owners are going to go buy one of these, now:
http://www.thinkgeek.com/electronics/8193/

[GUIDE] How to Remap Hardkey Actions || Custom App Launching

This is really a low-level type of hack, as it just requires editing a few files.
------------------------------------------------------------------------------------------
Sick of the Hero not having a designated "camera" button?
Well then, remap the damn thing.
How to:
MAKE A BACKUP OF THE FILE BEFORE PROCEEDING
Firstly, we'll need to pull the file that controls the heroc keypad which is entitled "heroc-keypad.kl" in "system/usr/keylayout".
To pull the file:
Code:
adb remount
adb pull system/usr/keylayout/heroc-keypad.kl heroc-keypad.kl
Now the file will appear in your Android SDK tools folder so you can edit it.
I recommend using Notepad++ but any kind of text editing tool will work.
Now open the file and it should look a little something like this(minus the "unuse" keys):
Code:
key 102 HOME
key 139 MENU WAKE_DROPPED
key 158 BACK
key 127 SEARCH
key 231 CALL
key 107 ENDCALL WAKE_DROPPED
key 191 DPAD_CENTER
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
As you can see, there are different attributes assigned to each key.
Specific application/action launchers:
Code:
HOME #Launches "Home"
MENU #Launches "Menu"
BACK #Takes you back to the last activity
SEARCH #Launches "Universal Search"
CALL #Launches the "Phone" activity and corresponding .apk or initiates a call
ENDCALL #Ends a call
CAMERA #Launches "Camera" activity and corresponding .apk
FOCUS #Initiates Auto-Focus while using the Camera
VOLUME_UP #Self explanatory
VOLUME_DOWN #^
And attributes saying if it should wake the phone at button push to complete the action, or if it should just complete the action without waking the screen.
Code:
WAKE #Completes the action without waking the screen
WAKE_DROPPED #Wakes the phone to complete the action
NOTE: "CAMERA" can't utilize the "WAKE_DROPPED" attribute since it's an attempt to launch an activity without initializing anything else.
Anyways you can assign any of these attributes to any of the keys.
Personally, I remap the Phone button to launch the Camera, and the Search button to activate Auto-Focus:
Code:
key 231 CAMERA
key 127 FOCUS
Then when I'm using the Camera, I just hold down the "SEARCH" button to focus and push the "TALK" button to take a snapshot.
After you're done with your edits, you'll need to save the file properly(NO .txt files!), and then you'll have to push it back to the phone.
Code:
adb remount
adb push heroc-keypad.kl /system/usr/keylayout
Reboot your phone, and then long press the selected button to see if your edits worked!
Enjoy!
UPDATE!!!!
Code:
--------------------------------------------------------------------
key 200 MEDIA_PLAY_PAUSE #Pauses Music
key 201 MEDIA_PLAY_PAUSE #^
key 166 MEDIA_STOP #Stops the media
key 163 MEDIA_NEXT #Plays next media
key 165 MEDIA_PREVIOUS #Plays previous media
key 168 MEDIA_REWIND #Rewinds the media
key 208 MEDIA_FAST_FORWARD #Fast Forwards the media
The second half is from the AVRCP.kl which controls media actions on our device. But as you can see the keys aren't correctly mapped as we don't have that many(or those key numbers) at our disposal.
What you can actually do is take these attributes and map them in heroc-keypad.kl
Code:
key 102 HOME
key 139 MENU WAKE_DROPPED
key 158 BACK
key 127 MEDIA_PLAY_PAUSE WAKE
key 231 CALL
key 107 ENDCALL WAKE_DROPPED
key 191 DPAD_CENTER
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
This maps the attribute "MEDIA_PLAY_PAUSE" at the "SEARCH" key. By pushing it, you can pause media with the first push and play it with a successive push. The added attribute "WAKE" allows it to complete the action without waking the phone.
__________________________________________________________________________________________________
I want to thank Geniusdog254 for the heads up regarding not having to edit AVRCP.kl
CHECK OUT HIS FREE APP: Search2Play(Hero/Evo support!)
and
CHECK OUT HIS REMAPPING MOD FOR THE G1
Big thanks!
NOTE: You can also use Root Explorer or any other Root File Manager that has Text Editing
Custom app launching
Ok, so with some inspiration from BuglessPete's How to make script run by using hardware keys. I've devised an 'idea' as to how to custom launch an activity with keypad push.
Currently, you can launch any activity from shell by just using am.
Here's an example of launching the browser using am in the shell:
Code:
am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity
Which results in:
Code:
Starting: Intent { act=android.intent.action.MAIN cmp=com.android.browser/.BrowserActivity }
And the program launches!
But if you put this into a script, even a basic linux shell script, you can call it quickly just by running the script! So in theory if you map this script to a keycode, you can call the script by a button push.
How?
Well first, before you compile the ramdisk, you need to create a service that contains the script necessary for the intent activity you are trying to accomplish.
Second, you have to add the proper keycodes in an init script of your choice:
Code:
#example
service <activity> /path/to/yourservice
oneshot
disabled
keycodes 107 127
Which maps the activity to the search button after launching the service with the endcall button
This is currently just a theory as I haven't tested it out myself(busy with other things).
But if you would like to attempt it, I'd love feedback.
Quick Service Creation Tutorial: http://developerlife.com/tutorials/?p=356
Little error.. heroc_keypad.kl is in /system/usr/keylayout/heroc_keypad.kl.
EDIT: And it's heroc-keypad and not heroc_keypad.
HeroMeng said:
Little error.. heroc_keypad.kl is in /system/usr/keylayout/heroc_keypad.kl.
Click to expand...
Click to collapse
Nice catch, lol.
Always forget something simple.
EDIT: I really need to start posting stuff while using my laptop.
nice
thanks man this is awesome.
im just "learning" linux. how would i set up the search button for an intent(sp) like opening the browser.apk
feefeeboomboom said:
thanks man this is awesome.
im just "learning" linux. how would i set up the search button for an intent(sp) like opening the browser.apk
Click to expand...
Click to collapse
Well "SEARCH" essentially launches the browser by linking it automatically to google search.
But, in regards to assigning it to launch a different(unlisted) activity, I'm not sure. That's something I'm actually looking into myself, and I think I'm making a little bit of head way .
Haha great work [HOPE]maybe the hero development won't die[/HOPE]
I'm putting this in my sig if you don't mind?
thatguythatdid said:
Haha great work [HOPE]maybe the hero development won't die[/HOPE]
Click to expand...
Click to collapse
As long as there are people there willing to learn, development for the Hero will never die.
[RANT]
I'll make a post in the General Section with all the bookmarked dev'ing related resources that I've found over the year. Then people can just jump in and start reading/tinkering.
What I don't like about the HeroCDMA forum is that most of the community here doesn't share much of HOW they did/do things. Hopefully that will change.
=D
[/RANT] (Please don't respond to this part, haha)
almost forgot what program are you using to open the kl file? Mine always comes out in a horizontal line instead of a vertical like yours?
Edit: Nevermind wordpad does it great
notepad++ is the sh!-|-
feefeeboomboom said:
notepad++ is the sh!-|-
Click to expand...
Click to collapse
I'm a dumbass. I didn't read the entire post before I asked my question and thought that nevermind. Yes notepad is the s
Good work, thanks for putting together a very easy to read how-to.
Thanks for this, the trackball is so annoying for pictures. I made the changes just as it states to but the zoom won't work on the search button, I hold it down and it does nothing, any idea why that may be? And the search button no longer responds on the homescreen, which makes sense but why not in the camera app?
chrish03 said:
Thanks for this, the trackball is so annoying for pictures. I made the changes just as it states to but the zoom won't work on the search button, I hold it down and it does nothing, any idea why that may be? And the search button no longer responds on the homescreen, which makes sense but why not in the camera app?
Click to expand...
Click to collapse
Zoom? Do you mean auto-focus?
I want to do this but I cant get my phone to remount. I have never had a problem before.
cd c:\android-sdk-windows\tools
adb remount
doesn't remount says "no devices found"
CarbonKang said:
I want to do this but I cant get my phone to remount. I have never had a problem before.
cd c:\android-sdk-windows\tools
adb remount
doesn't remount says "no devices found"
Click to expand...
Click to collapse
Heh, is your phone plugged in? USB cable damaged? USB port damaged? Hole plugged? Bears?
If it's none of those, do this:
Code:
adb kill-server
adb start-server
then
Code:
adb remount
If that doesn't work, start from the top again.
Decad3nce said:
Zoom? Do you mean auto-focus?
Click to expand...
Click to collapse
LOL, reading comprehension FTW! I got FOCUS and ZOOM confused. Don't play with your phone late at night!
Decad3nce said:
Heh, is your phone plugged in? USB cable damaged? USB port damaged? Hole plugged? Bears?
If it's none of those, do this:
Code:
adb kill-server
adb start-server
then
Code:
adb remount
If that doesn't work, start from the top again.
Click to expand...
Click to collapse
none of that worked. And there is nothing wrong with the ports at all. I think its Darchdroid.. It has something defective every time I use it lol.
CarbonKang said:
none of that worked. And there is nothing wrong with the ports at all. I think its Darchdroid.. It has something defective every time I use it lol.
Click to expand...
Click to collapse
Do you have USB debugging enabled?
(I haven't had any problems with darchs build)
Decad3nce said:
Do you have USB debugging enabled?
(I haven't had any problems with darchs build)
Click to expand...
Click to collapse
ya, trust me I know what I'm doing.
It just doesn't work
I would love to show you a logcat... but i cant adb remount LOL
Can someone make a flashable zip so i can have a designated camera button as search? I want to be able to click it to take a snap shot of my phone with dro cap.
Thanks

[MOD] Turn off the light on the keys

Hi, there if any of the xda developers can make an application to turn the light on the keys, because when you see a video is a bit annoying that are lit, battery-consuming as well.
Thank you very much for your cooperation.
Regards
Here you go(tnx to mercianary
1. install gscript lite from market and run it once, this should create a directory gscript on your sdcard
2. put memory card in pc
3. create a text file and put this command in it.
echo 0 > /sys/devices/platform/leds-microp/leds/button-backlight/brightness
4. save the file as "buttonled.sh" not "buttonled.sh.txt" in sdcard/gscript
5. put the card back in your phone, hold your finger on the home screen and select shortcut, gscript lite, menu, add script, load file, buttonled.sh, save, buttonled.
6. press the new icon on your screen.
this will only work on 2.1
everytime you press this icon the button lights turn off.
they will come back on after certain events, ie locking the screen.
if you know adb you could edit the file trigger in the same directory to permanently disable the light, i think. you will have to figure that out yourself.
Download of the market LEDs hack,that does exactly what we want.
Thanks to friend velazcod for the contribution.
using the following command in 2.1 turns on the blue led.
echo 1 > /sys/devices/platform/leds-microp/blue/brightness
there is a very similar command, cant tell you what it is cuz i am on 2.2 at the minute, that will turn off the key lights.
just change echo 1 to echo 0 and blue to keyled or something, you have too look in the leds-microp dir to find out.
when you have the right command install gscript lite from the market and add a shortcut to the homescreen to your command.
don't think it will work in 2.2 though.
easy peasy!
edit:i know it turns of the led but i'm not sure if it keeps it off, dont remember.
but I do not want the blue LED, what I want is a small application that allows me to turn off lights or turning on the power when I want to watch a video.
thanks anyway for your help
mercianary said:
using the following command in 2.1 turns on the blue led.
echo 1 > /sys/devices/platform/leds-microp/blue/brightness
there is a very similar command, cant tell you what it is cuz i am on 2.2 at the minute, that will turn off the key lights.
just change echo 1 to echo 0 and blue to keyled or something, you have too look in the leds-microp dir to find out.
when you have the right command install gscript lite from the market and add a shortcut to the homescreen to your command.
don't think it will work in 2.2 though.
easy peasy!
edit:i know it turns of the led but i'm not sure if it keeps it off, dont remember.
Click to expand...
Click to collapse
read my post again
thanks again but I'm a rookie and I have no idea of why I say, anyway thank you very much for your attention, I would like is an app that does that, like the one made to turn the blue LED but for the keys.
Thanks
solution:
Here you go.
1. install gscript lite from market and run it once, this should create a directory gscript on your sdcard
2. put memory card in pc
3. create a text file and put this command in it.
echo 0 > /sys/devices/platform/leds-microp/leds/button-backlight/brightness
4. save the file as "buttonled.sh" not "buttonled.sh.txt" in sdcard/gscript
5. put the card back in your phone, hold your finger on the home screen and select shortcut, gscript lite, menu, add script, load file, buttonled.sh, save, buttonled.
6. press the new icon on your screen.
this will only work on 2.1
everytime you press this icon the button lights turn off.
they will come back on after certain events, ie locking the screen.
if you know adb you could edit the file trigger in the same directory to permanently disable the light, i think. you will have to figure that out yourself.
Ole Ole, hahahaha very good friend of mine works perfectly, many thanks for your great help, you're a crack mate.
a hug
no problem.
the problem is that when putting a rock video with one player or the act, turn to turn on the lights again, is not likely to be permanent?.
Thanks
mercianary said:
Here you go.
1. install gscript lite from market and run it once, this should create a directory gscript on your sdcard
2. put memory card in pc
3. create a text file and put this command in it.
echo 0 > /sys/devices/platform/leds-microp/leds/button-backlight/brightness
4. save the file as "buttonled.sh" not "buttonled.sh.txt" in sdcard/gscript
5. put the card back in your phone, hold your finger on the home screen and select shortcut, gscript lite, menu, add script, load file, buttonled.sh, save, buttonled.
6. press the new icon on your screen.
this will only work on 2.1
everytime you press this icon the button lights turn off.
they will come back on after certain events, ie locking the screen.
if you know adb you could edit the file trigger in the same directory to permanently disable the light, i think. you will have to figure that out yourself.
Click to expand...
Click to collapse
next time use the "quote"
http://forum.xda-developers.com/showpost.php?p=6855691&postcount=4
kingchris said:
next time use the "quote"
http://forum.xda-developers.com/showpost.php?p=6855691&postcount=4
Click to expand...
Click to collapse
Lol. I would have. But I didn't read that thread.
I noticed button-backlight when I was messing around with the blue led.
They say great minds think alike.
I suppose the moral of the story is to use the search button.
PS. Do you knowhow to get this or led to work on fro yo?
mercianary said:
Lol. I would have. But I didn't read that thread.
I noticed button-backlight when I was messing around with the blue led.
They say great minds think alike.
I suppose the moral of the story is to use the search button.
PS. Do you knowhow to get this or led to work on fro yo?
Click to expand...
Click to collapse
+1 I want this too
When I open my shortcut on the homescreen, this pops up:
Is it normal? Seems like the lights go out shortly, but then returns...
Thanks in advance
EDIT:
I ran the gscript lite once and no folder was created on my sdcard. Had to create it myself.
That scree is meant to pop up bit the writing on the bottom is saying something is wrong.
Install connectbot and run the command directly from terminal.
mercianary said:
That scree is meant to pop up bit the writing on the bottom is saying something is wrong.
Install connectbot and run the command directly from terminal.
Click to expand...
Click to collapse
I have no knowledge about Connectbot at all...
I got it working now You have to be really careful NOT to move your hand across the light censor...
Would it be possible to disable the hardware light for good? (With an option to get it back again)
Thanks
/CK
Using Defrost Froyo on mine. I've got these to play with instead:
Code:
./sys/class/leds
./sys/class/leds/lcd-backlight
./sys/class/leds/green
./sys/class/leds/amber
./sys/class/leds/red
./sys/class/leds/blue
./sys/class/leds/jogball-backlight
./sys/class/leds/button-backlight
./sys/class/leds/flashlight
How to permanent turn off the button-backlight?
Is there any way to turn off the button-backlight permanent?
Maybe over adb in recovery-mode? Tried myself, but didn't find a suitable solution
try this
Stiegi said:
Is there any way to turn off the button-backlight permanent?
Maybe over adb in recovery-mode? Tried myself, but didn't find a suitable solution
Click to expand...
Click to collapse
maybe.
try pulling the file triggers located at "/sys/devices/platform/leds-microp/leds/button-backlight/" removing the contents and pushing it back (or just push an empty file)
my thinking is that if nothing triggers the light to come on it will stay off, maybe.
try it and let us know.
I've been wanting to do this on my Evo, thanks guys for giving me a place to start.
I've taken what I've learned here and progressed it just a tiny bit in this thread here:
http://forum.xda-developers.com/showpost.php?p=7003710&postcount=4
Anyone know of a way to get the script to run automatically during/after boot?

Terminal Emulator not playing nice

I'm using the free Android Terminal Emulator (Jack Palevich) from the marketplace. I'm experiencing some problems and wondered if I was alone. Of course I tried to uninstall and re-install the app.
When using the physical keyboard within the Terminal Emulator and I hit the button used for the question mark and forward slash [? /] it will type one of these instead "~". I don't know the technical name for that one; it's the squiggly line next to the 1. I get the squiggly line whether i hit that button normal for a question mark AND when I hit alt to try to type a forward slash.
Ok so the great thing about the MT4GS is that we have more than one keyboard method so when in the terminal emulator I thought I'd be smart and use the soft keyboard insead. While using the soft keyboard I don't have the "squiggly line problem" but whenever I type "if" it will type "If" instead with a capital I. So in order to use Terminal Emulator, I had to switch back and forth between the soft and physical keyboard.
Is anyone else having this problem?
Is there another emulator you are using that you can recommend instead?
Thanks
Yeah I noticed that exact same problem. Frustrating, and I'm sure if you turn off word prediction for the soft keyboard it would probably stop automating the "If," so it's worth a try. But I couldn't get the "/" to work either with the qwerty.
Thanks for checking.
I unchecked word prediction in the phone settings and it didn't help. I Cleared Data for the Teminal Emulator App too. Also unckecked word prediction for Swype even though I wasn't using that. I didn't see an option to turn off word prediction within the app itself though.
Thanks for your your help. Hopefully, an update will be released to help with the physical keyboard in the app.
I'll play around more with settings to see if i can get the soft keyboard work better.
Ok the soft keyboard even capitalizes "I" if it's in the middle of a word.. For example "fIx permIssIons" *shrug* I don't think there is a setting I can change to fix that.
Long press in any text field entry (except Terminal emulator), and select "input method", select "touch input" and use the soft keyboard to enter commands in TE.
For some reason, you can't use any alt functions on the hardware keyboard, so everything has to be typed with either swype (which can get frustrating unless you're a pro), or the stock keyboard. Good luck!
Thanks, that worked!!
Making a local session in ConnectBot (also free, connect as any dummy username @localhost) works better for me than Android Terminal Emulator ever did. It is a little quirky with the MT4GS keyboard (it double maps the bucky keys, so you have to hold shift and alt instead of press-press like everywhere else), and there are a handful of useful symbols I can't figure out how to make ('|', '<' and '>' in particular), but it has been comparatively solid.

Categories

Resources