Search This Blog

Saturday, November 30, 2013

Samsung Galaxy S4 - USB debugging mode in Android 4.2 and higher

Back to writing android applications.

With my new Samsung Galaxy 4, there is no longer a button for USB Debug Mode!

This setting allowed aps you develop in eclipse with the android sdk to be run directly on your phone when plugged into the USB cable.  Otherwise you have to post the apk file to the web, and turn on the "allow aps from unknown sources" every time you want to test your app on a real device.  Now it's gone.

This is a long trail of notes on what I did.  For the impatient, skip to the bottom, I summed it up at the end

A little googling found this:  Google hid the feature to protect the random user.

How to find and turn on USB debugging mode in Android 4.2 and higher

To see the option for USB debugging mode in Android 4.2 or higher, do the following:
  • Open up your device’s “Settings”. This can be done by pressing the Menu button while on your home screen and tapping “System settings”
  • Now scroll to the bottom and tap “About phone”
  • At the “About” screen, scroll to the bottom and tap on “Build number” seven times.
    • Make sure you tap seven times. If you see a “You are now a developer!” message pop up, then you know you have done it correctly.
Done! By tapping on “Build number” seven times, you have unlocked USB debugging mode on Android 4.2 and higher. You can now enable/disable it whenever you desire by going to “Settings” -> “Developer Options” -> “Debugging” ->” USB debugging”.

Read more at http://dottech.org/87439/how-to-unlock-usb-debugging-mode-on-android-4-2-jelly-bean-and-higher-guide/#fAVhAE2oVbDEJwQe.99

Hmmm...

The phone says "You are now a developer".  So it clearly worked. But still not seeing the phone in Eclipse adb run chooser....
Phone says "Connected as an installer"

http://stackoverflow.com/questions/16256048/eclipse-android-sdk-cannot-see-new-samsung-galaxy-s4-device-via-a-usb-connection

same answers.  I have the drivers installed and i did the 7x.  Still nothing.

from \Local\Android\android-sdk\platform-tools
Tried
adb kill-server
adb start server
Didn't work.  Still can't see the device.

Tried these drivers...

http://www.samsung.com/us/support/owners/product/SCH-I545ZWAVZW

Nothing.

http://stackoverflow.com/questions/3908301/why-doesnt-eclipse-see-my-samsung-galaxy-phone-even-though-i-can-transfer-files

Tried installing KIES.
Kies 3Supported models : Note 3 and devices with Android 4.3.
http://www.samsung.com/us/kies/#downloadWindows

Still not showing up in adb.  Arrggh

I doesn't even show up under Unknown Devices
Although it does show up as a portable device and i can see the sd card, etc.

Tried installing the drivers in KIES manually.  No dice.

This website shows where to get drivers
http://developer.android.com/tools/extras/oem-usb.html

Tried the Moto drivers to get my old Droid 2 working again just to prove it is not eclipse.
Back to visit previous self...
http://blog.workingsi.com/2011/12/getting-started-developing-apps-on.html
2) Install the development USB driver on your Windows computerMore surfing...http://developer.android.com/guide/developing/device.html I think need to install the windows adb driver for my phone on my computer.  You need a special USB driver for developers.http://developer.motorola.com/docstools/USB_Drivers/ Clicked on Handset USB Driver for Windows 64 bit, had to register and all that junkDownloaded, installed  Motorola Mobile Drivers Installation 5.2.0Rebooted
3) Verify that you can see the phone from the computerReading the http://developer.android.com/guide/developing/device.html site again, I got some more info on how to run "adb devices". 
Turns out you run this in a command window on the windows box, after you cd over to the directory where the android sdk is installed.  Ran it there.  Duh.   Here you see the command running for me. 
You can verify that your device is connected by executing adb devices from your SDK platform-tools/ directory. If connected, you'll see the device name listed as a "device."




Or, to upgrade an existing Android USB driver on Windows 7 with the new driver:
  1. Connect your Android-powered device to your computer's USB port.
  2. Right-click on Computer from your desktop or Windows Explorer, and select Manage.
  3. Select Device Manager in the left pane of the Computer Management window.
  4. Locate and expand Android Phone in the right pane.
  5. Right-click Android Composite ADB Interface and select Update Driver. This will launch the Hardware Update Wizard.
  6. Select Install from a list or specific location and click Next.
  7. Select Search for the best driver in these locations; un-check Search removable media; and check Include this location in the search.
  8. Click Browse and locate the USB driver folder. (The Google USB Driver is located in<sdk>\extras\google\usb_driver\.)
  9. Click Next to upgrade the driver.
The old developer.motorola page is gone now.   Why is this so hard now?  I got this done in no time years ago.

Tried these drivers.  The unkown device goes away and I see a USB drive.
https://motorola-global-portal.custhelp.com/app/answers/detail/a_id/88481/action/auth

I go to the moto phone and it is now saying USB is in storage mode.  Change it to "PC mode" on the phone menu.
Drivers spin and it re-installs on the PC.  Motorola ADB Interface is listed in the things windows says is ready to use.    USB drive is gone and under network adapters in the device manager is "Motorola USB Networking Driver".

"adb devices"  returns a number for the moto phone now.  But in eclipse I still don't see it.

I tried the samsung changing usb mode to "media device" and "camera"  neither helped adb see it.
It is hung up in USB stick mode.  I don't see a listing under "Network adapters"

I scoured the settings on the samsung again.   I find under Settings->More->Developer options, there is now a button that says USB Debugging Mode.  It is unclicked.
Whaaa Daaa Faaaa???  How could I have missed that.   The secret unlock just reveals the button, I sitll have to click it.
Things start happening on the device manager, installing, etc.
Now I see SAMSUNG_Android in the Other devices for a sec until it blips out.
It doesn't like the installed samsung driver and after a few seconds, blips and goes back to being a usb stick.   


http://forum.xda-developers.com/showthread.php?t=1601739
says uninstall kies and just do the samsung drivers
Have it working - and did remember I have Kies installed.Maybe I downloaded both the separate driver and Kies?
USB Driver Link:http://org.downloadcenter.samsung.co...1_3_2360_0.exe
Kies Link:http://org.downloadcenter.samsung.co...1082_152_4.exe
Know I have problem still with Kies... but I can use ODIN without issues.I can't really explain how I did it, as there was a lot of trial and error and I wasn't keeping notes. But the basic trick was to right click in device manager on the unknown SAMSUNG_Android device, choose Update Driver, choose "Let me pick", choose "Have disk", point to the "SAMSUNG\USB Drivers\25_escape" folder from the KIES installation, and then choose "Samsung Mobile USB Composite Device".
You may then get another unknown device, which using the same method you set to ADB. I did a bunch of stuff in different ways, trying to match different drivers from the 25_escape folder to different devices, until it finally worked.
http://forum.xda-developers.com/showthread.php?t=1624166
Pull up a commandline, go to Documents and Settings\username\.android directory, and do
Code:
echo 0x04e8 >> adb_usb.ini

this is the code for samsung

Folllowed those instructions, but the usb driver folder C:\Program Files (x86)\Samsung\USB Drivers\25_escape didn't exist in my install.

Went back to the kies site and downloaded the older version of kies and installed

Not in there either.  Fail

http://www.samsung.com/us/function/search/espsearchResult.do?input_keyword=adb&keywords=adb
There is a link in the posts to the lastest adb driver.  it's broken

http://www.samsung.com/us/support/downloads/SPH-P100ZKASPR
selected the carrier and model number
Win XP/Vista/Win 7/Win 8Nov 9, 2012ENGLISH23.06
Doesn't work.

Putting the USB in "Camera" mode left the SAMSUNG_Android in the device manager.  MTP mode
makes it dissapear.  Windows tries to install a driver for it in this mode and fails.


A day of complete frustration.

http://www.mediafire.com/download/5kcxc1yovvl6740/SAMSUNG_USB_Driver_for_Mobile_Phones%282%29.exe

back to google

http://www.droidforums.net/forum/samsung-galaxy-s4/249648-issues-adb.html

Read a bunch of pages about rooting.  I'm doing everything they say.  Fail.

regroup.

Finally tried device manager one more time, right clicked on the unknown device and picked choose from compatible drivers.  Let me pick from a list.  Strangely I got a list of moto and generic adb drivers.  I picked adb composite device.  it installed with a warning.

Now adb devices gives me a response!  Device manager other device dissapeared . So it might not be healthy yet.  ADB Interface device showed up on top of the device manager.

I run ecllipse and I suddenly have a device!   it looks a little broken but finally something is happening.


I find I can't select it.  OK is greyed out .

Try switching to one of the moto composite drivers.  Requires rebooting.  Fail.  Now it has dissapeared again.

Went back to the single composite ADB sooner driver on the list.

Tried to figure out why it was unauthorized

http://stackoverflow.com/questions/19485467/adb-wireless-device-unauthorized

The phone had never asked me to authorize.  I went to the developer settings menu on the phone.
Uncliked usb debug.  Pressed the button that says revoke permissions.   Unplugged the phone.
Plugged it back in, re-enabled usb debug and tadah!  It asked me to give the computer permission.
I did so and and adb devices now says the device is there!

It works!!! OMG.  This was the biggest pain in the arse.  Eclipse now reports the phone there.



I don't know if anyone could follow my notes, and i'm too fed up to clean them up.
The gist is this.

  • 7 pushes on build to enable the developer menu in the phone info screen
  • Go to the now visible developer menu and select USB debugging
  • Install the samsung usb drivers.  Don't know which version really did it, if any.  From Kies or from their website
  • Plug in the phone
  • Tell the USB to go to "camera" mode
  • Go to windows device manager and right click on the unknown samsung device
  • Select browse and select from list
  • Pick adb single sooner driver
  • Go back to the phone developer menu and unauthorize devices.  plug it in again and it should ask to allow the computer to connect.  Say yes.
  • Win!


Saturday, November 2, 2013

Sony VAIO SVT13112FXS ultrabook blue screen caused by iastor.sys

My beloved Sony VAIO ultrabook laptop, model SVT13112FXS (SVT131A11L) is crashing every 10 minutes or so, even if it is idle, with a blue screen (BSOD).   Blue screen says the problem is related to iastor.sys .    This machine runs Windows 7.

This machine has a hard drive and a solid state cache drive and iastor.sys is the intel RAID driver that allows the computer to use two drives as if it is a single drive, do fast caching, etc.



This all started after I left the machine behind at home on an international trip.   Normally it is my travelling companion, but this time I didn't want the hassle of taking two laptops through security.  I left it at home, unplugged, and probably in sleep mode.  The battery drained completely and when I returned it was lifeless.   I plugged it in and it complained that windows wasn't shut down properly but otherwise initially everything seemed OK.  After 10 minutes of use, the blue screens started.

In the end the fix was to replace the SSD cache drive.   This is a hardware problem, not a software problem.  Not a difficult repair.  Involved unscrewing the back cover and pulling out one module and buying a replacement off eBay for $35. A little fooling around with the BIOS and Intel Rapid Store Software and all is good.

Here is the whole debug trail...

Possible causes
  • iastor.sys (Located in C:\windows\system32\drivers\iastor.sys) is corrupt
  • A hardware problem with one of the disks
  • Malware (this is a favorite vulnerability among hackers)
  • Virus scanner killing the machine on purpose when it finds something it can't fix

Here is what I tried
  • System restore to older time.  Didn't solve the problem, and I regressed to before I started having the issue.  
  • Ran chkdsk (right click on the drive, tools, check disk) and schedule a scan, reboot.  chkdsk fails in the middle with the BSOD and it reboots endlessly scanning and crashing.
  • I removed the hard drive and put it in another machine and ran chkdsk.  Completed and found no errors.  But it back in the laptop and still crashes
  • Ran sfc /SCANNOW which completes, and says no errors.   Still crashes.
  • Downloaded and ran tdsskill.exe from Kaspersky.  This is supposed to catch malware that poses as iastor.sys.   It ran and found no problems.
  • Ignore all the lies about rkill, malwarebytes, etc.  Those programs have never worked for me and you end up getting more malware on your machine.
  • Full virus scan of the disk from another machine.  It's clean
  • Msconfig, went through and stopped every process from the start menu that I didn't recognize.   Didn't help
  • Tried to replace the iastor.sys files by hand.  My other computers don't have this file to copy from since they don't have a RAID.  
  • Renamed the iastor.sys to iastor.sys.X.  Now the machine won't load windows.  It wants to do startup repair but eventually BSOD's into the same screen.  Dead end. 
  • Put the drive back in another machine and restored the iastore.sys and iastorV.sys files from a previous version
  • Went to https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=17882 to download iastor.sys from Intel.  None of the packages recent packages contained a 64 bit iastor.sys, just various versions like iastorV.sys, iastorF.sys.  WTF?
  • Downloaded IATA89CD.exe from above site and ran.  This is supposed to contain the Intel Matrix Storage Manager.  It is dated 2009 it seems, don't know how this could be the right file.   A window pops up and says the computer has version 11.0.0.1032 and the installer wants to overwrite with 8.9.0.1023.  Seems wrong.  Plowing ahead.  It installs OK and reboots.
  • Won't start windows anymore.  Bombs  Lovely.  Startup repair wants to run and restore the machine to an earlier point.  Fail.  Didn't let it regress but startup repair failed.
  • Rebooted and tried startup repair again. Fail.  However the machine did not load windows, and I got another BSOD for iastor.sys.   Now i'm stuck in a loop of BSOD and startup repair.  
  • Eventually it lets me do a system restore and back out the changes to an earlier time.  Finally it boots to windows but I'm back where I started with repeated BSODs.
  • May have downloaded the wrong thing.  Searched again and found this:  https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&ProdId=2101&DwnldID=23060&keyword=intel+rapid+Storage+Technology+(Intel+RST)&lang=eng
  • Installed it successfully.  Restarted the computer.  windows boots.  Now I have multiple versions of iastor.  iastorF.sys, iastorV.sys, iastorA.sys, as well as iastor.sys.   Letting the computer sit for a while to see what happens.  Boom BSOD.  Fail.
  • This must be a hardware problem since I've done everything conceivable to fix iastor.sys
  •  I want to try disabling the cache drive in the BIOS.  Drive may be malfunctioning.  F2 at the black sony screen is the way to get to BIOS:  https://us.en.kb.sony.com/app/answers/detail/a_id/35240.   Can't find any way to access the disk drives in the BIOS!  WTF?  BIOS has been nerfed.
  • I need to pull the cache drive.  Went hunting for it.  Unscrewed the three large screws on the battery and removed the battery.  THree screws to remove the hard drive cover.  Unscrewed the hard drive too, four more screws. (did this previously because I had put it in another machine).  Opened up the back panel by removing all the small black screws around the outside edges on the bottom and two silver ones in the battery compartment.  The bottom cover pops off with a little prying.
VAIO with the battery and hard drive removed

VAIO with the back cover removed.  The PCIe SSD cache drive is the small green circuit board on the top edge towards the left.
  • Found the SSD cache drive.  The little module at the top edge near the WLAN module.  Removed one screw and pulled it out.  It is about 2.5 inches by 1.5 inches with two samsung chips on it.
Removed Samsung SSD

SSD flipped over, the part number is on the bottom side


  • reBooted and I get a disk drive BIOS menu now!  It noticed something changed.  
  • First attempt I tried to just bypass the bios screen, I get "operating system not found"  Power off and restart.
  • Next I try <Ctrl I> when it asked me and it tells me the cache volume is not present.  Do I want to disable it?  Bingo.  Answer yes.
  • Computer boots to windows.  A lot slower now. too bad.   But it works!
  • If this fixes the problem I will have to decide if I'm going to buy a replacement cache drive, live with the slower boot, or buy a single SSD drive and figure out how to reload windows from scratch.
  • So far so good.  System is stable.  It is no longer BSOD every few minutes.   Problem is I don't really know if the problem is the cache drive hardware or the software that talks to it.   Since I removed the drive, both are gone now.   Seems like I fully explored the software corruption angle, but it is impossible to be sure it wasn't a related file that expressed itself as an iastor.sys BSOD.
  • Found a used replacement 32GB drive on ebay, they are pulls from used equipment.  Prices vary from $29 to $49 for a new one.  Many are shipped from the far east.  
  • Found some refurbs from US sellers
  • http://www.ebay.com/itm/151116902504
  • Pulled the trigger for $35.  I figured it is worth the risk.  If the problem returns, then it isn't the hard drive and I can resell the part on eBay.
  • I will update the post when the new part comes.  Meanwhile I'm back in business without the cache drive.  Computer works normally, it is just slower to boot and hibernate.  24 hours plus and still going without a BSOD.
  • New part came in the mail.  Looks identical to the old one.
  • Opened the laptop back up again
  • Plugged in the replacement drive.
  • Rebooted.  Now it noticed something was different and the disk BIOS menu came up, 
  • and I pressed Ctrl I to configure as i did before.
  • I tried options 1 and 5 and both said Error.  "Not enough available space to create a volume".  I eventually I just exited and it booted normally.  I'm not sure if the caching is going to automatically turn back on.
  • Hard to tell if cache is working
  • Rebooted again and the BIOS menu came up again.  Dang.  It still says "Disabled" next to the cache drive.  Can't find out how to enable it.  When I disabled it before it was obvious, but I didn't take a picture.
  • Disk shows up in windows under computer management but no options to enable it are obvious 
  • Re-installed the windows RAID driver software I downloaded above   https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&ProdId=2101&DwnldID=23060&keyword=intel+rapid+Storage+Technology+(Intel+RST)&lang=eng
  • From Windows:  Start->All Programs -> "Intel Rapid Storage Technology"  
    • Status "Your system is functioning normally" and I see the a 30GB RAID array with 11 and 19GB sections. 
    • A message at the bottom says "Acceleration using solid state drives: Disabled" and please reconnect the the accelerated disk or volume..
    • Indicates that the drive is no longer accessible. 
    • In the manage menus 
      • Turned off and disabled the SSD cache, reset the drive
      • Tried to re-enable accleration, it says I must reboot
    • rebooted
  • Reentered Intel Rapid Storage Technology-> Performance, and turned on Acceleration!   
  • Now it works.   W00t!
  • It appears I had to clear out all the old data on the refurb drive and re-associate it.   I think it was looking for the old drive ID.  Looks like I'm back in business.  
  • Soaking to see if it crashes.  So far so good.  24 hours + and no BSOD.
  • Victory declared!