LEDUp - simple LED control program - Windows Mobile Development and Hacking General

Hello!
I've written a simple, command-line controlled LED/VIbe control program. You can enable/disable the LEDs (at least partially...), the same goes to the vibe engine (if it is reported by the OS as LED).
It can be obtained here: http://bodz.elsat.net.pl/vis/uploader/index.php?plik=PDAClub.pl Forum LEDUp.cab&op=get
As it may be obvious to some of us, there are not all diodes available for software control, thus please run 'LEDUp Help' to run the test, which LED is which, and if vibe is reported as LED.
The default setup program creates some shortcuts. The 'vibe' may be misleading, cause on some (most?) devices LED1 is not a vibe at all
Oh, well... just try it, if you wish...

_TB_TB_ said:
Hello!
I've written a simple, command-line controlled LED/VIbe control program. You can enable/disable the LEDs (at least partially...), the same goes to the vibe engine (if it is reported by the OS as LED).
It can be obtained here: http://bodz.elsat.net.pl/vis/uploader/index.php?plik=PDAClub.pl Forum LEDUp.cab&op=get
As it may be obvious to some of us, there are not all diodes available for software control, thus please run 'LEDUp Help' to run the test, which LED is which, and if vibe is reported as LED.
The default setup program creates some shortcuts. The 'vibe' may be misleading, cause on some (most?) devices LED1 is not a vibe at all
Oh, well... just try it, if you wish...
Click to expand...
Click to collapse
Many members of ppc.greeks have been looking for this kind of softeware for the treo 700wx because of no led notifactions-many thanks to Malatesta for providing this link .TB_TB_Thanks for taking the time to put this kind of software together.Ive been looking for it for a long time with no luck till today.It works very well but can you tie the Ledup software to have the led blink when V-mail/miss call icon apears on screen giving the treo wx user some led alert when missed call/vmail comes in.

I second this. This is the last major thing I miss from my old Treo. I'm using the 750v which is very much like the 700wx.
Please continue to work on this application to get it to activate the LED (on a user selected behaviour) once a notification is received.
I used to set mine to a solid ORANGE led on new Notification.

Does the test feature (activated via 'LEDUp Help' shortcut) turn the LEDs as you would like it to? I mean - does the led turn orange, etc. ?

_TB_TB_ said:
Does the test feature (activated via 'LEDUp Help' shortcut) turn the LEDs as you would like it to? I mean - does the led turn orange, etc. ?
Click to expand...
Click to collapse
Orange hmmm I Think many of the treo 700 users are just happy to see the green When I have a message or voice mail present then actavate LEDup It blinks green untill I clear the call or message but when a call/message comes in there is no green blink The [email protected] panel is GREATTTTT I LOVE IT.Its very clear and easy to understand.Why Palm Failed to add software you are building to the 700 series is beyond me.They built a pda leaving us in the dark of missed call,voice mail with no led alert what so ever.

Some more info for the Treo 700wx/750:
Colors available for LED: Red and Green (no orange)
Currently from my limited testing, this LED app only gets us the Green LED activated but it would be beneficial to try and nail down the RED too maybe for other events.
_TB_TB_ if a Registry export would be helpful, just drop the word and you can have one.

I do not think, that LEDs are controlled via rgistry. You can only OBTAIN info about LED status, but not SET LED status via registry.
My BlueAngel has two leds - left and right. Left one is for BT and WiFi (not controllable at all via default SDK) - it may blink blue or green. The right LED can have one of the colors: red, blinking red, orange, green, blinking green. I may only set the state to 'active' (blinking red) via the default SDK.

_TB_TB_ said:
I do not think, that LEDs are controlled via rgistry. You can only OBTAIN info about LED status, but not SET LED status via registry.
My BlueAngel has two leds - left and right. Left one is for BT and WiFi (not controllable at all via default SDK) - it may blink blue or green. The right LED can have one of the colors: red, blinking red, orange, green, blinking green. I may only set the state to 'active' (blinking red) via the default SDK.
Click to expand...
Click to collapse
On the treo 700 series the led stays solid red when you have it charging then turns solid green after charge is compleate.so lets say it on charge and missed call/v-mail is left would it go to blinking red. very cool for that to be the case or not to make it confusing TB_TB_ but missed call binking red and if a Voice mail is present going to blinking green.

Those of you with a Hermes or similar might be amused to try my VJPlumBum program. Just a little frivolity...
V

vijay555 said:
Those of you with a Hermes or similar might be amused to try my VJPlumBum program. Just a little frivolity...
V
Click to expand...
Click to collapse
oh yeah oh yeah I had that software in my ipaq 6315 hahaha good stuff

_TB_TB_ said:
Does the test feature (activated via 'LEDUp Help' shortcut) turn the LEDs as you would like it to? I mean - does the led turn orange, etc. ?
Click to expand...
Click to collapse
I'm not sure you got a good answer for this question.
The LEDUp Help tests do the following on the Treo 700wx.
Total LEDs reported by Windows: 2
LEDUp 0 0 - led off
LEDUp 0 1 - led blinks green
LEDUp 0 2 - led blinks green (appears no different than 0 1)
LEDUp 1 0 - vib off
LEDUp 1 1 - repeating vibrate
LEDUp 1 2 - repeating vibrate (appears no different than 1 1)
Is the source for the LEDUp available or is there example code somewhere? It would be nice to have a service or plugin that monitors the active notifications in the registry that would turn on the LED blink when a missed call notification is active and turn it off when it is dismissed. Maybe it could be a hook into the notification somehow.
Thanks!

hannip: this is standard api - nled.
V

vijay555 said:
hannip: this is standard api - nled.
V
Click to expand...
Click to collapse
Ah, notification led api. Found it. Thx.

Is there any way of integrating your LED program into the data flow from the USB cable as in newer versions of WM5torage?
WM5torage blinks the LEDs and even vibrates the device to reflect Read/Write access to the exported disk which is ingenious. Curious to know if there is someway of doing this programatically for data read in/out of device like some form of a visual bandwidth meter?
Thanks in advance...

It could be feasible to control the standard notification led in that way, or it's possible to hack the whole device to say show blue led for device reads, and red lead for device write etc.
V

Vijay555, thanks for yor quick reply, I know of your reputation as a wm5 programming God, I use many of your programs so I am sure that this could turn into something! Could this one be called Vlights or VLEDS or something along those lines? Keep us posted!
Regards
vijay555 said:
It could be feasible to control the standard notification led in that way, or it's possible to hack the whole device to say show blue led for device reads, and red lead for device write etc.
V
Click to expand...
Click to collapse

Lol, I'm no God, not even an anagram of the word!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I've written code for control of the leds on some HTC devices (outside and expanded beyond the normal api) - try VJPlumBum for a test. However, for general device compatibility it'd be best to use the normal nled api. However, either way, you'd need access to the WM5torage source code ideally. Why not suggest the idea to the author?
V

Total LEDs reported by Windows: 2
LEDUp 0 0 - led off
LEDUp 0 1 - led blinks green
LEDUp 0 2 - led blinks green (appears no different than 0 1)
LEDUp 1 0 - vib off
LEDUp 1 1 - repeating vibrate
LEDUp 1 2 - repeating vibrate (appears no different than 1 1)
Question
ledup reports 2 leds on the treo 700 series . Ledup-02 is the same as 01.Can 02 be tweaked to get red led blink?If so how difficult would it be to tweak ledup making red blink a reality for the wm palm owner.
I'm now on mortscript level of building software.Any help would be much appreciated.
P.S
vijay555 I give VJPlumBum a try in the treo No led blink but the tune was great
Phil C

Please remember, that "2 leds" means that there are two "signaling devices" available for the standard applications usage. This may be LEDs, Vibes, or anything else.
LEDUp 0 1 = LEDUp 0 2 is true for most of the devices, because the drivers implement both "active" and "blink" in the same way.
To controll the LEDs more extensively one should most propably use the drivers directly...
Source code below:
ledz.h:
Code:
# include <nled.h>
extern "C"
{
BOOL NLedGetDeviceInfo(INT nID, PVOID pOutput);
BOOL NLedSetDevice(INT nID, PVOID pOutput);
}
int GetLedCount()
{
NLED_COUNT_INFO nci;
int wCount = 0;
if(NLedGetDeviceInfo(NLED_COUNT_INFO_ID, (PVOID) &nci))
wCount = (int) nci.cLeds;
return wCount;
}
void SetLedStatus(int wLed, int wStatus)
{
NLED_SETTINGS_INFO nsi;
nsi.LedNum = (INT) wLed;
nsi.OffOnBlink = (INT) wStatus;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &nsi);
}
Main cpp file:
Code:
// LEDUp.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "ledz.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
if((_tcslen(lpCmdLine) < 1) || (_tcslen(lpCmdLine) > 3)){
TCHAR buf[50];
_stprintf(buf, _T("Total LEDs reported by Windows: %d"), GetLedCount());
MessageBox(GetForegroundWindow(), _T("LEDUp: a simple command - line tool for LED/vibe setup.\nUsage:\n\nLEDUp.exe ledno ledstate\n\nWhere ledstate:\n\t0\toff (normal)\n\t1\ton\n\t2\tblink\n\nledno is a LED number (sometimes vibe engine is reported as LED)."), _T("LEDUp info"), MB_OK|MB_ICONINFORMATION);
MessageBox(GetForegroundWindow(), buf, _T("LEDUp info"), MB_OK|MB_ICONINFORMATION);
if(IDYES == MessageBox(GetForegroundWindow(), _T("Test the LEDs now?"), _T("LEDUp Test"), MB_YESNO|MB_ICONQUESTION)){
for(int i = 0; i < GetLedCount(); i++){
for(int j = 0; j < 3; j++){
_stprintf(buf, _T("Testing LED #%d, state %d\ncmd. line: LEDUp %d %d"), i, j, i, j);
SetLedStatus(i, j);
MessageBox(GetForegroundWindow(), buf, _T("LEDUp LED test"), MB_OK|MB_ICONINFORMATION);
}
SetLedStatus(i, 0);
}
}
return 0;
}
_tcsrev(lpCmdLine);
SetLedStatus(_wtoi(_tcsrev(lpCmdLine) + 2), _wtoi(_tcsrev(lpCmdLine) + 2));
return 0;
}

Thanks TB for all your help

Related

Signal Strength

I am sure this question has been asked and answered many times. However a simple search of my subject line in 'programmers corner' yeilds no results.
How is it possible to obtain the signal strength at the current time?
Thanks, Ben.
In reply to my own message, a quick hack at the ril.h and I have a solution to getting the signal strength. My apologies to the authors of ril.h, and thanks to IP Dashboard for unknowingly providing the calibration.
If anybody want to use this, and until such time as the correct solution is published, this is a hack which works.
Beware, possible bug with rill.dll?? When connected to GPRS, the signal strength is always returned as 69% (183) ???
In ril.h add the following structure:
typedef struct {
DWORD dwUnknown1;
DWORD dwUnknown2;
unsigned char ucSignalQuality;
} RIL_SIGNAL_QUALITY;
And uncomment / adjust the definition of RIL_GetSignalQuality to:
HRESULT RIL_GetSignalQuality(HRIL lphRil);
Add a couple of global variables:
DWORD m_dwSigQuality = 0;
HRESULT m_dwSigQualityID = 0;
Edit the ResultCallback to include this code:
if (hrCmdID == m_dwSigQualityID) {
if (dwCode == 1) {
RIL_SIGNAL_QUALITY *data;
data = (RIL_SIGNAL_QUALITY *)lpData;
m_dwSigQuality = (data->ucSignalQuality == 255)
? 0
: (data->ucSignalQuality * 9 / 7) - 166;
} else {
m_dwSigQuality = 0;
}
m_dwSigQualityID = 0;
}
Add your own method to get the signal strength:
void OnButSigStrengh()
{
m_dwSigQuality = 0;
m_dwSigQualityID = RIL_GetSignalQuality(g_hRil);
int iTimeout = 100;
while (m_dwSigQualityID && iTimeout--) Sleep(10);
CString s;
s.Format(TEXT("Signal Strength = %u%%"), m_dwSigQuality);
MessageBox(s);
}
Which should work.
Ben
Ben -
Nice work -- the code snippet you posted is more or less what we did to get signal strength up and running in IP Dashboard -- of course, I had to do the calibration manually by walking around New York City while a test app spit out readings from the SignalStrength function and I looked at the signal bars, but hey, it was fun. I don't visit often or I would have responded sooner.
Here are the calibration readings we use:
#define ID_PHONEINFO_SIGNALSTRENGTH_POOR 0x80
#define ID_PHONEINFO_SIGNALSTRENGTH_FAIR 0xa1
#define ID_PHONEINFO_SIGNALSTRENGTH_GOOD 0xad
#define ID_PHONEINFO_SIGNALSTRENGTH_EXCELLENT 0xbb
#define ID_PHONEINFO_SIGNALSTRENGTH_NOSIGNAL 0xff
Regards,
Noah
Hudson Mobile
(makers of IP Dashboard)
Hey Noah, you know a very good addition to your program could be.
In the same way that you have that "floating" network icon, that you can position it on top or the bottom, (you even provide exact location on top, which I find it pretty useful). You should make another icon for the signal, just like the one from the phone, but the advantage is that yours can hold any skinning done in the phone. I have tried PocketBlinds, Facelift and others and your Network icon stays where it should, whereas the radio signal icon stays behind the skinning. and the option of making this icon show at the bottom, makes it even better, some people (like me) prefer seeing the icons at the bottom and not on top. This would make a great addition for your program and would make a killer app. Well, that and the addition also of a battery metter
By the way, if you need any kind of help designing the icons let me know, I would like to help
Yorch --
I saw your post at Wormhole Creations' website as well -- my apologies for not writing back, we are putting together our next product right now (tracker for phone voice minute usage) and things are hectic.
There is special code in IP Dashboard to make sure the taskbar icon floats above a skinned interface - we could potentially add a signal strength icon as well. Coincidentally, we really need ICON design help. If you are willing to design some cool icons for signal strength, I think we could probably work it into the product without too much difficulty over the next 1-2 releases. Let's take this to email -- I can be reached at nbreslow AT hudsonmobile.com
As for the Battery meter, we want to keep the product focused, but a simple battery meter function (line item that read: Battery X%) would be pretty easy to add as well.
Thanks for your interest and suggestions,
Noah
Hudson Mobile
Guys - Try Phone Dashboard, a Today Plug-in - Part of it polls real-time signal strength and displays it in percentage terms - v.Useful if you need a real validation of the Signal Strength bar.
Ben
How you getting on?
Drop me a mail...
Hello, the code above works like a charm!
I have however a side-effect: the radio icon on the top bar seems to indicate that the radio is off (I cannot receive calls) when I run the program. A couple of minutes after I close it, it goes back to normal.
This is my initialization line:
res = (*fpTAPIrilInit)(1, AsyncCallBack, NotifyCallBack, RIL_NCLASS_MISC, 0x55AA55AA, &hRil);
Any thoughts?
Many thanks for the help!
why cant ppl just post source codes it would be sooo much helpfull !!!
It need to get signal strength on my Universal, too. So
does it work with on HTC Universal with new WM 6 ?
thanks,

WM Tactile/Haptic feedback API

Does anyone know how to invoke the tactile feedback from an app. Specifically, I am writing my own keyboard but i would like to generate the little pulses when my virtual keys are pressed. I cant find anything on how to actually do this. presumably it's just one system call.
I have a HTC touch pro 2, so i want to get it working on this at first.
thanks for any help,
You just have to vibrate the phone for a very small time, around 20-50ms.
I don't think there's an API for "haptic feedback", it's just a vibration.
It is just touch-vibrate like you said
Just a tip:
The vibration motor is like the led on your device to handle.
Also the vibration/led id is different on different devices!
Hi,
That's what i was thinking too. I'm going to try the WM Vibrate/VibrateGetDeviceCaps/VibrateStop functions to see if they will do it.
If anyone knows if there's more too it than this, please advise.
thanks,
Unfortunately the Vibrate API does not work. These smartphones are actually pocketPC which doesnt support the API.
Intead i use the NLED interface with led=1. This seems to work to create a basic pulse, but i dont know of any way to adjust the strength of the pulse or even if that's possible.
this is what im doing:
Code:
static void LedOn(int id)
{
NLED_SETTINGS_INFO settings;
settings.LedNum= id;
settings.OffOnBlink= 1;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings);
}
static void LedOff(int id)
{
NLED_SETTINGS_INFO settings;
settings.LedNum= id;
settings.OffOnBlink= 0;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings);
}
static void key_hepatic_feedback()
{
LedOn(1);
Sleep(20);
LedOff(1);
}
No, the strength isn't adjustable. You can only control the duration.

[CM7]KANG discussion

This is the place where you can post and talk about your own personal cm7 builds, aka KANGS, experimental ideas and such.
PURPOSE: keeping the main CM7 thread clean.
THIS
Subscribed although I can't build myself. This matter is too interesting not to follow. I think bk201 his posts are the ones that I pay most attention to and I hope he will not be discouraged by this 'ban' but will keep us informed here.
Taptalked u see
Taptalked u see
Zatta said:
Subscribed although I can't build myself. This matter is too interesting not to follow. I think bk201 his posts are the ones that I pay most attention to and I hope he will not be discouraged by this 'ban' but will keep us informed here.
Taptalked u see
Taptalked u see
Click to expand...
Click to collapse
yep, love those posts too
Zatta said:
Subscribed although I can't build myself. This matter is too interesting not to follow. I think bk201 his posts are the ones that I pay most attention to and I hope he will not be discouraged by this 'ban' but will keep us informed here.
Taptalked u see
Taptalked u see
Click to expand...
Click to collapse
Setting up a build environment isn't that hard. If you need help, please let me know.
siky_dude said:
This is the place where to talk about your own personal cm7 builds, aka KANGS.
PURPOSE: keeping the main CM7 thread clean.
THIS
Click to expand...
Click to collapse
sorry for all the trouble.
currently testing:
I426982b3, I16a40854, Idb544452
feedback: have to test this some more, but didn't work when i tried the first time. there could be a popup informing user that bootanim was imported sucessfully or not, also fps rate dropped quite a bit after 1 or 2 seconds previewing chosen bootanim. that worked, but when i rebooted bootanim was still the default. don't know if i did something wrong though.
If0476af0, If5485caf
feedback: no errors on output, but icon on statusbar doesn't show. profiles feature keeps working fine, with this on or off.
Idf1cb09f, I89bdbc11
feedback: working flawlessly. 3 or 4 seconds less on boot process.
I52fcd648
feedback: downloaded Third Blade from market (~49mb), no issues downloading or installing. internal/external sdcard unaffected. no more need for this maybe?
I4427e3f2
feedback: working without issues; from what i understand this a function that gets string lenght (for example from a user input, not so sure here); any way to get a more technical comparison? a math test to cpu perhaps?
I92569aa2
feedback: also working, and solved original issue.
Ic0b39c23
feedback: no compile errors, no issues until now, seamless.
Id3e68a75, I2e365a33
feedback: working; does what's described. will test further for conflict with HSPA setting introduced by pawitp.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I461e90ac, I70d846ab, I76632c87
feedback: working; need more time to check for improvements on battery runtime.
Very good work. Have you been commenting on gerrit also? That would useful for the peer reviewers.
jose.celestino said:
Very good work. Have you been commenting on gerrit also? That would useful for the peer reviewers.
Click to expand...
Click to collapse
I haven't, the devs said i shouldn't if i didn't have anything to contribute.
more in testing
I5cb28b08
feedback: no issues to report, seamless
Ic395fae3
feedback: fixes skewed preview on camera when launching it from lockscreen custom app starter, with auto-rotation/90º active.
I985c4573
feedback: looks good, seamless on the end user i guess
I923fa5aa
feedback: still working fine, that nice terminal
just saw this, will test later:
I7ccd5e2c
Jens1969 said:
Setting up a build environment isn't that hard. If you need help, please let me know.
Click to expand...
Click to collapse
Do you think we should get a little bit more constructive/extensive (based on the wiki, sure) on build tips? setting up the buildenv isn't hard at all (just bandwith/time consuming), but 'repo' cannot be trusted for anything else than 'repo sync', and git can be a bit overwhelming. I've been practicing, so i'm getting better at git, branching, merging and fixing conflicts when they occur.
and another one up for testing
I412f9bba - benchmark fans, let's go
For me the limit is my hardware. A notebook /w ubuntu (yeah!), but also 2 years old, 512 mb ram, 160 gb hd. Don't think that will do.
Taptalked u see
Zatta said:
For me the limit is my hardware. A notebook /w ubuntu (yeah!), but also 2 years old, 512 mb ram, 160 gb hd. Don't think that will do.
Taptalked u see
Click to expand...
Click to collapse
hmm, i used to build on a p4 with 2gb ram. linux holds its ground, it will not give up on you, even if you're browsing (don't watch flvs though ) or listen to music... i hope.
still, if you find something you want to see tested, write it down, someone will test it (if it doesn't get approved before that ) and share feedback.
---------- Post added at 10:06 PM ---------- Previous post was at 09:13 PM ----------
Received call, screen didn't wake up. pressed home once, no reaction, pressed power button twice, screen woke up and i was able to awnser the call.
http://pastebin.com/4PuAd31R
I/power ( 208): *** set_screen_state 0
D/SurfaceFlinger( 208): About to give-up screen, flinger = 0xeb108
D/KeyguardViewMediator( 208): wakeWhenReadyLocked(26)
I/power ( 208): *** set_screen_state 1
I/power ( 208): *** set_screen_state 1
Click to expand...
Click to collapse
i'm curious, what's KeyguardViewMediator?
quote from cm forums, user danielck78
Try this. Press on the sensor or somewhere near it. Try to press harder for about 2 seconds. Try if the screen turn back on.
Click to expand...
Click to collapse
edit: i'm with ring lockscreen. never happened before, but i've merged a couple of commits which are related to lockscreen stuff, note that i'm not saying that they are the cause. i'll try with vanilla kernel too (merged a couple of commits from zach 2.6.35.x towards battery runtime, although i don't think they're to blame since i had them for like 3 builds, that makes at least a week and a half using it)
bk201doesntexist said:
Do you think we should get a little bit more constructive/extensive (based on the wiki, sure) on build tips? setting up the buildenv isn't hard at all (just bandwith/time consuming), but 'repo' cannot be trusted for anything else than 'repo sync', and git can be a bit overwhelming.
Click to expand...
Click to collapse
Trying to get into CM7/SGS development, there seems no way around git. But git doesn't like me.
ATM I manage to 'sync repo' and cherry-pick commits. But get lost often. As you said: git is not easy.
So, I'd like this to be a place to talk about (maybe) upcoming changes and also to get some help with development related tasks.
On the long run, this could be a starting point to attract (or grow!) more SGS programmers.
I461e90ac: looks very promising. Switched to UMTS only and lost only 5% in two hour. Will see what I lose overnight.
bk201doesntexist said:
i'm curious, what's KeyguardViewMediator?
Click to expand...
Click to collapse
* Mediates requests related to the keyguard. This includes queries about the
* state of the keyguard, power management events that effect whether the keyguard
* should be shown or reset, callbacks to the phone window manager to notify
* it of when the keyguard is showing, and events from the keyguard view itself
* stating that the keyguard was succesfully unlocked.
At wakeWhenReadyLocked(26), the keyguard was notified that it may need to do something about a keypress, 26 is the keycode of the pressed key, KEYCODE_POWER = Power Key (http://developer.android.com/reference/android/view/KeyEvent.html).
jose.celestino said:
* Mediates requests related to the keyguard. This includes queries about the
* state of the keyguard, power management events that effect whether the keyguard
* should be shown or reset, callbacks to the phone window manager to notify
* it of when the keyguard is showing, and events from the keyguard view itself
* stating that the keyguard was succesfully unlocked.
At wakeWhenReadyLocked(26), the keyguard was notified that it may need to do something about a keypress, 26 is the keycode of the pressed key, KEYCODE_POWER = Power Key (http://developer.android.com/reference/android/view/KeyEvent.html).
Click to expand...
Click to collapse
thanks for the link (xda limit ) this whole section of the website looks like a nice place to learn.
anyways, another question while we follow the trail: at line 27 of the pastebin, set_screen_state 1 comes in, and this should have waken the screen, right?
as it didn't, then i pressed HOME, and WindowManager says there's a ringing incoming call already (because call Notification already has a fullScreenIntent right, that's why we can't leave the incoming call screen), so it can't pass that button press request further. i still don't get why power
set_screen_state 0 at line 43, without me pressing it, that's the thing.
edit: just now, phone was sleeping, and screen came up fine for a phone call. no issue. lol
Jens1969 said:
Trying to get into CM7/SGS development, there seems no way around git. But git doesn't like me.
ATM I manage to 'sync repo' and cherry-pick commits. But get lost often. As you said: git is not easy.
So, I'd like this to be a place to talk about (maybe) upcoming changes and also to get some help with development related tasks.
On the long run, this could be a starting point to attract (or grow!) more SGS programmers.
I461e90ac: looks very promising. Switched to UMTS only and lost only 5% in two hour. Will see what I lose overnight.
Click to expand...
Click to collapse
i'll try to get something going on the git side, although surely i need to improve as well. i now think cherry-picking/branches is easier than fixing conflicts. i'm managing myself through, you'll see, it's actually not that hard. it definately is easier for someone who knows how to code, but that's a given, i guess.
definately, i agree with you about the objective of this thread. i would add as well help improve users so that they can help themselves, maybe we'll turn into the devs of tomorrow (pretty utopic schedule that is, but still), maybe not, but we all learn something more out of it - knowledge has no place - while helping out the community, and making some more mistakes along the way.
I461e90ac looks promising indeed. i'll give one more cycle to it.
edit: i was bored so... in Ie259e6da, if we edit:
device/samsung/aries-common/AriesParts/res/values/arrays.xml to:
Code:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string-array name="backlight_timeout_entries">
<item>Off</item>
<item>Default (1.6 seconds)</item>
<item>2 seconds</item>
<item>5 seconds</item>
<item>10 seconds</item>
<item>15 seconds</item>
<item>30 seconds</item>
<item>Never</item>
</string-array>
<string-array name="backlight_timeout_entries_values" translatable="false">
<item>0</item>
<item>1600</item>
<item>2000</item>
<item>5000</item>
<item>10000</item>
<item>15000</item>
<item>30000</item>
<item>-1</item>
</string-array>
</resources>
would it be enough to turn off the leds entirely from AriesParts, while still having led notif, of course? or do we need to go kernel level, (i noticed drivers/input/keyboard/cypress-touchkey.c, like pawitp did here)?
i think only editing the xml doesn't do the trick like it should, does it? maybe if we changed this:
Code:
static void bl_set_timeout() {
if (bl_timeout > 0) {
mod_timer(&bl_timer, jiffies + msecs_to_jiffies(bl_timeout));
}
}
to
Code:
static void bl_set_timeout() {
if (bl_timeout ≥ 0) {
mod_timer(&bl_timer, jiffies + msecs_to_jiffies(bl_timeout));
}
}
no good? or would it still need something else? or is it completely way off and would make my phone melt
this doesn't look promising.. Void, seems to me that's the same as 'we don't need this'?
Code:
static void bl_off(struct work_struct *bl_off_work);
i think i will start doing some serious e-learning on coding.. once i get more "comfortable" at work and can relax a bit.
guys,i have been on cm7.1 from the day cm7.1 stable released and now Im on nightly 165,and i keep facing a problem (so do my 4friends)-the google framework service forcing problem
First i know a data wipe or wiping all the gapps and those apps that regard to account syncing ,but it sometimes work for a period(1day or less)and sometimes dun even works
can someone give me some helps ?
I'm on nightly 165 with stock kernel
Changed dpi with nitrality to 182dpi
leejack218 said:
guys,i have been on cm7.1 from the day cm7.1 stable released and now Im on nightly 165,and i keep facing a problem (so do my 4friends)-the google framework service forcing problem
First i know a data wipe or wiping all the gapps and those apps that regard to account syncing ,but it sometimes work for a period(1day or less)and sometimes dun even works
can someone give me some helps ?
I'm on nightly 165 with stock kernel
Changed dpi with nitrality to 182dpi
Click to expand...
Click to collapse
this is definitely the wrong thread for this. Answer in the q&a thread.
Edit: link to that is in my sig.
Taptalked u see
bk201doesntexist said:
edit: i was bored so... in Ie259e6da, if we edit:
device/samsung/aries-common/AriesParts/res/values/arrays.xml to:
Code:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string-array name="backlight_timeout_entries">
<item>Off</item>
<item>Default (1.6 seconds)</item>
<item>2 seconds</item>
<item>5 seconds</item>
<item>10 seconds</item>
<item>15 seconds</item>
<item>30 seconds</item>
<item>Never</item>
</string-array>
<string-array name="backlight_timeout_entries_values" translatable="false">
<item>0</item>
<item>1600</item>
<item>2000</item>
<item>5000</item>
<item>10000</item>
<item>15000</item>
<item>30000</item>
<item>-1</item>
</string-array>
</resources>
would it be enough to turn off the leds entirely from AriesParts, while still having led notif, of course?
Click to expand...
Click to collapse
No, that's the screen timeout.
or do we need to go kernel level, (i noticed drivers/input/keyboard/cypress-touchkey.c, like pawitp did here)?
Click to expand...
Click to collapse
You need this patch to get BACKLIGHT_TIMEOUT from userspace as it is hardcoded to 1600 (ms). Then you need another patch to set the value in CMParts or, in this case, AriesParts.
Don't know if 0 would turn it off though.
this doesn't look promising.. Void, seems to me that's the same as 'we don't need this'?
Code:
static void bl_off(struct work_struct *bl_off_work);
Click to expand...
Click to collapse
void means you don't care for the function return
EDIT: "Then you need another patch to set the value in CMParts", failed to see that that was the one you posted and included the arrays.xml. Disregard everything I said before that.
Yes if you edit that array, you will control the led backlight timer. Lowest you can go is 1. (0 is always on)
To test values do : echo 1 > /sys/class/misc/notification/bl_timeout
To turn it off however, some kernel "hacking" will be required
Oh, so that array is actually for the touchkeys backlight timeout. My bad.
And that's were it is read from userspace then, nice.
Daneshm90 said:
Yes if you edit that array, you will control the led backlight timer. Lowest you can go is 1. (0 is always on)
To test values do : echo 1 > /sys/class/misc/notification/bl_timeout
To turn it off however, some kernel "hacking" will be required
Click to expand...
Click to collapse
I'm confused. If 0 is always on, what's -1?
edit: Or did you mean -1 is always on?
edit2: (follow up on the next page) actually anything below 1 (since bl_timeout needs to be greater but not equal to 0) will make touchkey bl stay on forever.

[Q] How to find whether the device has a notification LED or not?

I've been searching for an API for discovering in Java code whether the device has a notification light or not, and I've found nothing. So my simple question is: does such a thing exist? I'm working on an app that has some settings for notification light behavior, and I'd like to hide those setting options entirely on devices that don't have the hardware.
Indeed no way to do this.
But you can try the follow
When the user opens the app for the first time in on create make this
Try{
//open or use LED
Set visibility of LED options to True
}
catch {
//if not found, Set Option Visibility To False
}

WatchMaker formula and help Thread

Hi,
watchmaker (Link) is a great tool and simple faces are created quickly, but we need more.
with formulas is much more possible and I want to collect them here.
regards
starbase64
example clock > http://facerepo.com/app/faces/details/chronograph-by-starbase64-iv-14a70b5fa2b
rotate "WA" battery:
Code:
-{bl}*360/100
WA battery icon:
Code:
'{bc}' == 'Charging' and 7 or {bl} >= 90 and 1 or {bl} >= 70 and 2 or {bl} >= 50 and 3 or {bl} >= 30 and 4 or {bl} >= 10 and 5 or 6
rotate "PH" battery:
Code:
-{pbl}*360/100
PH battery icon:
Code:
'{bc}' == 'Charging' and 7 or {pbl} >= 90 and 1 or {pbl} >= 70 and 2 or {pbl} >= 50 and 3 or {pbl} >= 30 and 4 or {pbl} >= 10 and 5 or 6
rotate seconds circle:
Code:
-{drss}
rotate minutes circle
Code:
-{drm}
rotate minutes circle
Code:
-{drh}
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
example clock > http://facerepo.com/app/faces/details/summer-time-14acd7a68f6
watch battery in percent
Code:
{blp}
wacht battery in percent with opacity > if lower 15 percent (copy this code to opacity setting)
Code:
{bl} < 15 and 100 or 0
wacht battery in percent with opacity > if lower 50 percent (copy this code to opacity setting)
Code:
{bl} < 50 and 100 or 0
wacht battery in percent with opacity > if charger connectet (copy this code to opacity setting)
Code:
'{bl}' == 'Charging' and 100 or 0
works also with phone battery {pbl} and {pbc}
you need 4 battery in percent letters with various opacity formula.
example clock > http://facerepo.com/app/faces/details/mechanic-v-14ad47f4ec5
this formula show or hide a pic in a defined time:
Code:
{dh23}<=18 and {dh23}>= 6 and [COLOR="Red"][B]50[/B][/COLOR] 0 or
example: a black square with this formula in opacity setting, will dim your clock at night.
The red number is the opacity setting, higher = stronger
example clock > http://facerepo.com/app/faces/details/night-and-day-ii-14adcd8cb74
change background automatically with sunrise and sunset...
copy formula to opacity from the second image (opacity for the first image =100):
Code:
{wsrp}>={dtp} and 100 or {wssp}<{dtp} and 100 or 0
thanks to Klaus Koehler (G+) for helping to find the right formula
Help creating formula in watchmaker:
1) formula for showing wind chill . Formula for metric wind chill calculation:
Twind_chill = 13.12 + 0.6215*T - 11.37*(v0.16) + 0.3965*T*(v0.16)
T=temp, V= windspeed.
2) Formula, showing arrow up when rising temp (or barometric pressure), arrow down, falling temp/barometric pressure. No ide how to create this....if possible...
example watch > http://facerepo.com/app/faces/details/night-and-day-iii-14ae9343b9c
blinking text for temperature lower than 4C°
Code:
{ds}%2 == 0 and 100 and {wt}< 4 and 100 or 0
Copy code to opacity setting!
@espenjoh
no idea at the moment
To show a Different Day of the Week
This code will show tomorrow's day of the week in 3 letter day of the week form.
{ddw0}==0 and 'Mon' or {ddw0}==1 and 'Tue' or {ddw0}==2 and 'Wed' or {ddw0}==3 and 'Thu' or {ddw0}==4 and 'Fri' or {ddw0}==5 and 'Sat' or 'Sun'
Copy code into text field.
This piece of code is very useful at rotating a sun/moon cycle indicator. But this does not simply imply the sun rises at a quarter of the day and sets at 3 quarters, in stead the sun rises and sets just like in real life.
Code:
{dtp} < {wsrp} and (-180 + ({dtp}/{wsrp})*90) or {dtp} <= {wssp} and (-90 + (({dtp} - {wsrp})/({wssp} - {wsrp}))*180) or {dtp} <= 1 and (90 + (({dtp} - {wssp})/(1 - {wssp})*90))
This can be used at indicators where at 0° the sun is at his highest point.
Some self-made examples are:
http://facerepo.com/app/faces/details/epic-sun-moon-cycle-clock-14b06fdac8c
http://facerepo.com/app/faces/details/steampunk-2-14ad939e2b3
http://facerepo.com/app/faces/details/steampunk-14aaa686824
---------- Post added at 12:09 PM ---------- Previous post was at 11:48 AM ----------
This rotates objects according to gravity, but it doesn't work a hundred per cent and needs improvement. Anyone any ideas?
Code:
{say} > 0 and ({sax}+10)/20*360/2+270 or {say} <= 0 and 360-({sax}+10)/20*360/2+270
Example: http://facerepo.com/app/faces/details/andy-with-moving-arms-14ae3ad326a
Probably not correct place to post but haven't had any luck elsewhere. I would like to use the Style Clock 1 on my gear s but use my own background. cant find location of that clock to do so. Can someone please point me in right direction
@lusciousbeard
open watchmaker tap on the clock an choose "Customize Copy"...
starbase64 said:
@lusciousbeard
open watchmaker tap on the clock an choose "Customize Copy"...
Click to expand...
Click to collapse
I want to use the stock clock that comes with gear manager. Its called Style clock 1. I just want my own background with that clock.
Don't know if this is a a forumla but trying to change the watch face based on a variable.
In tasker have WM Change Watch plugin selected, select which watch face and If %Batt <65%
The attempt is that when the battery is 65% or less the watch face changes
I'd like to add a second location and the current forecast for that location.
formula for celsius and fahrenheit in same clock.
F = ({wt}/5)*9+32
C = (({wt}-32)/9)*5
Is it possible to display active tasker profiles etc. ?
Can someone help, I want to make a few different sub dials. How can I change the rotational value for the watch and phone battery to be 160 or so degrees instead of following a full 360. I want to split the dial with two hands, have each devices battery on the dial, once for each side. The left side having and Full down to Empty running from the 11 Oclock spot down to 7, then mirroring the other side for the other battery
The second dial I wanted a 360 - 7 point where the hand changed each day (for day of week dial)
I am not the best at writing code and was having trouble figuring out how to write this
I realize your post is 4 months old, but . . .
mikeschevelle said:
Can someone help, I want to make a few different sub dials. How can I change the rotational value for the watch and phone battery to be 160 or so degrees instead of following a full 360. I want to split the dial with two hands, have each devices battery on the dial, once for each side. The left side having and Full down to Empty running from the 11 Oclock spot down to 7, then mirroring the other side for the other battery
Click to expand...
Click to collapse
It's a math problem. x/160 = y/360.
y is the rotational value based on a full circle ({drs}, {drm}, or {drh} in watchmaker)
x is the rotational value based on your 160 degree arc. If you solve for x, you get x=.444y
so you can enter the following in a rotation field to get any object to show seconds over your 160 degree arc:
Code:
.444 * {drs}
The second dial I wanted a 360 - 7 point where the hand changed each day (for day of week dial)
Click to expand...
Click to collapse
360/7 = 51.429, so each day would be 51.429 degrees. Set your rotation value to:
Code:
{ddw0} * 51.429
In the Watchmaker Reddit, I posted about saving battery life https://www.reddit.com/r/WatchMaker/comments/3liwww/tips_to_improve_battery_life/
I noticed that I was losing 5-6% battery life per hour with a watchface I made. When I switched to a very simple face with no bells and whistles, I lost closer to 3% per hour. I did some experimenting to figure out how to reduce battery usage with my more complicated face. Here's what I learned:
- Watchmaker still executes positioning code for elements that are not visible. For example, if you enter "{ds}+2" as the rotation for an element that is only visible in bright mode, watchmaker will still do the math once a second while it's in dim mode.
- How frequently an object updates is determined by what watchmaker tag is in the object properties. If no tag is in the properties, it will not update. So if you set the rotation of a hand to "{ds}+2" watchmaker will do the math every second and the hand will move every second. Now lets say you create a function called var_ds() that returns the {ds}+2. Setting the rotation of the hand to "var_ds()" will cause the hand not to rotate. There is no watchmaker tag in the rotation field, so the function is never called and the rotation value never updates. Setting rotation to "var_ds({ds})" will cause the function to be called and the hand to rotate every second. Setting rotation to "var_ds({dm})" will cause the function to be called and the hand to move once a minute - even if the function is still returning values based on {ds}.
Using this info, I was able to come up with some possible optimizations to improve battery life:
1) If you're using lots of math or code to place an object, add "if is_bright" to your code so that it won't be executed while the screen is dim. If you do this, you should initialize the variable is_bright to 1 to prevent weirdness.
2) To control the frequency of updates, stick your code in a function and call it with a tag that represents the frequency you want. For example, I wanted my minute hand to stop on minute marks rather than move smoothly. I wrote a function:
Code:
function var_rotation (r)
return 6*math.floor({drm}/6)
end
The "r" variable is never used in the function, but it lets me control how often the function is called. Previously when I used "6*math.floor({drm}/6)" directly as a rotation value, the expression was evaluated whenever {drm} updated - I'm guessing at least once a second - even though the hand was only actually moving once a minute. Now, my rotation value is var_rotation({dm}). The {dm} causes my function to be called only once a minute which makes a lot more sense for a hand that's only moving once a minute
3) If I had multiple objects using var_rotation() to rotate, I might add a conditional statement to make sure the bulk of the code only runs once a minute:
function var_rotation (r)
Code:
if not (var_lastran == {dm}) then
var_result = 6*math.floor({drm}/6)
end
return var_result
end
If there is a recent result, this simply returns that result instead if recalculating it. If the result is older than a minute, it calculates a new result.
For the particular watchface I was working on, only optimization #2 applied, but based on my initial testing, I'm down to around 3% battery/hour. Hopefully this info helps someone else
Click to expand...
Click to collapse

Categories

Resources