Reply
Thread Tools
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#1
Hi folks,

I've been playing around with the N900 camera a bit, and wanted to manually control its focus. I have the Video4Linux interface to do it (using the V4L2_CID_FOCUS_ABSOLUTE control), which takes an integer value; but I'm not certain what values are valid. I took a look at the "lfocus" app's source code, and that seems to indicate that valid values are in the range 0 - 1023; however, I can't seem to find confirmation of that anywhere else.

So, questions: is this the best way to manually set the camera's focus? Are these the correct values? And (most importantly), am I likely to damage something if I set a value outside of the supported range?

Thanks!
 

The Following 8 Users Say Thank You to Copernicus For This Useful Post:
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#2
Just to respond to myself here: I've gone ahead and tested a bit, and the 0-1023 range for the V4L2 control appears to be valid for the N900's main camera. (I haven't tested with the front camera...)

I should note that, when you provide a focus value that is far away from the current value (say, 200 or more points distant), the camera makes an audible "click" noise as it changes the focus. I don't know if this is standard, but it kind of makes me nervous! For now, I'm first querying the current focus value (via VIDIOC_G_CTRL), and then incrementing (or decrementing) it stepwise by small amounts.

I haven't found any yet, but are there any reports out there of damaging the N900 camera by trying to change focus too quickly?

EDIT: Aha, yeah, this is definitely a problem: Bug 9085. Long story short, Maemo's camera focus driver moves the focus too quickly, and therefore can damage the camera. So, best to never assign values to V4L2_CID_FOCUS_ABSOLUTE that vary significantly from the current value.

Also, I should note that after closing my app, I can hear the camera make that clicking noise; so, it seems that you'll also need to reset the focus back to its original state (carefully!) before letting go control of the camera, if you're playing with manual focus.

EDIT 2: I decided to play with the camera app on my stock, non-development N900 to see how it worked. And yeah, I can still hear that "click" noise when it moves the focus level around. So, maybe there is no way to avoid this problem? (Does the CSSU have a fix for this bug? I never know how to figure out exactly what fixes are in the CSSU... )

Last edited by Copernicus; 2015-01-09 at 00:50.
 

The Following 7 Users Say Thank You to Copernicus For This Useful Post:
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#3
One more update: by storing the initial focus state, moving the focus incrementally by small amounts (10 units in my current app), and slowly returning the focus to the initial state in the app's destructor (in my case, stepwise by 10 units every 50 milliseconds), I have been able to eliminate the clicking noise.

I don't know how important it may be to control the focus in this way (as obviously any N900s that might have been damaged by this would probably already have been by now), but I think it might be a good idea for other app writers to be wary of the N900's focussing mechanism...
 

The Following 7 Users Say Thank You to Copernicus For This Useful Post:
Estel's Avatar
Posts: 5,028 | Thanked: 8,613 times | Joined on Mar 2011
#4
Originally Posted by Copernicus View Post
I should note that, when you provide a focus value that is far away from the current value (say, 200 or more points distant), the camera makes an audible "click" noise as it changes the focus. I don't know if this is standard, but it kind of makes me nervous! For now, I'm first querying the current focus value (via VIDIOC_G_CTRL), and then incrementing (or decrementing) it stepwise by small amounts.

I haven't found any yet, but are there any reports out there of damaging the N900 camera by trying to change focus too quickly?

EDIT: Aha, yeah, this is definitely a problem: Bug 9085. Long story short, Maemo's camera focus driver moves the focus too quickly, and therefore can damage the camera. So, best to never assign values to V4L2_CID_FOCUS_ABSOLUTE that vary significantly from the current value.

Also, I should note that after closing my app, I can hear the camera make that clicking noise; so, it seems that you'll also need to reset the focus back to its original state (carefully!) before letting go control of the camera, if you're playing with manual focus.
Tell your findings to CSSU and their camera-ui rewrite, pretty please. It's manual control does the "clicking" all the time, and I've had camera focus damaged in few of my devices. I suspected that camera-ui2 may be responsible for it, but haven't had any proofs (and wasn't aware of the bug you sourced), so - given the amount of "tensions" in the Community - didn't wanted it to be marked as FUD.

Thanks for your research,
/Estel
__________________
N900's aluminum backcover / body replacement
-
N900's HDMI-Out
-
Camera cover MOD
-
Measure battery's real capacity on-device
-
TrueCrypt 7.1 | ereswap | bnf
-
Hardware's mods research is costly. To support my work, please consider donating. Thank You!
 

The Following 5 Users Say Thank You to Estel For This Useful Post:
Reply

Tags
camera, nokia n900

Thread Tools

 
Forum Jump


All times are GMT. The time now is 00:12.