Bizarre Droid Auto-Focus Bug Revealed
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.'"
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. 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.
My work here is dung.
Just curious.....
Feed the need: Digitaladdiction.net
... Droid doesn't
Spring Break, the biggest part of it, occurs within a working cycle.
hoses up the camera autofocus?
Is this Slashdot, or The Daily WTF?
Welcome to the Panopticon. Used to be a prison, now it's your home.
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..
I've been waiting a long long time for standardization of integer types.
This is definitely NOT the Droid you are looking for
I am Slashdot. Are you Slashdot as well?
Just buy two with opposing date stamps.
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.
that caused Windows 95 to require a reboot in about the same timeframe.
Best Slashdot Co
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!
"'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 excusable. The industry is too mature for that type of shit.
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.)
I can verify this- I got a Droid on launch day, and one thing that drove me nuts was how long it took a barcode scanning app to focus and accquire the barcode... i just tried it again after writing off that ability, and sure enough, the time to focus is much, much shorter now.
"Tasks accomplished: fixed timestamp rounding error in autofocus subroutine"
vs.
"Tasks accomplished: designed/implemented autofocus subroutine"
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). 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
Join the NFSNET. Our prime goal is making little numbers out of big ones. http://www.nfsnet.org/
It is necessary to have some radioactive elements in your phone for it to focus.
PS, it may or may not also kill cats!
I only look human.
My mother is a halfling and my dad is an ogre, so that makes me an Ogreling
It is gratifying for Google to be so open about the fact that it is a bug, the details of the bug, and a promise to fix it. Most consumer electronics companies are much more cagey about this sort of thing. I suspect Google will win some important trust because they are treating their customers like adults.
Huh? Joking that a bug depends on the phase of the moon is old as time itself.
Given that this bug made it out into the wild, does this mean that the Android team only did 24 days of beta testing of the product? Or that they thought they would release a patch within 24 days?
Not particularly smart or impressive, either way.
-- the_Librarian
IIRC, Verizon is the one licensing the name Droid. In other countries where the phone is going to be sold it is known as the Motorola Milestone. So while technically the phone is Motorola's, when referring to it with the Droid name, it is specifically referencing the Verizon version of the phone.
oops - days, not hours. My bad :-(
... but the iPhone does.
#DeleteChrome
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.
No, they would have discovered their are focus problems. They would not necessarily know the cause. They may even implement a fix or two, and at some point, the problem went away, so they marked the bug "fixed". They could easily have been testing for 90 days or more without discovering the exact nature of the bug, with multiple false positives indicating that it had been fixed.
"Convictions are more dangerous enemies of truth than lies."
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
"You know, Hobbes, some days even my lucky rocketship underpants don't help" -- Calvin
Half the focus group users did not want in-focus photos taken of them for a few days each month. Some idiot male programmer clearly mistyped the constant.
Squirrel!
...like a bad motivator.
...camera will only focus on breast/nippels due to testing only done on this item.
...and it shows up as a simple rounding bug, how disapointing.
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
Comment removed based on user account deletion
I love the phone, but the software was clearly rushed to market.
Yeah, because no one else ever has launch bugs. No one else 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.
:(){
Hmmm, did the auto-focus programmer used to work on the Patriot anti-missile system?
Table-ized A.I.
what, the autofocus doesn't crash, instead it sparkles?
And, in countries that doesn't acknowledge the existence of software patents, you will have multitouch in Motorola Milestone. Yes, the Droid have hardware to do multitouch. Hack to enable it in 5, 4, 3...
Grey's Law: Any sufficiently advanced incompetence is indistinguishable from malice.
Comment removed based on user account deletion
This could've lead to a somewhat funny situation as well. QA could've filed a bug saying autofocus didn't work. Then by the time the developer looked at the bug, it could've been in the working period and the developer could've marked the bug as 'WORKSFORME'. Which, when it gets back to that QA guy's plate, depending on whether it was still in the working period or not, the QA guy could've tested it and marked it as 'RESOLVED' if it was working, or re-open the bug if it still wasn't working. If it was re-opened, the whole cycle could continue to repeat.
I don't know if such a thing happened, but it would've been funny (in hindsight at least) if it had.
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.
I thought it was about Androids. Maybe military ones. Or at least ones with auto-focusing cameras as eyes.
And them behaving bizarrely human-like.
Now that would be a real story!
Who cares about some crappy niche phone?
I want my “drone wars”! Now!
That would also solve the problem of people caring about unimportant shit like this. ^^
Any sufficiently advanced intelligence is indistinguishable from stupidity.
Woke up today, and just can't focus!!!
Science advances one funeral at a time- Max Planck
Open Source had everything to do with finding the bug. Either you mistakenly believe that Android is a Google platform, or that paid employees don't work on Open Source software. If a Red Hat employee finds a bug in the Linux kernel, does it mean "Open Source had 0 (sic) to do with finding the bug"? Paid Google employees aren't finding bugs in Apples code, now are they?
It won't be available until December 11th! OMFG! (feigns disgust)
You mean they already have a roll-out plan in place, and they already informed you with details of that plan ???? You either don't know how software is developed (closed and/or FOSS), or you didn't eat your Wheaties this morning. If this was closed source you would neither know about the bug, or any roll-out plan, most likely because the bug would remain hidden or there would be no desire to share that information with you.
Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
So since January 1st, 1970?
Of course. That's when the world was created, fully-formed. How do you know the world existed before Jan 1 1970? :-)
An unsigned long long time is 8 589 934 592 times as long as a long time is.
But whose counting!
Comment removed based on user account deletion
It was a single line comment. No terminator necessary.
"National Security is the chief cause of national insecurity." - Celine's First Law
Be durned, I had an almost identical bug! Mine would always print on Wednesdays even if hard copy was deselected, because the y in Wednesday overflowed. The month and date weren't involved though, your bug is even cooler.
don't fee l bad, if we go "by the book". like Lieutenant Saavik, hours could seem like days.
The Kruger Dunning explains most post on
Yeahn yeah, mod me as troll, but I am right.
Too many times have I seen these kinds of stupid inexcusable error. It drives me up a wall. The 'it's going to have ' bugs mentality is out of hand, and inexcusably stuff is allow to get through testing.
If we could get half the pride and professionalism then engineers are supposed to have into the software industry, it would be a good thing.
The Kruger Dunning explains most post on
Except this isn't a profession post, or a paper, or a book.
I am talking about a professionally(?) released, distributed and sold device. There is a world of difference, coward.
The Kruger Dunning explains most post on
Yet you did.
The Kruger Dunning explains most post on
Enough said. But may be worse these days as people don't seem to actually think about the hardware. There seems to be an attitude of: "Java/.Net/Python etc. will do everything! Why worry about hardware!"
putting the 'B' in LGBTQ+
2^32=4,294,967,296 /1000 (ms per second) = 4,294,967.296
/ 60 (seconds per minute) = 71,582.788266666667
/ 60 (minutes per hour) = 1,193.0464711111111
/ 24 (hours per day) = 49.71 days
Perhaps you can enlighten us on how to reduce human fallibility? How do you ensure (without using people) that every datum is of the correct type, used in the correct way, at the correct times, using the correct interfaces, and doesn't have bugs caused by a library written by someone else in a different language?
Here's some simple VB.Net code dealing with XML documents. If you can find the bug in less than a minute without Google/Bing/etc, you get to comment on code quality. Otherwise STFU and let the professionals, who really do have pride in their work, do their jobs.
pSmileyList = New SortedDictionary(Of String, String)
Dim Smileys As XDocument = XDocument.Load(Constants.SmileyImages + "index.xml")
Dim Code As String = ""
Dim Image As String = ""
For Each S As XElement In Smileys...
Code = S.@code
Image = S.@image
pSmileyList.Add(Code, Image)
Next
Can't hands-free voice dial [...]
This one I have never understood.
Whenever I have the time and attention answering or making a phone call requires, I also have my hands available, or I can make them available in a few seconds.
So why is this an important feature?
I quote your parent:
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
If we have a BSD box talking to a Windows box that's using high sequence numbers, we run into problems. If Windows boxes always use sequence numbers in the upper half, the bug manifests 0 seconds after talking to a Windows box.
What works for 68 years is BSD talking to BSD.
May you have lots of fun making the internet work under those conditions ;-)
Microsoft already has these drop-down menus that only list the options you've used recently.
Sorry, I couldn't resist. I hate them too. "Grows with the user" isn't the answer.
In fact, I think you've fundamentally mistaken two concepts. 'Simple' is conceptual; 'easy' is experiential.
Clippy and dynamic drop-down menus are not ‘simple’ (cf. trying to run Word on a Mac in 1999. The light dims, a hush falls over the crowd, and Clippy chunders onto the screen. Three minutes later, that superquick animation manages to say something), but they were developed to make things ‘easy.
In truth, they weren't even developed for that reason. They were built because what matters most for software is the 15-minute sales pitch that results in corporate contracts. Office (and many, many other programs) needs to look cool and to engage the complete idiot for a quarter-hour of interaction.
If software can't sell itself in 15 minutes, it doesn't sell. A proper "simple" design that works well, without confusion, without encouraging bad habits (anyone remember the Macintosh "virtual, distributed desktop" that would result in endless disk swaps?) requires motivation or teaching to learn, and those things can't be communicated in 15 minutes.
This is exactly what we need - cameras with mood swings. What's next? Phones with a short attention span?
Is passive resistance passive aggressive ?
Does being in VB.Net count as a bug? I rather like C#, but looking at VB.Net makes me deeply unhappy. :-)
They might have tested it for 49 days, then after halfway through heavy testing and debugging, the bug just "vanished by itself" and they couldn't reproduce it.
45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
yea and soon they will discover that it is not only signed, but also byte inverted.
God's gift to chicks
Laugh while you can! When the robots develop religion, you'll find that they're creationists thanks to the Unix Epoch!