Search This Blog

Saturday, November 3, 2012

Modify USB auto charger to actually charge a phone!


I have always wondered why my phone doesn't really charge from my computer or some car adapters.  It stays alive but doesn't charge like it does from my wall adapter.  I had always thought it was a matter of the current limit of the devices and cheap chargers.  Turns out there is an internal sensor in the phones for detecting if the USB data pins are shorted together that makes the phone decide if it is plugged into an adapter or a USB connector and limits the current.   Wow.  Wish I knew that years ago after many vain attempts to charge my phone from my computer.

I happen to have an Android phone, but these comments apply to Apple devices too.   On Android  I discovered you can tell what charging mode your phone is in on the Settings->About Phone->Status  screen.
It will either tell you "Full" , "Discharging", "Charging (AC)" or Charging (USB).   When it says Charging(AC), you are in the high current charging mode.   When the phone is on, it uses power at almost the same rate that the USB mode charges it, so you never really get anywhere.

Here is how I learned it.    I was out shopping for a high quality USB charger for the car, since the one that I had broke....


The user reviews had this comment. hmmmm....
Based on the reviews and product description of this device, I was lead to believe that it would charge an Android phone at full AC power mode (not USB 0.5amp mode). Based on that information I ordered several of these for a medium-scale deployment of devices at my work.
Long story short: This device will not charge an Android device in AC power mode. As soon as you plug it in, the Android device enables USB charging mode.
I'm hoping that I can figure out a way to crack the unit open and short the middle pins (which forces AC charging mode for Android devices on other car chargers)...
I'm giving it two stars for excellent build quality and packaging.
Update: I figured out how to disassemble the unit and it turns out to be quite easy.
The high build quality of this unit actually enhances it's ability to be disassembled, modified and reassembled. You can do it all with a single flat-bladed screwdriver (and a soldering iron). Resassembly doesn't require any superglue like some of the other units that are popular to mod.
Once the unit was disassembled, I looked on the back of the circuit board and found 2 places where there were 4 small pins in a row. I put a small blob of solder across the middle pins on each of them and reassembled the whole unit.
I went out to the car to test it and sure enough, all my android devices see it as an AC charger and start charging in high-speed mode.
I will add one star to my rating due to the excellent build quality enabling an easy modification.

Thanks to the reviewer, there are even pictures of his mod..
Click on the link above to see his photos.    Short the center two pins of the USB connector together for android devices.


















Some more google searching found this
http://forum.xda-developers.com/showthread.php?t=1870586
Which started with some mis-information before it got helpful
Quote:
If you apply 5V to vcc+, connect the ground and give same voltage to D- and D+ , the device is going to have AC supply mode. In order to have the same voltage on D- and D+ you have to connect those together (green and white - middle pins on PCB interfaces), BUT YOU HAVE TO LIMIT THE CURRENT through a resistor connected to +Vcc 5V. (over 60K Ohm). So you go from +Vcc 5V, connect a resistor over 60K ohm, and have the other resistor end attached to D- and D+ all connected together.
This is excessive. All you need to do is connect D+ and D- together - no need for resistive voltage dividers.
The ONE exception are Samsung Galaxy Tab devices - these expect D+ and D- to be held to 1.2 volts by the charger. If you use high enough resistor values, you can set up the divider to provide 1.2 volts to a Tab, but easily be overridden by the "short detection" mechanism used by other devices to detect dumb chargers. 33k pullup 10k pulldown is known to work well.

This article had a lot of good technical information on apple charging
http://www.ladyada.net/make/mintyboost/icharge.html

Apparently modifying to this circuit will charge an apple device at 1.0 amp.  Simply shorting the data pins will work for most other devices.   The common mode voltage of the USB conveys the information.



OK I've ordered the USB chargers and will post the details of the mod when they come.  I'll probably go with the resistors.

However I have another idea.  I may modify an extension USB cable or my cheap non powered hub to short the D+/D- pins and insert that in the cable.   That should trick the phone without modifying the charger.

I pulled out a giveaway non powered USB hub that never really worked well in the first place.  One screw on the back and it popped open.




I will just solder the pins together on the data plugs, which the chip will hate, but this thing should pass power from the charger now.  Here is the circuit board on the inside before I modified it.


`

Here is the board with the data lines all shorted with solder blobs


I put a solder blob across the center two data pins in each of the four USB connectors as well as the two for the input cable.  I'm not sure that was necessary, but I didn't want the chip to try to communicate to anything, just to pass the power.  There are some small resistors on the board in series with the power connections, which may not be able to handle the current.   This is just a shameful hack experiment to see what happens.  Put it all back together (one screw).

FAIL.   I tried it in the car and with a house plug and two android phones.  Both indicate they are plugged in, to something USB, but none of my phones even indicate they are charging on the status screen.   I'm going to have to try a bit harder, either reverse engineering the cheapy USB, adding resistors, etc.

I measured the voltage at the D+/D- pins that I had shorted with the solder blobs.  ~0V.  I also measured resistance and it is not an open circuit.  I'm going to have to cut the board traces away from the chip and add a resistor divider.

In the mood to hack and learn I committed another atrocity of hacking.  I happened to have a couple 1K resistors to make a divider out of.  That will mess with USB communication but shouldn't hurt anything.  I cut the traces between the chip and one of the USB jacks.  I soldered the resistors from the center two shorted connectors, one to ground and one to 5V.  I measured with the voltmeter 2.5V on the center two pins.  Plugged it into the USB on my computer and into the phone.



WIN!  The phone now says it is charging in AC mode, when plugged into a USB jack.  I'm probably pulling too much current out of the computer so I won't do this long, but it should serve as a handy cheat block to charge my phone faster.



Ha Ha, i got the USB car charger in the mail.  Either it has been updated, or my phones are less picky, but for me it ALREADY comes up as charging in AC mode.  So no modification is necessary.  But at least I built a converter for use in other situations.

Sunday, October 28, 2012

Windows 8 & Avast - New start menu apps didn't work/crashed


Since I had bought a new PC in the last couple months, I used the promo code I got to upgrade one of my machines to Windows 8 just for the experience.  Bleahhh.   Thumbs down so far.  Confusing, non intuitive and generally worse than Windows 7 if you don't have a tablet.

I used the download option and installed the upgrade on a desktop with dual monitors that was running Windows 7.   Besides taking over an hour to install, it went smoothly and came up in windows 8.

From the desktop side, it seems just like Windows 7 without any of the useful buttons.  The Start menu is missing and the control panel and power buttons are all hidden in the corners.  Took some getting used to.

But finally to the point of this post....

The new Start Menu Screen didn't work at all.  When I clicked anything but the desktop or icons for my desktop apps, such as the Weather or Finance buttons, the screen would show the splash screen for a second and bounce back to the Start menu.   Since I didn't know what it was supposed to do I spent hours playing with this useless piece of #*&#$.

I finally found the solution.  The problem was my Avast installation.
http://forum.avast.com/index.php?topic=103987.msg838769#msg838769

Ignore all the advice about resolution, user accounts, etc.  The problem is Avast is blocking the start menu.
Open the Avast user interface, go to behavior shields, expert settings and unclick "Monitor the system for unauthorized modifications".  Now the new menus will work.





Here is the post that was the answer...

Re: Problem with Avast Internet Security and Windows 8
« Reply #3 on: June 28, 2012, 01:52:46 AM »
Okay, after playing around with my AVAST Firewall settings, I finally got it to work with the apps. Go to your Firewall tab and click Firewall settings. Then click Expert setting in the top right area. Under the Policies tab (first screen) enable Internet Connection Sharing Mode. THAT'S IT!!! it will let you access the network for your apps, without having to disable your firewall for xx amount of minutes. The cool thing, if you're like me and don't want other users to access your skydrive or other apps, just simply uncheck the Internet Connection Sharing and it will block the apps again. =)


Solution for Behavior Sheild:

1. clcik on real time shields
2. click on behavior shield
3. expert settings
4. uncheck "Monitor The System for unauthorized modifications
5. them click on OK
now your Metro Apps will work.
« Last Edit: September 09, 2012, 02:09:15 PM by robmadden1 »




Monday, September 24, 2012

DirecTV 5LNB Non-SWM and TiVo HD THR22 Hookup Odyssey

Posting this epic tale in hopes it helps someone else, and to keep track of what equipment I have installed.

It has been almost a year since I put up the HDTV dish, never got around to upgrading the receivers till now.  One of the SDTV TiVo's started having a lot of picture and sound break up on some channels it was time to make the plunge and upgrade to HDTV.    

I described installing the dish in this previous post.
http://blog.workingsi.com/2011/10/installing-directv-5lnb-dish.html


The reader might ask, why not just call DirecTV and say "make it work".   Basically besides having aftermarket upgraded DVR boxes with big disk drives, I have my own cabling through my attic and basement, and don't want a tech messing with it.  Plus this stuff is just too much fun to let somebody else do.  I believe it is possible to get DirecTV to just send you some of the bits and bobs needed and save yourself some $$.  

OK, mostly this was because it was my wife's SDTV TiVo that was failing that made it critical.  In the past, when this begins to happen it usually means a tuner is failing.   She had a highly upgraded box, a Philips DSR708 DirecTV Receiver TiVo DVR with a TB+ of disk space that I had already replaced once for the same problem and I didn't want to replace it with another 5 year old used unit.   You can get these off ebay for <$40, but it was time to move on.



The dish I put up is a NON-SWM, four output slimline 5 LNB dish with a built in 4 way multiswitch.   This is technically obsolete, Directv has moved on to installing the SWM dishes.  They cost a lot more and allow you to only drop one cable to each box.  However I already have two cables pulled throughout my house, plus the new dishes require a power supply if you want to use them with the older SDTV boxes.  I have several legacy SD boxes in the house that are staying for now.  So that's why I used the older style 5 LNB slimline.

Directv finally released the HDTV TiVo  THR22 in Jan 2012.  This retains the TiVo menu system but does HD.  I must say after using it a week or two I really like it.  It is just like the old TiVo system that does what I want when I want.
http://www.weaknees.com/hd-tivo-directv-thr22.php
http://www.directv.com/DTVAPP/content/technology/tivo_receiver
THR22

Ha ha. Maybe satellite TV is already obsolete, since internet TV is going to replace all this stuff.  Truth be known we are already watching lots of Netflix, Amazon Prime.  But I don't like paying by the show to watch TV.

I bought the upgraded unit from weaknees for the added capacity, we are used to lots of disk space.  Kinda pricey I admit.   I was also concerned about activating the modified Weaknees unit on Directv, but they are a n authorized dealer.

I also bought two BBand converters for too much money.
http://www.weaknees.com/directv-b-band-converter-sup-2400.php
Later I see you can find these on ebay and Amazon,   I was in a hurry.
I got Rev 3 DirecTV B Band Converter SUP 2400, which I hear are better than earlier versions.  Make sure you get that one, pay attention to the Rev number. There are Rev 1 and 2 out there for sale on Ebay.

Plugged the THR22 in, with the BBand converters, and I get no hdtv signals, no signal on 119, 103, or 99 satellites.  I swear 119 was there when I aligned it last year. Tried the old SD receiver.  No 119 either.  I'm using the receiver signal meter for all these steps.  I never got around to buying a standalone satellite signal meter.   Plenty of signal on 101 so I decided to forge ahead and activate the box.

I was able to activate it just fine, with zero problems by calling DirecTV.  Had to pay $10 a month more for the HD service, I was already paying for the TiVo DVRs.   The new box probably comes up as leased.  Oh well.  I'm not planning on reselling the box later so it really makes no difference to me.  I couldn't do this online because I had ordered it from Weaknees, but via phone it was OK.  Gave them the RID and card ID.

Still no HDTV signal.  I tried to re-align the dish in the dark.  No improvement.  A little signal on 99c at best.  TV says searching for signal on all the HDTV stations.   Fail.  The next day in daylight I decided to remount and level the dish, it was off vertical, thinking that was why I couldn't get any signal.  I followed the alignment procedure exactly.  http://manuals.solidsignal.com/Slimline_Dish_Installation_Manual.pdf  Still nothing on 99, 103 or 119.   Fail.

I learned that my multiswitch (Terk 3x4) doesn't pass the Ka band HDTV.  So that might be the problem.

I bypassed the multiswitch temporarily and ordered a new one from Amazon that is compatible with HDTV. The Zinwell unpowered 6x8 Multiswitch MS6X8WB-Z


For some reason Weaknees wanted $79 for this, and it was $20 including shipping on Amazon.  Go figure.  This time I bought it off Amazon for $20.

Guess what.  It STILL doesn't work.   Fail.   No signal on 119, 103,99 and HDTV channels all say searching for signal.   Times like this make be want to sit in my chair and call the 800 number.  But I soldier on.

Took the receiver outside and plugged it in directly to the dish.  No multiswitch at all.  Note that I do have the Bband converters installed.  Same result.  Nothing.  I'm really confused.  Spent and hour tweaking the dish.  No signal.  I drag out the old SD receiver and plug it direct to the dish.  No 119 on this one either.  I align until I'm blue and nothing.   It's not the receiver, its not the multiswitch, it's not the cable.  I can't believe it's my alignment, it's dead nuts on.   Fail parade continues.

No other conclusion than the LNB is bad.  Hard to believe, but there is no other conclusion.  I bought it used on Ebay, maybe it was a dud somebody pawned off on me.  All I need is the LNB, not a whole new dish.  So I bought a new Rev 2 5LNB.  The one I had was Rev 1.    They look a bit different, the Rev 2 has clear LNB covers, the Rev 1 has solid white covers.  The Rev 2 has more lumps.   There is a label on it telling you the rev.  Make note that it has four outputs and is cheaper than the SWM version, which will only have one COAX output.   I bought it new on Amazon for $61.94 including shipping.   I didn't want to mess with another used one after all this.



New LNB came.  I climbed up and connected it.  Bingo!  99 and 103 birds came in loud and clear without moving alignment.  So the old 5LNB WAS BAD!!  Hard to believe.  Still no signal on 119.  Rotated the dish, tweaked, no 119.  Whaaa?  However I connected the receiver and now I'm getting "Channel not purchased, call extension 721" on all the HDTV stations instead of searching for signal.  Seems none of the channels I get are even on 119 so I've decided to leave it be.   I finally just peak the 99 and 103 and forget about the 119.   Hooked back up the new multiswitch to send HD to all the boxes in the house.   No problems, signal levels still look good.   Win!

Called Directv, got passed to tech support.  I tell them I just activated and get this "not purchased, ext 721" message only on the HD channels.  The others are fine.  The tech flails around and in the process resends the authorization codes to my box, and <insert happy dance here> the HDTV channels pop up.  What must have happened is that the HD birds weren't visible at the time it was first activated, so it didn't get the message.  Either that or the original tech activated it, then added HD service.  Who knows.   Turns out you can resend the authorization yourself from the online account management page.  So you can avoid calling if this happens to you.

Along the way bought some RG6 patch cables from Monoprice.   They are so cheap they beat buying cable and connectors and making them yourself.  
http://www.monoprice.com/products/product.asp?c_id=102&cp_id=10216&cs_id=1021603&p_id=3031&seq=1&format=2
I also have some 125 foot runs, with some short sections of RG59, that came with the house, and it works fine.   HDTV spoils the family, and they will soon ask for me to upgrade the rest of the units.  Win or Fail?

Friday, September 14, 2012

ISP Programming an Atmel AVR

Bought an Atmel AVR programmer from Digikey.  I'm working on a project where I need to be able to directly program the Microcontroller in situ that is embedded in a project.   In the past I've always used the Arduino IDE and USB programming, but the developer of this machine is using WinAVR and the ISP setting.  This post is just my notes on how to set it up.

This is what I bought:
Manufacturer

Atmel

Manufacturer Part Number

ATAVRISP2

DescriptionPROGRAMMER AVR IN SYSTEM


PROGRAMMER AVR IN SYSTEM | ATAVRISP2 | ATAVRISP2-ND | Digi-Key Corp.
http://www.digikey.com/scripts/DkSearch/dksus.dll?WT.z_header=search_go&lang=en&keywords=ATAVRISP2-ND&x=4&y=16&cur=USD

WinAVR and Eclipse was recommended to me over the Atmel provided suite.  Since I use eclipse for Java programing, I'm game.

Downloaded here:
http://sourceforge.net/projects/winavr/files/
Looks like this hasn't been updated since 2010.   Picked the latest version
 http://sourceforge.net/projects/winavr/files/WinAVR/20100110/WinAVR-20100110-install.exe/download

Double click on win avr install.   Run it from start menu.  Something comes up.  No idea what to do with it.



Also downloaded the AVR plugin
http://sourceforge.net/projects/avr-eclipse/?source=recommended
http://sourceforge.net/projects/avr-eclipse/files/latest/download?source=recommended

I will need Eclipse on this machine, it is new and I haven't used it on this machine

Downloaded Eclipse for C programming from here:
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/juno/R/eclipse-cpp-juno-win32-x86_64.zip
Unzipped and clicked on eclipse.  Tool comes up just fine.  Hmmm.  Now what.

Opened the AVR plugin I previously unzipeed and downloaded from here:
http://sourceforge.net/projects/avr-eclipse/files/latest/download

Maybe the manual will help.  No idea how to install it
http://avr-eclipse.sourceforge.net/wiki/index.php/Documentation
OK I should have used Eclipse->Help->Install New Software.  I guess I knew that, learned that here:
http://avr-eclipse.sourceforge.net/wiki/index.php/Plugin_Download
Point to this site and click add in the install new software menu in eclipse
http://avr-eclipse.sourceforge.net/updatesite
Select and hit next a couple times

It says:
If the installation was successful you should see the entries AVR Cross Target Application and AVR Cross Target Static Library in the "New C Project" wizard.
Turns out you have to go one click into creating the C project before you see these choices.  On the first project creation you just see C project.  Pick it and the next screen you see the AVR options.
AVR->Upload to target device is also now on the menu across the top


I'll publish my notes at this point, and update the post again when I've succeeded in programming the AVR














Without using all this software, I tried using the AVR ISP Mk2 to program an Arduino, using the supplied Arduino software, version 1.0.

It worked perfectly.     You hook up the MK2 via usb,  hook the 6 pin connector to the Arduino ISP header.  Leave the USB off the Arduiono.   The bump on the ISP header goes towards the inside of the Arduino board.  Power the Arduino from an external 12V supply since it can't get power from the USB.     You hit shift before clicking on the upload button and the function changes to upload from programmer.  There are also menu buttons to do it in the pulldowns, as well as an options menu to pick which programmer you have.    Now that you are set up this way, you can also reburn the bootloader as well as program sketches a little faster than the USB method.  This is no harder than the USB method.

I had to install drivers for the MK2, which turned out to be nothing more than the standard libusb0.dll file.

I was able to rescue two old Arduino boards that wouldn't talk to the USB by reburning their bootloaders.  This worked on an Uno and an older Duelmanove.  


Thursday, July 12, 2012

Suicide for the strobe/flashlight app on Google

I decided to pull the silicon fish blinky app off the market.  At the bottom are the comments I was getting.  I can't handle the shame.  I wasn't able to test the app on other platforms because I didn't have any extra phones.  I've since got a motorola droid 4 and the LG doubleplay that I found and repaired.   If I get some spare time I'll get the app working on those and republish it.  Fun while it lasted.  Lesson learned, don't do a flashlight app unless you have access to a lot of phones because the LEDs work differently on different devices.    I gave it away free and still got trashed.  I put a disclaimer.  Oh well.

At the end I had over 2900 installs, but as near as I can tell only 300 active users after 6 months on the market.  And in case you were wondering, never made $0.01 on it.  The only way to make money is to put ads or charge for the app, neither was I willing to do.  It was a project for fun, not for public abuse.

You can still download it direct to your phone from my download page, as long as you check the box in your settings->applications->unknown sources menu on your android device.  That allows you to install apps from other than the google market.  Just navigate your phone to
http://code.google.com/p/arduino-java-xyzcnc/downloads/list and then click on SiFishBlinky.apk


or go directly to:
http://arduino-java-xyzcnc.googlecode.com/files/SiFishBlinky.apk

Here is my wall of shame  :-#


      David on Sunday, July 8, 2012 at 22:23 Huawei M865C (hwm865c) Version 1.9.16
Crap Learn to finish and test drive before Publishing
      Ben on Monday, June 4, 2012 at 22:59 Samsung Droid Charge (SCH-I510) Version 1.9.16
Does not work for Droid Charge Does not activate LED on the Droid Charge, thus making this a useless app for that device.
      George on Sunday, June 3, 2012 at 22:42 Samsung SAMSUNG-SGH-I777 (SGH-I777)
Doesn't work
      Jason on Thursday, May 24, 2012 at 01:19 Motorola DROID4 (cdma_maserati)
Does not work for droid 4
      Jon on Sunday, May 6, 2012 at 21:02 Motorola XT910 (umts_spyder)
Bad Doesnt work
      Austin on Monday, April 23, 2012 at 12:17 Motorola DROID RAZR (cdma_spyder)
Gay Doesn't turn on. There is no zero star option by the way.
      Joel on Wednesday, April 4, 2012 at 07:25 Acer Picasso (picasso) French
Acer A500 N'a pas fonctionné.
      Nahuel on Tuesday, March 27, 2012 at 21:49 Samsung Sidekick 4G (SGH-T839) Version 1.9.16
Jo Ho
      Brendan on Saturday, March 17, 2012 at 21:04 LGE Bryce (bryce) Version 1.9.16
:( Wont even turn on
      on Sunday, February 19, 2012 at 18:29 Samsung Galaxy Exhibit (SGH-T679) Version 1.9.15
GREAT Idea and no stinking ads NO ads or tracking but it just dosent work for my phone. Thanks, wish all app developers had your attitude.
      Lemuel on Saturday, February 18, 2012 at 23:58 Motorola Droid X (cdma_shadow) Version 1.9.15
A+ Can you change the background to plain black? to save battery.
      Ari on Friday, February 17, 2012 at 01:45 Motorola Droid X (cdma_shadow) Version 1.9.15
Cool app Works well, I like the fact that you can create custom patters. I also like the strobe light
      on Friday, February 10, 2012 at 19:24 Samsung Galaxy Ace (GT-S5830) Version 1.9.15 Czech
Nefunguje Naprosto nefunkční
      Daniel on Wednesday, February 8, 2012 at 01:14 LGE Optimus 2X (p999) Version 1.9.14
Sucks Doesn't work on my phone waste of time
      Zeneth on Sunday, February 5, 2012 at 12:52 Motorola Droid X (cdma_shadow) Version 1.9.14
Thanks A+

Monday, July 9, 2012

XFX 4890 Graphics card fan replacement - Shameful hack

Because of my sense of humor, I'll share my fix for a bad fan on my XFX Radeon 4890 graphics card, otherwise known as a VGA cooling fan.  Why did I do something this lame?... here is the story.




The fan began making noise, which my son ignored for many months.  Eventually the machine started randomly rebooting.   Finally it started rebooting after about every 1 minute of operation and I had to give in and figure out what was wrong.    The card was smokin' hot and the fan was not turning.  Obvious.   Here is what the card looks like with the factory fan.



I went online, and searched for a replacement fan.  Not much out there, and most of the fans did not have dimensions, or the reviews said they didn't fit.  Really hard to figure out what to buy.  I finally bought this one.  It looked like the one I had from the picture:



Doh.  Total fail.   It came in a tiny envelope and here it is next to the fan from the 4890.   WAYYYY to small.


I had no confidence that any of the other fans out there were the right size either.   I could play dialing for donuts and keep buying fans until one fit.  Nahhhhh.

Measuring the fan against a standard case fan, I saw that they were the same size.   Originally I thought I'd hack something together and ordered this case fan.



You may be able to see that the fan has three plastic spokes that attach it to the case, that could easily be clipped to remove the fan, which appears to be exactly the same size as the fan I'm replacing.  However i'd be stuck trying to figure out how to attach it to the metal heat sink with no screw holes.  Glue wouldn't work here, it would be too hot.




Since the computer case is fairly empty, and the PCI slot next door is open, I had room to simply glue the case fan over the hole to the VGA card.   I spliced the red and black wires into the old fan's connector since the case fan's connector wasn't the same size.



As soon as the glue dries it's going into the machine.  I'll update the post with how it works out.  Crossing my fingers.



Turned out if you look, the video card had a plastic film still on it from the factory, that I never had peeled off.  So my glued-on fan fell off immediately.  If you look you can see that the sticker on the top of the card is a bit hazy.  Duh.  I peeled off the protective film and used some JB weld epoxy this time.  I didn't drill holes in the black cover, because there is a metal heat sink directly underneath it.

Now I'll try again when the new glue is dry....

Success!  Here it is back in the computer.  You can see the case fan glommed on the side of the video card. Luckily that slot is not used, and the fan is away from the CPU side where it might have collided with the motherboard chipset cooler.





The computer is up and running and seems fine under normal load.  W00t!  $6 case fan saves the day.

Tom

Tuesday, June 19, 2012

Windows Security Suite virus - The most concentrated evil juice there is

My son somehow picked up Windows Protection Suite
on his PC.  It started with a a pop up, and ended up hijacking all the browsers and making
them non functional, shut off the firewall and disabled the antivirus.   It had tricked him into
clicking a dialog that downloaded the software.  Then it pretends to be a security suite and asks you for your credit card number to upgrade it to save you from all these threats it is pretending to have detected (which it caused).  Reasonable attempts to kill processes and remove files were useless, it repaired itself on reboot.   I was able to temporarily restore Chrome by renaming the file back, but that only lasted about a minute before it was swapped back. It disables virus scanner anew every time you attempt to re-install it from USB.    I was unable to do a system restore either.  I don't know how they managed  to hose that up too.  msconfig of the startup sequence didn't help either. I advocate extreme violence  against the authors of this program.


This is not my screenshot, because my PC was dead, but it looked pretty much like this.

Windows Security Suite snapshot


Some links I found.
http://www.geek.com/articles/chips/dealing-with-the-windows-security-suite-2009113/
http://www.bleepingcomputer.com/virus-removal/remove-windows-protection-suite
http://www.2-viruses.com/remove-windows-protection-suite
http://virus.geeksailor.com/how-to-uninstall-remove-security-suite-virus-removal-guide-2/
Some web searches recommended Malwarebytes and rkill.   I think they are written by Malwarebytes, to sell their software.    After initial resistance I tried Malwarebytes and rkill and it didn't work at all.  After giving in and following their directions,  I ended up with a PC that would not boot at all.   I could not even boot it from the CD or USB stick with either windows or Linux.  I've never seen this before, I've always been able to boot from linux USB, but this time, halfway through the boot, the PC goes black and reboots. A windows install from CDROM also stops after the initial load and the PC reboots.  Holy crap.

Don't waste your time if this happens to you.  This is the most evil virus I've ever seen.  I doubt that you will ever be able to clean it out.

Now I'm buying a new hard drive and starting from scratch.   My plan is to take the old hard drive out to a Linux machine and extract some of the data I want from it then reformat it.  It will never touch a windows machine again.   I will update the post once the hard drive is replaced.    Hopefully it has not done hardware damage or screwed with the BIOS too.  I will dedicate my life to tracking these people down if it has.


Update... the computer is back up and running.
The computer hard drive and all the data was a total loss.   Started over with a new drive.  However it turned out a bad fan on the video card was the true cause of the constant rebooting, and the reason even loading ubuntu didn't work.  <Red Faced>.  Odd how this problem popped up just as the computer got this crippling virus, maybe something about the virus caused the video card to work extra hard and fail, or just plain coincidence.  However when you have two problems at once, debugging and fixing become 10 times as difficult.   I solved the problem by pulling memory modules and cards one at a time until the machine was stable, since I knew the virus was gone when I replaced the hard drive.


I still think this virus is one of the worst I've ever seen, but it's not conclusive that it caused hardware damage as well.

Sunday, June 17, 2012

Telemetry logger android app


In order to make some augmented reality apps, and some other cool robot and telemetry apps, I decided to make a small app that reads out all the accelerometer, gyroscope, compass, etc sensors and logs the values to the SD card.   From there I can analyze the data and see what sort of performance to expect.

Here are some links with information I found,
http://www.sensorplatforms.com/native-sampling
http://www.sensorplatforms.com/smartphone-performance-fundamentals-sensor-sampling
http://developer.android.com/reference/android/hardware/SensorManager.html

Hard to tell what are real sensors and what are virtual.  this was the best article I found on what is actually in the phone.
http://www.mobiledevmag.com/2011/07/using-available-sensors-in-the-android-platform-current-limitations-and-expected-improvements%E2%80%A8/

Here is how to dump the sensors on the phone


SensorManager myManager = (SensorManager)getSystemService(SENSOR_SERVICE);
        List<Sensor> sensorList = myManager.getSensorList(Sensor.TYPE_ALL);
        StringBuilder sensorString = new StringBuilder("");
        for(int i=0; i<sensorList.size(); i++) {
            sensorString.append("Type: "+sensorList.get(i).getType()).append(" ---------\n");
            sensorString.append(sensorList.get(i).getVendor()).append("\n");
            sensorString.append(sensorList.get(i).getName()).append("\nResolution: ");
            sensorString.append(sensorList.get(i).getResolution() ).append("\n");
        }


That gives me this data on my motorola droid 2 global


SiFish Android Sensor Log
Android Sensors Found:
Type: 1 ---------
Kionix
KXTF9 3-axis Accelerometer
Resolution: 0.009810001
Type: 2 ---------
Asahi Kasei
AK8975 3-axis Magnetic field sensor
Resolution: 0.0625
Type: 8 ---------
Intersil
ISL29030 Proximity sensor
Resolution: 100.0
Type: 3 ---------
Asahi Kasei
AK8975 Orientation sensor
Resolution: 0.015625
Type: 5 ---------
Intersil
ISL29030 Light sensor
Resolution: 1.0
Type: 9 ---------
Google Inc.
Gravity Sensor
Resolution: 0.009810001
Type: 10 ---------
Google Inc.
Linear Acceleration Sensor
Resolution: 0.009810001
Type: 11 ---------
Google Inc.
Rotation Vector Sensor
Resolution: 5.9604645E-8

The key code is pretty simple to access the sensors.  This may not be the most efficient or fastest code yet, it is my starting point

In your onCreate do this:


mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);       mSensorManager.registerListener(mSensorListener1, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST);  
private final SensorEventListener mSensorListener1 = new SensorEventListener() {
   public void onSensorChanged(SensorEvent se) {
     text1.setText(se.sensor.getName());      Ax = se.values[0];      Ay = se.values[1];      Az = se.values[2];      long timestamp = se.timestamp;      aXProgress.setProgress((int) Ax + 50);      aYProgress.setProgress((int) Ay + 50);      aZProgress.setProgress((int) Az + 50);
                            if (sdcard.sd_ok & logging) {     sdlog(timestamp);     }    }
 public void onAccuracyChanged(Sensor sensor, int accuracy) {  }};



Writing to the SD card turned out to be more work than I thought.  It really is pretty easy, but I got hung up on a couple things.
  • AndroidManifest.xml has to have this line in it, or it will not throw errors, it just won't work.     android:name="android.permission.WRITE_EXTERNAL_STORAGE"
  • File names should avoid  "." and ":"    I was trying to time stamp the file names and put in a ":".  Failed.
  • When the phone is plugged into the PC, the SD card is shared and you can't write to it.  You have to load your app, then unplug, and run it again to make it work.
  • I used buffered stream to keep the app from waiting for the SD card, but if you don't do a flush() it doesn't write until the buffer is full.
  • If you get exceptions like "Permission Denied"  you have to collect them and find a way to view them or display them back to the user


This is the class I wrote to handle the SD card communication


public class SDcard { File sdCard = Environment.getExternalStorageDirectory(); File dir = new File (sdCard.getAbsolutePath() + "/sifish"); File destinationFile; BufferedOutputStream buffer; public String messages; public boolean sd_ok = false; public boolean checkSD() { sd_ok = false; messages = "SD card is ".concat(Environment.getExternalStorageState()).concat("\n"); if (Environment.getExternalStorageState().equalsIgnoreCase("mounted")) { sd_ok = true; } return sd_ok; } public boolean openSDFile(String filename) { boolean success = true; //messages = "SD card is ".concat(Environment.getExternalStorageState()).concat("\n"); sdCard = Environment.getExternalStorageDirectory(); dir = new File (sdCard.getAbsolutePath() + "/sifish");  dir.mkdirs(); success = dir.canWrite(); sd_ok = success; if (!success) { messages = messages.concat("Error - Can't write to "+dir.getAbsolutePath()+" directory on SD card\n"); sd_ok=false; }
try { destinationFile = new File(dir, filename.concat((String) android.text.format.DateFormat.format("_yyyyMMdd_hhmmss", new java.util.Date())).concat(".csv")); buffer = new BufferedOutputStream(new FileOutputStream(destinationFile)); messages = messages.concat("Opened "+destinationFile.getName()+"\n"); } catch (Exception e) {   messages = messages.concat("Error - Can't open file "+destinationFile.getName()+" on SD card\n");   //messages = messages.concat(e.getMessage());   messages = messages.concat(e.toString()).concat("\n");   success = false;   sd_ok = false; } return success; } public boolean closeSDFile() { boolean success = true; try { buffer.flush(); //buffer.close(); } catch (Exception e) {   messages = messages.concat("Error - Can't close file on SD card\n");   messages = messages.concat(e.toString()).concat("\n");   //messages = messages.concat(e.getMessage());   success = false; } sd_ok = false; return success;
//destinationFile.close(); } public boolean writeSDFile(String data) { boolean success = true; try { //byte[] dataByte = Base64.decode(data, Base64.DEFAULT); char[] dataChar = data.toCharArray(); for (int i=0; i<data.length(); i++) { buffer.write(dataChar[i]);   } //buffer.flush();   //doesn't write until buffer is flushed } catch (Exception e) { messages = messages.concat("Error - Can't write to SD card file "); messages = messages.concat(e.toString()).concat("\n"); success = false; sd_ok = false; } return success; } public void dirSD() { sdCard.listFiles(); }

I'm going to clean this up and publish it to android market, but meanwhile I posted the apk file to my download page.   The data is saved to your sdcard when you run a log, under the "sifish" directory.  It creates a csv file with all the data from all the sensors on the phone.

The screenshots from the emulator don't do it justice, since the emulator has no sensors and no data shows up.




Just surf your android phone to this page:
http://code.google.com/p/arduino-java-xyzcnc/downloads/list

and download
AccelerationLogger.apk

Then look on your SD card for the output files.