yashsingh1/xdaforums huggingface dataset:
[Desire Accessories] TechnicGeek:
You want to say that it is pointless to buy earphones with volume control?
[Desire Accessories] HTCandroid1:
Im not sure if you are asking me if i think it is pointless? lol

if you are then id say no, worth it for the play/pause function for me personally
[Desire Accessories] Meaple:
You can get a decent pair of earphones for like £10 off Amazon. You don't have control on them like but that's what your phone is for.
[Desire Accessories] TechnicGeek:
Which control? Volume or track control? I can live without track control, but i need volume control + microphone.
[Desire Accessories] Approximat:
Yes that works. BUT the apple earphones aren't really good.

Take other, it's better for your ears :D
[Desire Accessories] TechnicGeek:
Are there other earphones that are good and their volume control and microphone work?
[G1 Android Development] Shaquiel Harris:
Those same commands happen with us.
[G1 Android Development] Loccy:
Yes, but what I'm looking for is any different entries you get in your logcat when you open and close your keyboard.
[G1 Android Development] Shaquiel Harris:
Oh lol im sorry. This is what happens when opened:

When closed,
[G1 Android Development] Loccy:
Well that was easier than I thought. Here's a first crack for "fixing" the button backlights on ROMs where they're not supported.

#!/system/bin/sh
echo "Monitoring logcat"
mkdir /sdcard/logcatmon

# monitor for screen going off
logcat -d | grep "About to give-up screen" > /sdcard/logcatmon/logcat-screenoff.txt
logcat -d | grep "About to give-up screen" > /sdcard/logcatmon/logcat-screenoffX.txt

# monitor for screen going on
logcat -d | grep "pokeWakelock" > /sdcard/logcatmon/logcat-screenon.txt
logcat -d | grep "pokeWakelock" > /sdcard/logcatmon/logcat-screenonX.txt

while [ 1 ]
do

# update monitor
logcat -d | grep "About to give-up screen" > /sdcard/logcatmon/logcat-screenoff.txt
logcat -d | grep "pokeWakelock" > /sdcard/logcatmon/logcat-screenon.txt

# if screen on
diff -i -b -q /sdcard/logcatmon/logcat-screenon.txt /sdcard/logcatmon/logcat-screenonX.txt
if [ ! $? -eq 0 ]; then
echo "Screen turned on"
echo 1 > /sys/class/leds/button-backlight/brightness
logcat -d | grep "pokeWakelock" > /sdcard/logcatmon/logcat-screenonX.txt
fi;

# if screen off
diff -i -b -q /sdcard/logcatmon/logcat-screenoff.txt /sdcard/logcatmon/logcat-screenoffX.txt
if [ ! $? -eq 0 ]; then
echo "Screen turned off"
echo 0 > /sys/class/leds/button-backlight/brightness
logcat -d | grep "About to give-up screen" > /sdcard/logcatmon/logcat-screenoffX.txt
fi;

sleep 1
done;

What this does is create a working directory in the sdcard to stash its working files. Every second it checks to see if there's been a new entry in logcat for screen on or off - it does this by stashing an appropriate grep of logcat every second, and comparing it to the last one. If they differ, then there's been an appropriate entry in logcat in the last second - meaning that the screen has either come on or gone off. Depending on which is the case, we push the appropriate value to button-backlight/brightness.

Concerns about this approach:

* running logcat every second - twice - and grepping the output. That can't be a trivial demand on processing resources.

* when/if logcat wraps (I assume it doesn't just get bigger, and bigger, and bigger) it'll be seen as a change, meaning you'll get a spurious backlight event. In theory it should be immediately followed by a spurious backlight OFF event - so hopefully no harm no foul. But if I'm wrong, I'm not sure what it'll do to battery life.

Ok people. Pick holes in this, tell me it's appallingly inelegant - off you go!
[G1 Android Development] Loccy:
Hmmm. Is that all? Is the keyboard just treated like a Magic's rotation? Is there nothing more explicitly related to the keyboard? I don't really want to turn on the keyboard every time rotation changes. Basically it'd mean the keyboard would always be on when the phone is rotated into landscape mode.
[G1 Android Development] Loccy:
Ok, so I've just implemented the same scenario as for the home/menu/etc buttons based on those logcat strings Shaquiel gave me. Am not totally convinced that rotation is the thing to look for, but we'll see how it goes.

The keyboard backlight bit I can't obviously test this myself, as I have a Magic. I tested it by making rotation turn the jogball on and off, which seemed to work. For the keyboard backlight I am working a bit blind, though.

Anyway, let's not install this too permanently on anyone's phone just yet, but it'd be appreciated if a G1 person could give it a whirl on an appropriate Sense ROM (e.g. King's Eris, Vega or King's Legend, etc). Here's how:

Stash the lightbodge.txt file on your hard disk somewhere, and then do, from a command line (assuming you have adb here)

adb push lightbodge.txt /sdcard/lightbodge.sh

adb shell

cd /sdcard

sh lightbodge.sh

You should find that pressing the appropriate buttons will result in the lights coming on, and (hopefully) pulling out the keyboard will do the same.

When you're finished testing, press control-C to kill the script. Once I've got some decent test feedback we'll look at how best to make it run on phones in the background.

It might be that you need to be in an app that actually changes orientation when you pull the keyboard out in order for the keyboard light bit to do anything - am not sure about that.

Edit: IF YOU TRY THIS AND POST TO CONFIRM IT WORKING, OR NOT WORKING, CAN YOU PLEASE BE SURE TO TELL ME WHAT ROM YOU ARE TRYING IT ON.
[G1 Android Development] XZ32:
sh: Can't open lightbodge.sh :(
[G1 Android Development] Loccy:
Did you cd /sdcard?

And is lightbodge.sh definitely there on your sdcard?
[G1 Android Development] enemeone:
awesome works perfect :D:D:D
[G1 Android Development] XZ32:
woops sorry was too fast, testing now ;)
[G1 Android Development] XZ32:
the front buttons work just fine!

the keyboard howver gives the following error in logcat:

"lightbodge.sh: cannot creqte /sys/class/leds/keyboard-blacklight/brightness: permission denied"
[G1 Android Development] enemeone:
yeah i was a little quick to same problem with keyboard
[G1 Android Development] Loccy:
Did you type that, or copy and paste it? If my script has blacklight rather than backlight in, no wonder it didn't work! But I can't see that typo here anywhere on my versions of the script.

Assuming it's a typo when you were transcribing it -

What ROM are you running?

And you *do* have a G1, don't you?

Could you do something else for me? In an adb shell,

cd /system/class/leds

ls

and tell me what you see there.
[G1 Android Development] XZ32:
I typed it lol sorry for the typos, on AZERTY kb here...

I'm currently running Kings DroidEris 1.2, On G1 yes :)

sec ill try it out
[G1 Android Development] XZ32:
cd: can't cd to /system/class/leds
[G1 Android Development] Loccy:
D'oh.

That's

/sys/class/leds

sorry!
[G1 Android Development] KingAzzA:
AWESOME work Loccy !!!!! It works. Just tried sending a text and the keyboard lights definetley work !!! Work a couple of seconds after you open keyboard on any other screen aswell. Keep up the awesome work
[G1 Android Development] XZ32:
lcd-backlight

blue

green

red

spotlight

keyboard-backlight

button-backlight
[G1 Android Development] Loccy:
Good. So the keyboard backlight is there - for a moment I thought it might not be, and this would all have been for nothing.

So, what happens if you do

echo 1 > /sys/class/leds/keyboard-backlight/brightness

???
[G1 Android Development] Loccy:
Good to hear - but just so we can try and figure out what's going on, which ROM are you running?
[G1 Android Development] XZ32:
cannot create /sys/class/leds/keyboard-backlight/brightness : permission denied
[G1 Android Development] Loccy:
Are you root? Is the command prompt a $ or a # sign?

You're not running it from the terminal emulator on the phone, are you, rather than with adb shell? I'm assuming you're already root (which you would be with an adb shell).

if you're on the terminal emulator, do

su

before anything else.
[G1 Android Development] XZ32:
im using adb shell at the # sign...
[G1 Android Development] Loccy:
Ok, do

cd /sys/class/leds/keyboard-backlight

ls

and tell me what you get.
[G1 Android Development] XZ32:
uevent

subsystem

device

power

brightness

trigger
[G1 Android Development] Loccy:
So if in that directory, you do

echo 1 > brightness

I assume you get the same permission denied?
[G1 Android Development] XZ32:
yeah "cannot create brightness: permission denied" :(
[G1 Android Development] Loccy:
See, it's the *create* bit that's confusing me there. There's already a "file" called brightness in there, we're not asking it to create anything.

How about if you do

cat brightness

??? (it should say 0)
[G1 Android Development] XZ32:
yeah says 0

the command is "echo[space]1[space]>[space]brightness" no?
[G1 Android Development] Loccy:
ok, desperation tactics here.

chmod 777 brightness

echo 1 > brightness

???
[G1 Android Development] XZ32:
Works!!! KB lights lit on
[G1 Android Development] Loccy:
Crowd goes wild.

Right, script fix in a few minutes.
[G1 Android Development] XZ32:
Sick man u RULE!
[G1 Android Development] Loccy:
Right, new version of the script below.

Be sure to delete the old one from your SD first just to avoid confusion. Follow the same instructions as per post 7 again. This one should say "Changing privs" before going on to "Monitor logcat".

If you want to leave running in in the background on your phone, you can run it with

sh /sdcard/lightbodge.sh &

(note the & at the end of the line)
[G1 Android Development] Polskipl:
I just see what you are testing guys .. so I flash Droid Eris on my G1 right now and try your script :)
[G1 Android Development] XZ32:
ok the new version works, nice!

One issue tho, when rotating the phone, the kb lights go on, sometimes , sometimes not...

i see in the logcat "keyboard opened/rotated to landscape" then "keyboard opened/rotated to portrait" even when the screen is off :P

I sometimes get this line:

Files /sdcard/logcatmon/logcat-keyboardclose.txt and /sdcard/logcatmon/logcat-keyboardcloseX.txt differ

Files /sdcard/logcatmon/logcat-screenoff.txt and /sdcard/logcatmon/logcat-screenoffX.txt differ

Files /sdcard/logcatmon/logcat-keyboardopen.txt and /sdcard/logcatmon/logcat-keyboardopenX.txt differ

at random
[G1 Android Development] Shaquiel Harris:
Glad my logcat was of some use! great job Loccy
[G1 Android Development] CLEV3R:
so does this only work when the phones connected to the pc? i tried to add the command so it could run in the background but once i unplug the phone everything stops.. any help?
[G1 Android Development] KingAzzA:
great work Loccy !!! A*************

It works perfectly althought there is a slight delay on the 4 main buttons from when you first press em to when they turn on BUT MY G1 BACKLIGHTS WORK !!!!!!!!

edit: running Vega's 0.9.1 Legend on my G1
[G1 Android Development] JAguirre1231:
Just read from the first page so correct me if I'm wrong, but shouldn't this have to be run after every boot? If it does, why not toss it in /system/bin and have something that runs every boot (such as a2sd) start it up?
[G1 Android Development] Polskipl:
yea it's running for me aswell

and bry1391ant - No, you don't have to be connected to usb after you've done this
[G1 Android Development] speedysilwady:
Hmm, haven't tried this script yet, but would a similar script control led notifications as well?
[G1 Android Development] protomanez:
Seems to be working well on the good ol' g1.
[G1 Android Development] jon6206:
makes sense. awesome work Loccy as usual

EDIT: Seems to work fine after reboot
[G1 Android Development] apreichner:
Confirmed its working, with a slight delay, but it is working on the KiNgxKxKlair DroidEris2G1 1.2 ROM. Still no notification LEDs, but I don't think that would be too hard to fix would it?
[G1 Android Development] lilwing:
could you do the same sort of thing for the LED's? except check when a text comes in or something like that? or do i sound ignorant? hahahaha
[G1 Android Development] philow:
OK, I am a noob as you can se by the number of posts I have :)

But I was looking at the logcat on the changes that happen on my G1 when I open and close the keyboard vs rotating the screen. Here are my findings:

Keyboard changed to Open

I/WindowManager( 156): Config changed: { scale=1.0 imsi=0/0 loc=en_US touch=3 keys=2/1/1 nav=3 orien=2 layout=18}

I/ActivityManager( 156): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/1 nav=3 orien=2 layout=18}

Keyboard Changed to Closed

I/WindowManager( 156): Config changed: { scale=1.0 imsi=0/0 loc=en_US touch=3 keys=2/1/2 nav=3 orien=2 layout=18}

I/ActivityManager( 156): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3 orien=2 layout=18}

Rotate screen from Portrait to Landscape

I/WindowManager( 156): Config changed: { scale=1.0 imsi=0/0 loc=en_US touch=3 keys=2/1/2 nav=3 orien=2 layout=18}

I/ActivityManager( 156): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3 orien=2 layout=18}

Rotate screen from Landscape to Portrait

I/WindowManager( 156): Config changed: { scale=1.0 imsi=0/0 loc=en_US touch=3 keys=2/1/2 nav=3 orien=1 layout=18}

I/ActivityManager( 156): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3 orien=1 layout=18}

Notice that 3 numbers following keys= in the items above

When the keyboard is shut they are always keys=2/1/2

When the keyboard is opened they change to keys=2/1/1

Conclusion is to look for that change in logcat instead of just a rotation.

One last thing I noticed in the logcat was that this line:

I/WindowManager( 156): Setting rotation to 1, animFlags=1

Does not always happen when you open or shut the keyboard and that the animFlags=1 when it does rotate with the keyboard and animFlags=0 when rotated with the accelerometer.

Maybe this will help make sure that is the keyboard that is opening and not just a screen rotation.
[G1 Android Development] wneq:
"cannot stat lightbodge.txt no such file or directory" file on /sdcard i don't know what I do bad :/ sry for my english is so bad ..
[G1 Android Development] jshealton:
Why is it that King's AOSP 2.1 has the keyboard lights working and Sense does not? What does the AOSP build have that Sense does not? And can we use the AOSP build to fix Sense?
[G1 Android Development] Loccy:
Oh, absolutely - at this stage I just wanted people to test it worked on a G1 before I had people go tossing it into their startup scripts.
[G1 Android Development] JAguirre1231:
I like to live dangerously so I did it, but I seem to have a problem where they turn on and then off immediately
[G1 Android Development] Loccy:
Sorry, don't quite understand there - are you saying that they just come on once and then turn off immediately during boot, or is it that they sort of do what they're supposed to, but go straight off again?
[G1 Android Development] JAguirre1231:
The latter, as in I open the keyboard, and after half a second, they turn off again. Then it repeats every 5 seconds as long as the keyboard is open (or the screen is on for the front buttons)
[G1 Android Development] philow:
This may be because of what I put in post #49

Where if the screen is not rotating it will not trigger the lights.
[G1 Android Development] Loccy:
Ok, so someone check my logic here.

If I turn the keyboard light on, when I get the string

keys=2/1/1

the string seems to only happen when the keyboard is opened, yes?

In contrast, the string

keys=2/1/2 happens on keyboard close OR a rotate event. So if I turn the keyboard light off on that, if you close the keyboard the light will go off. However, if you turn the phone around they keyboard will also go off, but how often are people going to turn the phone with the keyboard open and the light on?

Arguments against that, people?
[G1 Android Development] jshealton:
No, your logic seems sound. Makes sense to me anyway.

LOL I made a pun! Man I have a bad sense of humor. Oh no not again!!! Ok I am going to stop before I am banned for bad jokes.
[G1 Android Development] Loccy:
Ok, so the new version attached to the first post implements keys=2/1/1 as our trigger for the keyboard backlight. See how you get on with it. I'm off to bed! :D
[G1 Android Development] Loccy:
Ok, I really am going to bed now, because the behaviour I am seeing is if the USB is plugged in - I don't even have to be adb'ing, or anything, just plugged in - it does what I expect. If the phone isn't plugged in - on the navigation button backlights at least - I get a quick flash before they go out again. This would seem to be the same behaviour some were seeing on G1s with the keyboard lights.

I'll have another look tomorrow. I find myself wondering what the trigger "file" in the led directories do. It contains something like

[none] rfkill0 battery-charging-or-full battery-charging battery-full usb-online ac-online mmc0 mmc1 timer heartbeat sleep

and it's that usb-online that has me wondering...

Tomorrow is another day!
[G1 Android Development] Firerat:
why does everyone want to dump stuff in a2sd?

King's a2sds are littered with useless, little tagons

Don't follow what king does with scripts, he hasn't a clue

stick it in firstboot.sh

yes yes, your going to tell me that firstboot.sh is 'really clever' and chmods itself

but the thing is, it makes no difference

try it

ls -l /system/firstboot.sh
sh /system/firstboot.sh

it will tell you it couldn't chmod itself ( assuming your /system is ro )

so if you want something to run everyboot, put it in firstboot.sh :)

want it to run once?

put it in firstboot.sh as a conditional, or as a function and have the function sed out the function call
[G1 Android Development] kingklick:
nothing wrong with putting **** that needs to run each boot in a2sd

tell shafty. a java coder that.

that was harsh man :(

Sent from my Nexus One using the XDA mobile application powered by Tapatalk
[G1 Android Development] jshealton:
I for one am using your ROMs so you cannot be that bad. I was just hoping that when they get this working you could incorperate it into your Sense ROMs. Thanks.
[G1 Android Development] Firerat:
just put it in 'firstboot.sh'

and you don't need the stuff you are sticking in a2sd anyway

I mean wtf put a 3d toggle in it?

why do you want to toggle 3d each boot ?

did you read and understand that script before you stuck it in a2sd?
[G1 Android Development] Loccy:
If I can step in to this fun little contretemps between King and Firerat for a moment :D

There's a new version on the front page. I need as much information from people's testing as possible, as I can only go so far with my Magic. When you post, please let me know:

G1 or MT3G/Magic

Which ROM you're using.
[G1 Android Development] Firerat:
lol :rolleyes:

Only had a quick look at what you doing here , I like it

I did do a diff on getprops the other day but got nothing, then got distracted

I'll see if I can try this later, give you some feedback from my g1, only I've not had legend on it for a bit.

Oh, I Think I might be cheeky and pinch your logcat watch bit later :)

I need it because flash_image is stupid and gives an exit 0 even if it didn't flash the boot.img, no point rebooting if it didn't flash ;) )

Going to look at what ASE can do for me first though, that might prove useful here to.
[G1 Android Development] Loccy:
Knock yourself out :) As I said in my initial post, the logcat monitoring stuff is an appalling bodge and there must be a better way of doing it. It may be that a shell script isn't the best way to do it - maybe an actual app would be better. Does anyone know how HeroLED went about its business?
[G1 Android Development] Firerat:
I mentioned ASE , thats got all sorts of scripting languages and they can be run as a deamon, with full access to the android api ( except shell scripting, which has most of the api )

I've only looked at it briefly, I think it would be ideal for this to start with, as its quick to implement. but I wouldn't see it as a final solution.

IConrad01, reminded me about it the other day, glad he did :)
[G1 Android Development] smjfosho:
can anyone help me with this?

ive tried quite a few ways of doing this.

check my sig for what im running
[G1 Android Development] davidrol:
Mac with terminal version

I don't have ADB to install this script according to your instructions, I have a Mac PPC and cannot install Android SDK. Is there a way to install from the SDCard this using terminal, only?

Thanks for the work you put into this!
[G1 Android Development] apreichner:
I think the final solution might be native support for the LEDs. I have seen it in a 1.5 Sense ROM before, but not a 2.1 one. Now of course, I'm just getting started in the developing world of Android so I don't know nearly as much as some of you guys do. My guess is we would need some sort of hybrid ROM since we can't have native support from the Hero ROMs, but I'm sure there's a lot more to it than that.

Loccy, I'll go ahead and give the newest version a test. I flashed back to SuperD, so I'll have to flash back to a Hero ROM and let you know. :)

EDIT:

I took a look at the logcat for opening and closing keyboard. Took a bit of opening and closing to find out the area of log that changes and that is unique for opening and closing, but I found it.

I'm also going to take a long look at logcats for text messages, email, and missed calls. Unfortunately, there are tons of apps with their own notification system, so this wouldn't ever work 100 percent.

ALL OF THESE ARE DONE WITHOUT THE PATCH FROM LOCCY. Used: KingKlick's Droid2Eris ROM.

Opening Keyboard Logcat

D/LockExchangeUtils( 2674): isLockExchangeEnabled = false
I/WindowManager( 2674): Setting rotation to 1, animFlags=1
I/ActivityManager( 2674): Config changed: { scale=1.0 imsi=310/260 loc=en_US tou
ch=3 keys=2/1/1 nav=3/1 orien=2 layout=18}

Keyboard Close Logcat

I/WindowManager( 2674): Setting rotation to 0, animFlags=1
I/ActivityManager( 2674): Config changed: { scale=1.0 imsi=310/260 loc=en_US tou
ch=3 keys=2/1/2 nav=3/1 orien=1 layout=18}

But it looks like every time you are supposed to see the LEDs light up, whether its for pressing a button or receiving a message, you get one of these logcat errors:

E/LED_DUAL( 2674): open failed errno: 2
E/LED_DUAL( 2674): open failed errno: 2
E/LED_DUAL( 2674): open failed errno: 2
E/LED_DUAL( 2674): open failed errno: 2
E/LED_DUAL( 2674): open failed errno: 2

The reason you don't see those errors in the keyboard opening and closing is because I was already using the phone so the LEDs had already given the errors earlier on. But if I don't use the phone and I open my keyboard, I receive those errors.

SMS Logcat

Unfortunately, SMS messages are a bit different than opening and closing the keyboard because you have a lot of junk going on at once. I managed to narrow down the starting point for the message and pasted it into a Google Docs document, I also added line numbers for help. I opened full editing of the document to anyone, so feel free to edit the document as you see fit, and if you can narrow it down any better, go for it.

http://docs.google.com/Doc?docid=0AQM8-PKA4rjzZGQ5Yng3Zl82d2o2Y2p4Znc&hl=en

EDIT 2:

I tested the newest patch and it works pretty well. As far as I can tell the softkey LEDs work flawlessly. The keyboard lights are still slightly delayed, but not too bad. Good job Loccy
[G1 Android Development] jshealton:
Ok now for the stupid question.

How do I dump this into either firstboot (preferably) or into a2sd?

And don't just say ADB. I have no clue how it works. Either point me in the right direction or don't respond.
[G1 Android Development] smjfosho:
id like to know this as well
[G1 Android Development] mrzhadow:
sorry guys posted in the wrong window!

_________________________

Phone G1 white

Radio 2_22_23_02

Spl Danger

ROM KiNgxKxKlair-DroidEris2g1