Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Bug Cellphones Programming

Bizarre Droid Auto-Focus Bug Revealed 275

itwbennett writes "Pity the poor engineer who had to find this one. One of the more interesting of the handful of bugs that have appeared since the launch of Verizon's Droid smartphone has to do with the on-board camera's auto-focus. Apparently it just didn't work. And then suddenly it did. Naturally, this off-again, on-again made the theories fly. But the real reason for the bug was revealed in a comment on an Engadget post by someone claiming to be Google engineer Dan Morrill: 'There's a rounding-error bug in the camera driver's autofocus routine (which uses a timestamp) that causes autofocus to behave poorly on a 24.5-day cycle,' said Morrill. 'That is, it'll work for 24.5 days, then have poor performance for 24.5 days, then work again. The 17th is the start of a new 'works correctly' cycle, so the devices will be fine for a while. A permanent fix is in the works.'"
This discussion has been archived. No new comments can be posted.

Bizarre Droid Auto-Focus Bug Revealed

Comments Filter:
  • by eldavojohn ( 898314 ) * <`eldavojohn' `at' `gmail.com'> on Wednesday November 18, 2009 @03:59PM (#30147842) Journal
    It's all over the comments on the engadget page but since 2^31 milliseconds is about 24.5 days, it's highly probably we're dealing with a very classic not so funny sign extension bug here [wikipedia.org]. So if I may presume the real problem, it's that autofocusing depends on catching timestamps from the system to know how long it's been since the last sampling in order to adjust the lens and check for accuracy. It's casting this to a signed 32 bit variable which means that during the 24.5 days it is miscast to a negative number, thus breaking the algorithm when it measures time deltas and causing it to mis focus before snapping the picture.

    The patch is simple, make that signed int something like an unsigned long or truncate it properly. Hopefully we're not waiting long.
  • by BitZtream ( 692029 ) on Wednesday November 18, 2009 @04:47PM (#30148396)

    Most cameras do, they just don't use a RTC value to do so.

    You don't want it continually focusing, you want it to focus then wait a bit otherwise it'll bounce all over the place. You check the distance, wait a moment, and check again, is it close to the same? If so use that as your focal length, other wise you'll probably end up never in focus cause you'll be using all the various raw values given to you by the sensor. This is likely input averaging to get a smooth value and throw out bad samples.

    Take a look at the raw input values provided by most game controllers, try to hold an analog stick in one spot and not get jitter in the raw values, unless the device itself is averaging you won't got a solid result. Plug a xbox controller into your PC and use the Windows control panel (if you're using windows, never plugged a joystick into a unix box myself) to see how jumpy it is.

    A sensor measuring the environment outside, in someones hand is going to bounce around like a mad man, so it has to be smoothed out somehow.

  • by Zero__Kelvin ( 151819 ) on Wednesday November 18, 2009 @04:53PM (#30148468) Homepage
    Oh, yeah! Well we've been waiting an unsigned long long [gnu.org] time!
  • by Mr.Mustard ( 58247 ) on Wednesday November 18, 2009 @04:54PM (#30148482) Homepage

    It was actually 49.7 days [microsoft.com].

  • by Anonymous Coward on Wednesday November 18, 2009 @04:59PM (#30148562)

    The support for the camera in the Droid was developed by Motorolla, not Google.

  • by noidentity ( 188756 ) on Wednesday November 18, 2009 @05:00PM (#30148578)

    it's highly probably we're dealing with a very classic not so funny sign extension bug here [...] It's casting this to a signed 32 bit variable which means that during the 24.5 days it is miscast to a negative number

    This involves truncation, not sign-extension, actually. Sign-extension occurs when widening a value, not narrowing it. A value outside the range representable by a two's complement 32-bit integer is being cast to one, and apparently this platform simply truncates to 32 bits and treats the highest bit as having the value -2^31, rather than 2^31 as it had in the input value. This isn't the only way to handle such a situation; common alternatives are raising an exception or saturating (i.e. anything >= 2^31 converts to 2^31-1, and anything less than -2^31 converts to -2^31).

  • by gehrehmee ( 16338 ) on Wednesday November 18, 2009 @05:13PM (#30148754) Homepage

    There was a wonderful bug in ubuntu where it wouldn't print on tuesdays. It would generate a postscript file, which includes the date, but a faulty entry for file-type detection caused postscript on tuesday to be interpreted as some kind of erlang file... which obviously didn't print very well :)

    http://bugs.launchpad.net/ubuntu/+source/file/+bug/248619 [launchpad.net]

  • by DeadCatX2 ( 950953 ) on Wednesday November 18, 2009 @05:35PM (#30149014) Journal

    Exchange works great for me. So does navigation. I had no problem charging my phone with my netbook's USB port. I did, however, notice that changing the orientation can cause not-yet-applied settings to be forgotten (happened to me while setting up Exchange).

    I don't have any Bluetooth stuff so I can't comment on Bluetooth support, but I imagine it will improve. Bluetooth seems like a very temperamental protocol. That said, hands-free Bluetooth voice dialing is actually a showstopper for a lot of important business types, so that should get fixed right away.

    If you don't like the native Contacts application, I'm sure you can find some others. Personally, I use the Favorites tab of the Contacts widget, and that handles 95% of the times I want to make a phone call in two clicks.

    Finally...Motorola made the phone, not Google.

  • by pwagland ( 472537 ) on Wednesday November 18, 2009 @07:02PM (#30150230) Journal

    • Can't sync with Outlook (the phone doesn't have on-device encryption that would satisfy Exchange policies).

    They should've just made it to lie about its policy enforcement to Exchange server like the iPhone did. That way it'd be banned from my corporate network like my iPhone was. Thanks Steve, you're such a smart guy.

    Just as an aside, that bug is now fixed [goip.com]. To cut the story short, the 3GS does support it properly, earlier models do not, and iPhone 3.1 properly reports this to the server now.

  • by Anonymous Coward on Wednesday November 18, 2009 @08:07PM (#30150966)

    Good job being a grammar Nazi. The final dot of your last sentence doesn't belong. There should be just one period, inside the quotes (regardless of which standard of English you were trying to be pedantic in).

  • by david duncan scott ( 206421 ) on Wednesday November 18, 2009 @08:11PM (#30151032)
    Well, it's a double entendre--"word" is a vernacular term for "truth," or "that's right" ("The Sun rises in the East" "Word!") as well as being a (maybe obsolete? I'm old and stuff) term for a 16-bit storage unit, often a "short int," so hilarity ensues (for very small values of hilarity.)
  • by hpa ( 7948 ) on Wednesday November 18, 2009 @08:48PM (#30151400) Homepage

    Keep waiting ... the behaviour still won't be transparent. For example, on 64-bit x86 cpus, you still can't shift left more than 31 bits at a time.

    Nonsense. In 64-bit mode you can shift up to 63 bits at a time.

  • by ilitirit ( 873234 ) on Thursday November 19, 2009 @10:24AM (#30155816)
    It actually comes from the Latin "dictum meum pactum" meaning "My word is my bond" which is the motto of the London Stock Exchange. It was shortened to "word is bond", which means "I speak the truth". It was also used as a question ("Word is bond?"), usually indicating a feeling of disbelief. Naturally, the phrase got shortened even further to just "word". So a typical conversation went something like:
    "I made $12k last week"
    "Woah...word?"
    "Word"
    These days saying "word" in response to a statement means "What you said is true", which implies "I agree".

To the systems programmer, users and applications serve only to provide a test load.

Working...