[APP] TorchButton v2.3, using camera LED as flashlight [UPDATED Dec 8]

Search This thread

NetRipper

Senior Member
Feb 27, 2006
563
42
's-Gravendeel
www.netripper.nl
Continuing my quest of using the LED as flashlight for my new HD2, I updated TorchButton to support the HD2 as well.

Dropped your keys? Finding something behind the bench? Performing surgery on a computer and need to find that jumper on the mainboard?

This is a simple application built for some HTC devices that have a hardware LED, normally used to take pictures in the dark. However I found the LED to be perfect to be used as a handy pocket flashlight.

Usage
There is no GUI for this application. Just start TorchButton to enable the LED on the back of your device. Start TorchButton again to turn it off.

Check out the readme if you're an advanced user and wish to change some registry settings, i.e. to allow a longer maximum time the LED is enabled.

Known issues
- [Fixed] New icons are not working when TorchButton is installed to Storage Card

Todo
- Create an app to configure the registry settings
- See if support for Omnia Pro (B7610) is feasible (someone should send me the related dlls...)
- [Done] Add a seperate timeout for bright mode
- [Done] Add blink mode with bright led
- [Done] Use new icons provided by tnyynt
- [Done] Add support for Omnia (the one found here)
- [Impossible] See if it's possible to control leds seperately ('economic mode') Sorry, this is not possible. (Tech-talk: setting a single GPIO enables both LEDs. There doesn't seem to be a GPIO for each LED seperately.)

Wishful thinking
- Camera app to interpret the morse

History
Version 2.3
- Fix icons not showing in HTC Sense or WM 6.5 start menu when installed to Storage Card.

Version 2.2
- New icons for all TorchButton apps (thanks tnyynt!). These only work in WM6.5 and up. Older OS's will still see the old icons.
- Added registry setting to use bright setting in blink mode (see BlinkUsesBrightMode).
- Bright mode now has a seperate timeout, configurable in registry (see BrightModeTimeout).
- Added support for Samsung Omnia i9x0 devices (hopefully they all work). Thanks to raph/zemrwhite2/PaSSoA. Thanks to Chainfire for testing on his Omnia i900L.
- [edit] Shortcut names have changed. I found them nicer this way, no two-line icons. And the text is now also not cut-off when added as shortcut in the home screen.
- [edit] Improved handling of bright mode. It should stop immediately now when pressed again, instead of waiting for a 500ms interval. This makes BlinkUsesBrightMode possible combined with low intervals for blink mode.
- [edit] Soft-reset your phone after upgrading from an older version! Else the new icons will not show.

Version 2.1
- Bright mode is now support on the HTC HD2 (Leo).
- Added a one-time warning message when bright mode is used for the first time.

Version 2.0
- Initial version with support for the HTC HD2 (Leo) (bright mode is not supported on the Leo)

Version 1.x
- Support for the Touch Pro
 

Attachments

  • screen_v22-1.jpg
    screen_v22-1.jpg
    16.8 KB · Views: 20,357
  • screen_v22-2.jpg
    screen_v22-2.jpg
    11.1 KB · Views: 23,531
  • TorchButton_v2.3.cab
    233 KB · Views: 62,117
  • TorchButton_v2.3_readme.txt
    8.1 KB · Views: 18,983
Last edited:
  • Like
Reactions: Al_Yasam

henv

Senior Member
Jan 7, 2008
853
77
Dont think about something. Untill i read your post. This could be handy sometimes. Thnx
 

12aon

Retired Senior Moderator
Mar 24, 2008
2,437
476
Awesome man I was just thinking how I missed that :)

Btw what's missing for bright mode to work? If I'm not mistaken there is a brighter mode just before taking a pic.
 
Last edited:

DocteurN

Senior Member
Jan 6, 2005
966
274
Great ! thanks ;)
Have it on my Omnia and was hoping to have it for my future HD2 !
 
Last edited:

NetRipper

Senior Member
Feb 27, 2006
563
42
's-Gravendeel
www.netripper.nl
You're all welcome! Glad to hear you like it. :D

Awesome man I was just thinking how I missed that :)

Btw what's missing for bright mode to work? If I'm not mistaken there is a brighter mode just before taking a pic.

The mode is there, but it's not as easily called as it was on the Touch Pro. In fact I haven't found the API call at all yet. May need some hacking around the API to get that to work. The normal mode produces _quite_ the amount of light though, it's even more light than the bright mode of the Touch Pro thanks to the dual led. :D

Thanks! I was dissapointed that hTorch didn't work on the HD2 now I got this. Wonderful!

hTorch will work again once I update the C# wrapper to support the Leo, as hTorch makes use of my C# library. I'll do that somewhere in the upcoming week.
 

kinnyfaifai

Senior Member
Mar 17, 2009
533
29
Can anyone confirm this don't burn anything out? On the X1 the light modules weren't heatsinked properly and caused vibrator motor to screw up after 15secs use as a torch.

Thanks!
 

NetRipper

Senior Member
Feb 27, 2006
563
42
's-Gravendeel
www.netripper.nl
Can anyone confirm this don't burn anything out? On the X1 the light modules weren't heatsinked properly and caused vibrator motor to screw up after 15secs use as a torch.

Thanks!
I can't confirm it won't ever burn out. However, realise that enabling the LED is actually the same as using your camera with the lights on in the dark. This _shoud_ be possible for prolonged times as well.

Were you using the 'bright' setting on the X1? (If that's possible there.) That might explain it better... otherwise you could just send in the device for repair, as it's normal use of the device. Especially if it's after only 15 seconds.
 

kinnyfaifai

Senior Member
Mar 17, 2009
533
29
I can't confirm it won't ever burn out. However, realise that enabling the LED is actually the same as using your camera with the lights on in the dark. This _shoud_ be possible for prolonged times as well.

Were you using the 'bright' setting on the X1? (If that's possible there.) That might explain it better... otherwise you could just send in the device for repair, as it's normal use of the device. Especially if it's after only 15 seconds.

It was a known problem that the LEDs weren't heatsinked properly on the X1 and there was a huge warning on using hTorch. I've not installed hTorch and never used the LEDs on my X1 as a torch cos of this oversight by the manufacturer. I do miss being able to use the LEDs as a torch though, it's very handy.
 

ET

Senior Member
Aug 20, 2006
389
1
Continuing my quest of using the LED as flashlight for my new HD2, I updated TorchButton to support the HD2 as well.

Dropped your keys? Finding something behind the bench? Performing surgery on a computer and need to find that jumper on the mainboard?

This is a simple application built for some HTC devices that have a hardware LED, normally used to take pictures in the dark. However I found the LED to be perfect to be used as a handy pocket flashlight.

Usage
There is no GUI for this application. Just start TorchButton to enable the LED on the back of your device. Start TorchButton again to turn it off.

Check out the readme if you're an advanced user and wish to change some registry settings, i.e. to allow a longer maximum time the LED is enabled.

History
Version 2.0
- Initial version with support for the HTC HD2 (Leo) (bright mode is not supported on the Leo)

Version 1.x
- Support for the Touch Pro

nice app, but bright mode doesn`t work for me.. :(


Isn't it clearly stated that brightmode doesn't work.......jeez....dude...read
 

mrjack711

Member
Nov 21, 2008
10
0
Weston-super-Mare
OnePlus 5T
It was a known problem that the LEDs weren't heatsinked properly on the X1 and there was a huge warning on using hTorch. I've not installed hTorch and never used the LEDs on my X1 as a torch cos of this oversight by the manufacturer. I do miss being able to use the LEDs as a torch though, it's very handy.

The vibrate function does not work at all on my X1 after installing and using hTorch. User beware..!

This is my next phone when O2 decide to put it on their shelves, and hopefully its built better than the X1.
 

l3v5y

Retired Senior Moderator
Sep 13, 2007
7,485
44
30
Bristol
Any chance of some source code?

I've been looking through the HD2 camera drivers, and have found a few things that should be the LED (can't test it as I have no device), but am wondering if it's the same method as yours!
 

NetRipper

Senior Member
Feb 27, 2006
563
42
's-Gravendeel
www.netripper.nl
Any chance of some source code?

I've been looking through the HD2 camera drivers, and have found a few things that should be the LED (can't test it as I have no device), but am wondering if it's the same method as yours!
Here are the important code snippets of the API that I'm using. The methods were pretty obvious (luckily).

typedef int (__stdcall *LEO_INIT)();
typedef int (__stdcall *LEO_SETCURRENT)(DWORD dw1);
...
LEO_INIT InitFlashLight;
LEO_SETCURRENT PMICFlashLED_SetCurrent;
...
hCamera=LoadLibrary(L"CameraPlatform.dll");
...
InitFlashLight = (LEO_INIT) GetProcAddress(hCamera, L"InitFlashLight");
PMICFlashLED_SetCurrent = (LEO_SETCURRENT) GetProcAddress(hCamera, L"PMICFlashLED_SetCurrent");
...
InitFlashLight(); // must be called before SetCurrent has any effect
...
PMICFlashLED_SetCurrent(0); // turns it off
PMICFlashLED_SetCurrent(1); // turns it on

There's also a PMICFlashLED_SetMode(x); but I haven't been able to figure out what it does. As far as I could see when disassembling it wants one parameter.

If you have any ideas on the bright mode, they'd be more than welcome. If you want the full source to make some modifications or to toy with it, let me know.
 

l3v5y

Retired Senior Moderator
Sep 13, 2007
7,485
44
30
Bristol
Here are the important code snippets of the API that I'm using. The methods were pretty obvious (luckily).

typedef int (__stdcall *LEO_INIT)();
typedef int (__stdcall *LEO_SETCURRENT)(DWORD dw1);
...
LEO_INIT InitFlashLight;
LEO_SETCURRENT PMICFlashLED_SetCurrent;
...
hCamera=LoadLibrary(L"CameraPlatform.dll");
...
InitFlashLight = (LEO_INIT) GetProcAddress(hCamera, L"InitFlashLight");
PMICFlashLED_SetCurrent = (LEO_SETCURRENT) GetProcAddress(hCamera, L"PMICFlashLED_SetCurrent");
...
InitFlashLight(); // must be called before SetCurrent has any effect
...
PMICFlashLED_SetCurrent(0); // turns it off
PMICFlashLED_SetCurrent(1); // turns it on

There's also a PMICFlashLED_SetMode(x); but I haven't been able to figure out what it does. As far as I could see when disassembling it wants one parameter.

If you have any ideas on the bright mode, they'd be more than welcome. If you want the full source to make some modifications or to toy with it, let me know.

That's what I'd come to as a conclusion, so glad that works!

Is there any need to un-init the flash light?

PMICFlashLED_SetMode will probably need some playing around, though might enable your "bright" mode. Will have a play with that when I get an HD2! :)
 

NetRipper

Senior Member
Feb 27, 2006
563
42
's-Gravendeel
www.netripper.nl
That's what I'd come to as a conclusion, so glad that works!

Is there any need to un-init the flash light?

PMICFlashLED_SetMode will probably need some playing around, though might enable your "bright" mode. Will have a play with that when I get an HD2! :)
There doesn't seem to be an un-init function. However, the debug console shows that it detects when the DLL is being attached to or detached from, so there's probably some cleanup code there.

I also haven't found any side-effects yet. TorchButton works fine even when the camera app is running. They don't interfere with eachother (other than toggling the LED to their own behalf). On the Touch Pro it wasn't possible to run TorchButton and the camera app at the same time. Not that I ever wanted to, but still. :)

In regard to that mode function. It must be for something. I tried using it in various ways already but it didn't matter. Maybe you'll have more luck ;)
 

br3nt

Senior Member
Jul 23, 2008
269
1
might be confused right now, but seems that when in camera mode, and battery is below 50% you cant use the flash - anybody know if this will affect the app?

haven't got my hd2 yet so cant help you out, but there's a thread under the Leo -- > Leo sub-forum

cheerios! :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Continuing my quest of using the LED as flashlight for my new HD2, I updated TorchButton to support the HD2 as well.

    Dropped your keys? Finding something behind the bench? Performing surgery on a computer and need to find that jumper on the mainboard?

    This is a simple application built for some HTC devices that have a hardware LED, normally used to take pictures in the dark. However I found the LED to be perfect to be used as a handy pocket flashlight.

    Usage
    There is no GUI for this application. Just start TorchButton to enable the LED on the back of your device. Start TorchButton again to turn it off.

    Check out the readme if you're an advanced user and wish to change some registry settings, i.e. to allow a longer maximum time the LED is enabled.

    Known issues
    - [Fixed] New icons are not working when TorchButton is installed to Storage Card

    Todo
    - Create an app to configure the registry settings
    - See if support for Omnia Pro (B7610) is feasible (someone should send me the related dlls...)
    - [Done] Add a seperate timeout for bright mode
    - [Done] Add blink mode with bright led
    - [Done] Use new icons provided by tnyynt
    - [Done] Add support for Omnia (the one found here)
    - [Impossible] See if it's possible to control leds seperately ('economic mode') Sorry, this is not possible. (Tech-talk: setting a single GPIO enables both LEDs. There doesn't seem to be a GPIO for each LED seperately.)

    Wishful thinking
    - Camera app to interpret the morse

    History
    Version 2.3
    - Fix icons not showing in HTC Sense or WM 6.5 start menu when installed to Storage Card.

    Version 2.2
    - New icons for all TorchButton apps (thanks tnyynt!). These only work in WM6.5 and up. Older OS's will still see the old icons.
    - Added registry setting to use bright setting in blink mode (see BlinkUsesBrightMode).
    - Bright mode now has a seperate timeout, configurable in registry (see BrightModeTimeout).
    - Added support for Samsung Omnia i9x0 devices (hopefully they all work). Thanks to raph/zemrwhite2/PaSSoA. Thanks to Chainfire for testing on his Omnia i900L.
    - [edit] Shortcut names have changed. I found them nicer this way, no two-line icons. And the text is now also not cut-off when added as shortcut in the home screen.
    - [edit] Improved handling of bright mode. It should stop immediately now when pressed again, instead of waiting for a 500ms interval. This makes BlinkUsesBrightMode possible combined with low intervals for blink mode.
    - [edit] Soft-reset your phone after upgrading from an older version! Else the new icons will not show.

    Version 2.1
    - Bright mode is now support on the HTC HD2 (Leo).
    - Added a one-time warning message when bright mode is used for the first time.

    Version 2.0
    - Initial version with support for the HTC HD2 (Leo) (bright mode is not supported on the Leo)

    Version 1.x
    - Support for the Touch Pro
    1
    tnx :) great app
    1
    Is there a step-by-step guide on installing this app for noobs?

    I've downloaded the app to my PC, but I have absolutely no idea where to go from here... :confused:
    Place the .cab file on your windows mobile device, start the 'explorer' or whatever to view files on the device and tap/double tap the .cab file. Installation will start. The cab files are like the setup.exe files for windows.
    1
    Source code is here: https://github.com/netripper/TorchButton

    It's in C++ but if you're familiar with marshalling in C# you should be able to make a .net version.