View Single Post
m2cm2c's Avatar
Posts: 100 | Thanked: 240 times | Joined on Feb 2010 @ The South Pole O.o
Hello there,
I've put together a python script using v4l2-ctl that will enable you to change focus and turn on/off the led while filming a video.
the script works while filming video!
this is a video I took while demonstrating the script.

Now with a menu widget!
now you can control the focus and LEDs from the touchscreen ,
or use the keyboard toggle button.

heres how you use the widget:
open the camera cover
Now you can access the lfocus dialog by using the proximity sensor!


tap the screen once
tap on the indicator bar
tap the lfocus logo
you can either scroll left and right to set focus or just press on the right side or the left side to get a smoother focus effect.
you can also adjust the leds by tapping the go down button next to the focus bar.

you can add a timer to take photos/videos by clicking the clock icon.

by tapping the go down button one more time you will access the new toggle buttons which will have the following functions:

(remember led state when capturing)
[Stop RLED]
(auto turn off red led when capturing)
(timer red led blinking)

for the keyboard toggle button:
a green indicator means the keyboard control is off
a red indicator means the keyboard control is on and you should turn it off once you're done.
turning on the keyboard enables focus via zoom buttons automatically and turns off the autofocus ability!
turning on the keyboard now also turns off the red LED when you start recording video.
now you can start a timer to take photos/videos using the disabled autofocus button
to enable the timer gently double click the hardware camera button and choose the period for the timer.

as for the keyboard shortcuts:

q-w led on/off
e-r recording red light on/off
a-s change focus
d fixes the sudden focus that happens sometimes after pressing the camera button,so press d first then adjust the focus with a and s so you don't get a different focus than the one you got with the camera button.

installation and starting:

now you just need to install the latest package and you're ready to go.

Source can be found here

lfocus is now up in Extras

also this will be my todo list for the upcoming versions:

  • an autofocus option
  • The built in timer should use the red flash to alert the user it's going to take the photo.
  • checkbutton with a default of off or something in the same step that you choose the timer.
  • the buttons "on" and "off" for each flash could be unified in only two "switch" buttons, "red flash status" and "main flash status"
  • the LED stays on when you actually begin recording a video
  • add python-hildon to the dependencies
  • use the proximity sensor, to pop the menu only while camera is active.
  • Might be nice to have a popup on install explaining stuff. added a help file
  • consider optification in the next release.
  • Add a checkbox to the left of the manual focus progress bar which will control the functionality of intercepting the half press.
  • Move the keyboard toggle button to the lfocus dialog.
  • Add a delay to the proximity sensor
  • Add a confirmation box to the rem.led and stop rled buttons
  • ignore proximity sensor when Camera is not on the foreground
  • ignore keyboard when Camera is not on the foreground
  • create a lfocus settings file in /home/user/.config
  • add a popup dialog only when lfocus is started showing the saved setting of the user.

I've applied a fix that should make the application work successfully from the shortcut without any password problem
download the latest file and please test it and keep me informed
we're now able to toggle the red recording light
I've applied another fix for the sudden focus that happens after pressing the camera button, read the instructions at the top of the post for more info.
I've added the ability to focus with the zoom buttons, read the instructions at the top of the post for more info
I've added a widget that will make you control the led and the focus from the touchscreen
I've merged the keyboard script and got rid of the application menu shortcut.
read the information at the beginning of the post for more information.
The widget now only shows up when you open the camera cover!
the keyboard toggle now disables autofocus.
Added dependencies to the deb package to install required packages (python-hildondesktop hildon-desktop-python-loader python-gtk2 python-dbus)
Toggling the keyboard control now automatically switches off the red LED once you start recording
Added a timer to take photos/videos using the disabled autofocus button
read the information at the beginning of the post for more information.
Added the timer to the widget to make it easy to take pictures/videos without using hardware buttons.
added python-hildon to the dependencies.
changed the widget LEDs to toggle buttons and did a small modification with the menu for future realeases.
fixed the problem with keyboard led shortcuts not syncing with the buttons
the lfocus dialog can now be turned on by using the proximity sensor instead of tapping the screen and clicking on the logo
added a new row of toggle buttons for (remember led state when capturing)(auto turn off red led when capturing)(timer red led blinking)
please read the instructions at the top of the post for more info.
lfocus is now optified.
fixed led remember state button and made it always off, so it needs to be turned on by the user only when taking a video
fixed stop RLED toggle button and made it always off, so it needs to be turned on by the user only when taking a video
fixed typo in description
added a help button to display help for lfocus
moved the keyboard toggle button to the lfocus dialog
proximity now requires holding on for two seconds to activate the lfocus dialog
fixed an issue with proximity
proximity will only work if the camera is running (not on standby)
Now available in Extras-testing

Last edited by m2cm2c; 2010-09-17 at 10:23. Reason: New Version

The Following 152 Users Say Thank You to m2cm2c For This Useful Post:
222, Abemelek, acou, AgentZ, akaSM, Alan_Peery, Alex Atkin UK, anapospastos, AndiThebest, andraeseus1, Apoc, arjunkumar87, avinashsonee, badboyuk, berlinermaxe, bingomion, BlackDiamond, borghal, Brank, brog, cddiede, ceevee, CepiPerez, cheve, ChoMar, Chrome, cjp, clasificado, Cobra, codeMonkey, cpscotti, Crogge, Crugath, Custard! SandS, CutterSlade, cyeung, Dariu5, Darkwolf, dashti, datjomp, Deaconclgi, deter3, Dima202, dmj726, donalfitz, Dousan, eiffel, elie-7, esiravegna, ffalt, frals, ghzroy, grog, Helmuth, hesham, Hoshiro, iKneaDough, Inacurate, ioan, jdr93, John McClane, jsbigs, Kee, kevloral, lcuk, legendsohai, lennartb, locusf, lolloo, LouisLoh, maartenmk,, mannakiosk, Marshall Banana, matristain, Metalov, michael196, mikec, mikki-kun, mmlado, mosiomm, mpi, mzanetti, n0ak, nashith, Natan_xy, neboja, neven, nkirk, NOMIOMI, nux, OranAgra, oz87, pettergoldstine, phedders, phortize, Pigro, plaban, Pretoriano, pyromaniac, qalhat, qole, qwerty12, RafaLL92, rahulg247, raily, Rammi, rcull, rebhana, rpgAmazon, sabodjaz, sachin007, santiago, Sash, saveas, SHARP66, shazosbourne, skalogre, slender, Smily, snookh, sophocha, SSLMM, stas123, steve4130, strange1712, t7g, tetris11_, thorbo, TigerTael, titan, tonypercy, torpedo48, torshind, Tstone, uhbhatti88, v13, vaibhavsharma, vdx29, vitamina, vkv.raju, vmayur_23, Wikiwide, xgrind, xiskillo, xopher, yamakasi, yinyang69_vn, yodawg, yogi900, zwer, _invisible_