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.'"
When Signed/Unsigned Strikes (Score:5, Informative)
The patch is simple, make that signed int something like an unsigned long or truncate it properly. Hopefully we're not waiting long.
"Not waiting long"? (Score:5, Funny)
I've been waiting a long long time for standardization of integer types.
Re:"Not waiting long"? (Score:5, Funny)
Yeah? Well, I've been waiting an unsigned long long time for standardization of integer types. Twice as long!
Mother said there would be days like this (Score:4, Funny)
Re:"Not waiting long"? (Score:5, Informative)
Nonsense. In 64-bit mode you can shift up to 63 bits at a time.
Re: (Score:2)
Re: (Score:3, Funny)
me love ulong time
Re:When Signed/Unsigned Strikes (Score:5, Funny)
We're waiting unsigned long.
Re:When Signed/Unsigned Strikes (Score:5, Funny)
As long as it's not a justin long... he's already signed.
Re: (Score:2, Offtopic)
You don't need a period after a quoted sentence that is properly terminated. Consecutive dots, are consecutive dots after all.
Uh... (Score:4, Funny)
Re:When Signed/Unsigned Strikes (Score:5, Funny)
Under most circumstances, you would be correct. However, there are certain situations under which it is grammatically correct to omit the final mark of punctuation: when a speaking character is defenestrated mid-dialogue; when the narrator has just discovered himself to be his own grandpa; and (as is clearly the case in the grandparent post) when quoting the first line of a limerick:
Wish I had mod points, this entire thread is one of the funniest ever on /.
Second quite possibly only to last week's delightful essay on the breakdancing robot
Of course it would be
somewhat remiss of me
Not to mention that I find most everything hilarious because I just don't get out a whole lot.
Re:When Signed/Unsigned Strikes (Score:5, Funny)
Re: (Score:2)
I was just about to post, asking "Why does the autofocus need to know what time it is?" Thanks for the info.
Re:When Signed/Unsigned Strikes (Score:5, Funny)
Waiting long? Hopefully we're not waiting double!
Re:When Signed/Unsigned Strikes (Score:5, Funny)
Word.
Re: (Score:3, Informative)
Re:When Signed/Unsigned Strikes (Score:5, Interesting)
Re: (Score:2)
What I don't get is why a time stamp is needed to focus. Most cameras don't seem to need to know what time it is in order to do that.
Re:When Signed/Unsigned Strikes (Score:5, Informative)
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.
Re: (Score:2)
Sounds like something to add to the jargon file [catb.org] :)
Re: (Score:2)
Seems like having a system timer trigger the auto focus update event would be a far better method of dealing with it rather than polling to check if its time to update again in some sort of loop.
Android DOES have timers usable by drivers doesn't it? Requiring drivers to poll would be very shitty indeed, especially on devices with lower CPU power..
Re: (Score:2)
When I first read about this that was the first thing that came into my mind as well. Elsewhere I found another post where a permanent fix should be available on December 11th, which is the day that the bug will re-appear.
Re:When Signed/Unsigned Strikes (Score:4, Informative)
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).
Re: (Score:2)
The engadget poster mentions a rounding bug, not a sign-extension bug. (and for it to be a sign-extension bug, they would need to be extending from 32-bit timestamps to 64-bit timestamps).
That doesn't mean it's not the 2^31 ms ~= 24.5 days. It could be that the platform "rounds toward zero", and the developers anticipated that to mean "round down" in the context of numbers that are always positive...and when the numbers become negative, it rounds up instead, and screws them.
The best theory I've heard so f
Re: (Score:2)
Comment removed (Score:4, Insightful)
Patriot's Ghost (Score:3, Funny)
Hmmm, did the auto-focus programmer used to work on the Patriot anti-missile system?
Re:When Signed/Unsigned Strikes (Score:4, Funny)
WRONG FOCUS...
Sounds like you are on the wrong end of the 24.5 day cycle :)
Re:When Signed/Unsigned Strikes (Score:5, Funny)
Sounds like you are on the wrong end of the 24.5 day cycle :)
That's what my wife keeps telling me. :(
Re:When Signed/Unsigned Strikes (Score:4, Informative)
The support for the camera in the Droid was developed by Motorolla, not Google.
Re: (Score:2)
Cue the lawyers from Motorola, that new company is asking for trouble!
Re: (Score:3, Insightful)
Re:When Signed/Unsigned Strikes (Score:5, Insightful)
Whenever I write something I think it particularly clever, I comment it out and write something simpler. The clever stuff I find is nearly impossible to figure out next year when you have to go back and add a feature or change something. It doesn't help that I usually think, "Oh that's so clever, there's no way I would forget how that works. It's so elegant." and don't bother to comment the hell out of it.
Simple == good
Re:When Signed/Unsigned Strikes (Score:5, Insightful)
Obligatory quote:
"Debugging is twice as hard as writing the program, so if you write the program as cleverly as you can, by definition, you won't be clever enough to debug it. "
Does it use an Intel CPU? (Score:2, Funny)
Just curious.....
Re: (Score:2)
Re: (Score:2)
wow, almost 15 years later and they still get sh*t for fdiv. of course, this joke is so stale we'll probably hear it on jay leno tonight.
Re:Does it use an Intel CPU? (Score:5, Funny)
Read and be enlightened [wikipedia.org].
Of course my favorite joke about the matter:
Q: "How did Intel decide to name the 586 processor?"
A: "They took 486, added 100, and came up with 585.999999999999824"
Re: (Score:2)
Is that really a joke?
Auto-Focus (Score:5, Funny)
Re:Auto-Focus (Score:5, Funny)
Schrodinger's Auto-Focus (Score:5, Funny)
It is necessary to have some radioactive elements in your phone for it to focus.
PS, it may or may not also kill cats!
Re: (Score:2)
PS, it may or may not also kill cats!
Or drink beer [angryflower.com]
Re: (Score:2, Funny)
Re: (Score:2)
Failed, you have; to be funny.
Re:Auto-Focus (Score:4, Funny)
"Sporadically bugs: iDoesn't. Droid does."
Yeah, tell that to the iPhone browser next time it shits out without warning. iDoes, too.
In case you were worried.... (Score:5, Funny)
Spring Break, the biggest part of it, occurs within a working cycle.
Re: (Score:2)
Right, like the camera is going to be the most common cause of out of focus pictures during spring break.
"OMG EVERYBODY LISTEN - DO 6 JELLO SHOTS WITH ME, THEN SAY CHEEZ. *burp*, *snap* AWW, THE CAMERA DIN'T WORK GUD"
Alleged... (Score:5, Funny)
by someone claiming to be Google engineer Dan Morrill
Yeah, it could also be one of those lame Dan Morrill impersonators who solve perplexing engineering/programming issues, then post the solution under his name. MAN that's annoying..
Re:Alleged... (Score:4, Interesting)
You kid, and I can appreciate the humor, but it was stated that way as a matter of journalistic integrity. Rather than claiming the the true Dan Morrill posted this (which they have no proof of) they stated what they did know: the person that posted this says he's Dan Morrill. That way if it turns out that Dan Morrill didn't actually post it, they've not put word into someone's mouth, as it were, and only need to release an update along the lines of "Bug discoverer really someone else".
It's sad that we've become so used to the modern media's 'report what you think happened and maybe correct yourself later if you're called on it' style that phrases like this are actually worthy of comment, humorous or otherwise....
Re:Alleged... (Score:5, Funny)
You have some interesting points, person, posting using Artraze's account, on a website my DNS tells me is slashdot.org.
iFocus ... NOT (Score:5, Funny)
Simple solution (Score:3, Funny)
Just buy two with opposing date stamps.
Time-releated bugs (Score:5, Interesting)
15+ years ago I had to debug some code in a report printing app for OS/2 (remember that OS?). The bug would cause the app to crash when a report was printed out. But the bug would only happen on certain days. Certain days in September. Only on Wednesdays in September. Only when it was a Wednesday in September after the 9th.
The bug? The original programmer had tried to optimize memory usage as much as possible and was off by a count of one. With "September" being the longest month spelled out, "Wednesday" the longest day spelled out, and a 2 digit date, the header that the program put together to send to the printer would overflow its buffer by one character.
Re:Time-releated bugs (Score:5, Funny)
I also had a bug report for when you tried to add a prerequisite that didn't exist to a training task (the system tracked flight Air Force crew training and experience), an error would pop up that said "All this time and it still doesn't work..." In that case, apparently debugging was as far as anyone ever got.
Re:Time-releated bugs (Score:4, Interesting)
I also had a bug report for when you tried to add a prerequisite that didn't exist to a training task (the system tracked flight Air Force crew training and experience), an error would pop up that said "All this time and it still doesn't work..." In that case, apparently debugging was as far as anyone ever got.
Please tell me these aren't the same developers who wrote the Air Force's current LMS. If so, that would explain a lot. I actually submitted a bug report to the Air Force once about their LMS complete with the section of code (Javascript) that was incorrect, an explanation about why it was incorrect, the corrected code, and an explanation about why the changes fixed the issue. They responded and said that they were "reluctant" to agree with me, and never made the changes.
Oh yeah, the "bug fix" was the difference between this:
score = parseInt(score);
and this:
score = parseInt(score, 10);
if (isNaN(score)) score = 0;
Not printing on tuesdays. (Score:3, Informative)
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]
IIRC, this is the same sort of bug (Score:5, Insightful)
that caused Windows 95 to require a reboot in about the same timeframe.
Re:IIRC, this is the same sort of bug (Score:5, Funny)
I didn't realize there was a real software reason for it.
I wonder if there's a way to do the same for my wife - you know, fix a software bug.
Gotta run she's home!
Re: (Score:2)
Just get her on Seasonale [drugs.com] or an equivalent.
Re:IIRC, this is the same sort of bug (Score:5, Funny)
Same timeframe? You could actually keep a Win 95 system up and running for 24 days?
Re:IIRC, this is the same sort of bug (Score:4, Informative)
It was actually 49.7 days [microsoft.com].
Re: (Score:2, Funny)
Wow (Score:4, Funny)
Considering that a lunar cycle is 29.5 days long, we've actually found a bug that depends (approximately) on the phase of the moon!
Re: (Score:2)
Re: (Score:2)
Huh? Joking that a bug depends on the phase of the moon is old as time itself [catb.org].
Re: (Score:3, Funny)
Re: (Score:3, Insightful)
Of course. That's when the world was created, fully-formed. How do you know the world existed before Jan 1 1970? :-)
Re: (Score:2)
what, the autofocus doesn't crash, instead it sparkles?
A permanent fix (Score:2, Funny)
"'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."
Cool! The device will later be fixed to properly behave poorly only every 24.45 days!
in Action... (Score:2)
Will they remember at review/raise time? (Score:2)
"Tasks accomplished: fixed timestamp rounding error in autofocus subroutine"
vs.
"Tasks accomplished: designed/implemented autofocus subroutine"
iPhone 3G/3GS GPS bug (Score:5, Interesting)
Since we're talking about phone bugs, here's one I had to fight with for a while...
Lots of users are having problems with the GPS functionality on the iPhone 3G/3GS (see e.g. here [apple.com]). No apparent pattern there, but in Brazil, lots of users from one specific carrier were having GPS problems, and the beginning of these problems coincided with the start of Daylight Savings Time in Brazil. My iPhone, as well as my girlfriend's, are with this carrier and were experiencing the problem. Those with unlocked phones report trying other carriers' SIM cards and had GPS working again, but once you popped back the problematic carrier's SIM card, the GPS was dead again.
This nearly drove me nuts as I paid an obscene amount of money for the TomTom app and couldn't get it to work, so keeping up with the engineer spirit, I tried to debug the problem myself. I observed an interesting fact: there's a Clock app on the iPhone with a World Clock pane, and if I added a clock from any time zone, including my own, it was off by one hour. However the iPhone's main clock, shown on the top of the screen, was showing the right time. Eventually I discovered that if I restored my phone as a brand new phone (not restoring from backup) the GPS would work fine and world clocks would be fine... until you reboot the phone. After rebooting, the GPS is gone again and the world clock is off by one hour again.
Now you might ask what the time has to do with GPS. A lot, it turns out. GPS works by triangulating your distance from the satellites in the GPS constellation, which depends on knowing the exact position of the satellites. Since their orbits are corrected every so often, you must rely on so-called ephemeris data from each satellite, which is the required information to compute fairly exact orbits, and is updated fairly often (Wikipedia says GPS receivers should update ephemeris data every 4 hours). Originally this data is broadcast by the satellites themselves in their navigation message, at an awfully slow rate of 50 bits/s. You read it right, bits, not bytes or KB or MB, that's bits. As the navigation message is 1500 bits long, it takes at least 30 seconds to download it, which is about the time most standalone GPS receivers take to get a fix from a cold start (i.e. with stale ephemeris data). To work around this delay, most phones with GPS use the assisted-GPS variety, which downloads ephemeris data from a faster channel such as the cellular network. My theory is that some WTF-worthy excuse for an engineer at the carrier decided that, rather than doing time zone updates the right way, by updating configuration files to point to the new time zone, he'd just rather adjust the clock forward by one hour. The GPS chipset probably works with time zone neutral clocks so it asks for (say) UTC time and gets it off by one hour, and then computes the satellite orbits as though it were one hour later than it actually is. Obviously this means the triangulation computations go horribly wrong and rather than reporting something absurd, the chipset just pretends it couldn't get a fix.
It took a lot of complaining from a lot of people (to the carrier and to the government agencies responsible for telecommunications), but the carrier finally fixed the problem. However, it was a nightmare trying to deal with clueless customer support representatives who didn't try in the least to help (and probably were thinking all along `what does this wacko think GPS has to do with DST?'), just blindly suggesting that we restore the phone, or even try to uninstall the built-in Maps app, or blaming it on Apple and saying they weren't responsible -- and never mind that unlocked phones with SIM cards from other carriers worked fine, and that the iPhone support situation is unique in Brazil as Apple outsourced support to the carriers themselves. In the end, the customer support WTFs would be worth another post of its own, at least twice the size of this one.
But
Re: (Score:3, Insightful)
GPS works by trilaturation [wikipedia.org], not triangulation... just sayin'
Kudos to Google for being so open about the bug (Score:5, Insightful)
Re:Kudos to Google for being so open about the bug (Score:4, Interesting)
I realize the post was made by a Google engineer, but, wouldn't a bug in "the camera driver's autofocus routine" be on Motorola's end, not Google's? I'm sure they were working together on it, but aren't drivers usually written by the hardware vendor?
iDon't Focus properly (Score:2)
... but the iPhone does.
I must have the same bug... (Score:5, Funny)
After about 42 years my auto-focus suddenly stopped working as well.
You think if I live to 84 or so it will suddenly get better again?
I sure hope there's a patch...
G.
Re:I must have the same bug... (Score:5, Funny)
Re:I must have the same bug... (Score:5, Funny)
BUG! That was supposed to be 29.5 not 24.5 (Score:2)
Sounds to me... (Score:2)
...like a bad motivator.
Bigger bugs afoot... (Score:5, Interesting)
Honestly, autofocus on the just-so-so camera is the last of my worries:
Really, fix the camera sometime down the line. But make the phone dial hands-free. Make email work. Make the navigation something other than worthless. Make "lock the screen" really lock the screen.
Someone at Google should use one of their own phones for a while and see how (s)he likes it.
It's a wonderfully powerful platform, but clearly not as well-thought-out or fluid to work as iPhone/iPod Touch
Re:Bigger bugs afoot... (Score:5, Informative)
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.
Re:Bigger bugs afoot... (Score:5, Insightful)
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.
Re: (Score:3, Informative)
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.
Re: (Score:3, Interesting)
What I've seen is that some chargers power any USB powered equipment (including those on my PCs and laptops) and other wall and car chargers only power *some* USB powered equipment. I'm guessing what's going on here is that some equipment (usually expensive thingies) refuse to run off an unregulated supply. I've seen the same thing happen with a battery powered USB charger I whipped up. Some equipment won't recognize it until the batteries are drained a bit. That includes my new droid phone.
With respec
4.3BSD had a bug like that (Score:5, Insightful)
The initial release of 4.3BSD had a bug like that. It wouldn't interoperate with implementations that chose TCP sequence numbers in the upper half of the 32-bit address space. BSD itself didn't do this until it had been up for 2^31 seconds, so it got through testing. Other implementations cycled faster. We were losing network connections for two hours out of every four.
It took a 1-line fix, after three days of looking at the generated machine code to figure out exactly how the sequence number arithmetic worked. Too many casts in the source.
Re: (Score:3, Interesting)
(2^31) seconds = 68.0511039 years of uptime before the bug manifests? So this wasn't much of a problem for BSD?
Re: (Score:2)
Depends what method of autofocus is used. I haven't been able to find any reference to which type of AF it uses, and I guess that isn't surprising as most people using a phone as a camera probably don't know or care much about the differences between AF methods...
Re: (Score:2)
The first guy to comment made hit upon the most likely explanation, probably... the autofocus re-adjusts itself every n milliseconds, and if the timestamp is interpreted as a signed value then 50% of the time it will yield incorrect results when it calculates the interval between autofocuses.
Didn't occur to me until I read his comment, but it makes sense now.
Re: (Score:2)
I did. It explained that the autofocus routine needed the timestamp. It failed to explain why it should need it.
Re: (Score:2)
And yes, I saw that this question was answered in the first post.
Makes sense. But it didn't, until that guy explained it.
Re:A timestamping overflow error (Score:5, Funny)
Congratulations. You are among the few (but growing in number) who not only can't RTFA, but lack the attention span or comprehension skills to read the summary itself.
MTV has a network for you.
Is that network called MTV?
Re:Rounding error? (Score:4, Funny)
Spelling error? Inexcusable. The English language is too mature for that type of shit.
(In case you missed it, your argument has just as much validity in the real world due to differences in people.)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2, Insightful)
Re: (Score:2)
I love the phone, but the software was clearly rushed to market.
Yeah, because no one else [applehound.com] ever has launch bugs. No one else [bit-player.org] ever launched a product into the world with a time-sensitive bug.
Here's a tip. If you don't want to ever have anything go wrong with your electronics, then perhaps you should wait until something has been out at least six months before buying it.