Tuesday, July 3, 2012

USB OTG on a Sony Live With Walkman

I have a nice Android phone – the Sony Live With Walkman, affectionately called the ‘LWW’. The phone specs state that it has USB OTG – USB On-the-Go. OTG is a funky specification that allows phones (and other devices) to act both as a slave (so you can connect it to your computer an use it as external storage) or as a host. The host mode potentially enables you to use mice, keyboards, USB flash disks, and a whole host of other cool USB peripherals.

Now some phones have hardware that supports OTG, but it is not enabled in software. Presumably, this was because support for this was not widespread at the time of manufacture and the phone company didn’t want to go through the extra headache. Who knows! Anyway, other phones, like the LWW, support OTG natively, and you can simply plug in a mouse or a keyboard and use it with your phone. Of course you need an appropriate cable – apparently the Nokia CA-157 works fine (though I haven’t actually tested it).

Where I currently live, a USB OTG cable is not easily available, however, it isn’t really all that difficult to build your own. All that is needed is a USB Micro-B male (the same kind that your phone charger has) and a USB A-type female. Connect the four USB wires (Vcc, Gnd, D+, D-) between the connectors. You’ll notice that the Micro-B has got 5 contacts; one of these contacts is the ‘ID’ pin. If this pin is left unconnected (as is the case in a regular USB cable) the phone stays in slave mode. If, however, the ID pin is connected to Ground, the phone switches to host mode.

 Pics
1:Vcc (5v)  2:D-  3:D+  4:Gnd (on type A), ID (on Micro B)  5:Gnd (on Micro B)

In the cable I made for myself I brought out the ID pin and the ground pin to a berg header. Now, if I want the device in host mode I jumper the header. If I want to use the cable as a regular USB cable, I simply disconnect the jumper (naturally, I’ll need a male-to-male USB cable for this).

DSC02506
My OTG cable. I bought a Nokia CA101D and cut the end off it.
Yeah, I’ve still got to encapsulate it properly.

Once my cable was ready I just plugged in a mouse and a keyboard using a USB hub. Both devices were detected immediately and I had absolutely no problems with them. USB flash drives were another story. Getting them to work was a total PITA, but then that was the point of this whole exercise :-P The process far from painless and the reason I’m documenting it is twofold – one: so that others may read this post and find it helpful; and two: a log, just in case I have to go through this again and I forget how I did this in the first place.

1. The first step is obviously to have a working USB OTG cable. Test it out with a mouse. If it works you’re good to go.

2. The next step is to root your phone. I followed the exact instructions noted in the first post of this thread. This is a nice method since you don’t have to unlock the bootloader (unlocking leads to a whole host of other problems – DRM keys get wiped, etc). Rooting itself was relatively painless; what took time was getting the damn ‘Windoze’ drivers to work. If you have Android’s PC Companion installed, then all the necessary drivers should have been installed by default. However the ADB (Android Debug Bridge) drivers did not install on my PC and I spent the better part of the morning trying to get it to work. I finally had to manually point Windows to the file (sa0102adb.inf) and force the install.

3. To check if the phone is truly rooted, scroll though the installed apps and search for the ‘Superuser’ icon. If you find this icon, it means you’re doing fine.

SUA rooted phone. See the first icon?

4. Install busybox.

5. Now download the USB Host Controller app (v0.44 at the time of writing this) from the Android market. Once installed, run it. The app will ask for superuser access. Once you grant it you’ll be presented with a wait screen (this took about 1 minute of waiting on my phone).

6. Connect your flash drive through the OTG cable. Ignore any ‘Unsupported device connected’ message. Click on the ‘USB’  tab. The flash drive should show up in the listing under ‘Connected Mass storage Devices’. Click on ‘mount’. I mount it to ‘/sdcard/ehdd’ so that AirDroid (which is a non-root file explorer) can read the files. However, if you use ES File Explorer or any other root browser you can mount the flash drive to a partition of your choice.

No cable connected           Cable connected
A: No OTG cable connected                       B: OTG Cable connected

Nothing connected           Unsupported Device
C: No USB devices connected                       D: The ‘error’ message

Note 1: I also tried using this method, which is actually a bit convoluted. The kernel Module Loader loaded usb-storage.ko fine, and Q5 USB Memory Manager would appear to mount my flash disk, but for some reason I couldn’t see the mounted folder using even a root explorer.

Note 2: when I first used this app it took a while to load the menu screen, but after that I was able to mount my drive properly. At the time of installing, I was also checking out other OTG mounting apps – Q5+Module Loader+usb-storage.ko . When I found that UHC worked fine, I uninstalled the other apps. Subsequently UHC would only show me that a USB device was present, but would not show the mounting option. I tried using UHC v0.42 as well. No go. Installing Module Loader and reloading usb-storage.ko was the fix. Q5 isn’t required.

Mount
This screen shows detected USB devices.
The lower half shows which of those are mass storage type.

Note 3: the first time I tried mounting the flash drive I got a “mkdir failed for –p” error. A simple workaround to this it to create the folder ‘ehdd’ yourself using a PC. Just plug your phone into the PC (using a regular cable) and make a new folder on the SD Card. After this I had no problems.

Read Only
Another ‘error’. My card as well as the folder are write enabled

Anyway, now I can watch movies off flash drives, copy data from a friend’s HDD all on the move! Word of caution – don’t run very power hungry devices directly off the phone. You won’t damage it, but it’ll get hot real quick and the battery will run out of juice superfast.

DSC02505
Mounting a flash disk

The tools used are pretty generic (if I can use that term) and support a large number of devices. I don’t know why but OTG functionality is still relatively uncommon. I would think that phone manufacturers would have advertised the heck out of it. Or maybe they’re waiting to sell you a ‘value adding upgrade’ at some later date :-/

33 comments:

  1. thanks man, its work on my rooted se lww ics, may I spread this tutorial on my etnic languange?..#salambloger

    ReplyDelete
    Replies
    1. Definitely! :-) Good to hear that you found it useful.

      Delete
    2. i am trying to root my sony LWW with (DooMLoRD_v1_ROOT-zergRush-busybox-su )busybox is not installing and saying the same replay "no such files available, pls help me

      Delete
    3. This is the message while i try to run the runme.bat file
      --------------------------------------------------
      CONFIRM ALL ABOVE THEN
      press any key to continue. . .
      --- STARTING ---
      --- WAITING FOR DEVICE
      --- cleaning
      rm faild for *, No such file or directory
      --- correcting permissions
      unable to chmod /data/local/tmp/zergRush: No such file or directiory
      --- executing zergRush
      /system/bin/sh: ./data/local/tmp/zergRush: not found
      --- WAITING FOR THE DEVICE TO RECNNECT
      if it get stuck over hear for a long time then try:
      disconnect usb cable and reconect it
      toggle "USB DEBUGGING"(first disable it then enable it)
      --- DIVICE FOUND
      --- pushing busybox
      3270 KB/s (1075144 bytes in 0.321s)
      --- correcting permissions
      ---remounting /system
      mount : permision denied (are you root?)
      --- copying busybox to/system/xbin/
      /system/xbin/busybox/: cannot open for write: read-only file system
      --- correcting ownership
      unable to chmod /system/xbin/busybox: No such file or directory
      --- correcting permissions
      unable to chmod /system/xbin/busybox: No such file or directory
      --- installing busybox
      /system/bin/sh: /system/xbin/busybox not found
      --- pushing SU binary
      faild to copy 'files\su' to'/system/bin/su':Read-only file system
      --- correcting ownership
      unable to chmod /system/bin/su:nosuch file or directory
      --- correcting symlinks
      rm faild for /system/xbin/su, Read-only file system
      link faild Read-only file system
      --- publishing superuser app
      faild to copy'files\superuser.apk' to 'system/app/./auperuser.apk': Read-only
      file system
      --- cleaning
      rm faild for *,no such file or directory
      ---rebooting
      ALL DONE!!!

      *This is happen while i am trying to root
      *i done all steps in the bat file
      *my phone model number:-wt19i(sony live with wlkman)
      *android version:-4.0.4
      *kernal version:-2.6.32.9-prfBuilduser@buildhost#1
      *build number 4.1.b.0.431
      *i haven't flashed my ram
      *my phone is running on ICS
      pls help me
      tell me what are the steps ineed to follow

      Delete
    4. use flashtool to flash new rom that is 2.3.4 , than use above doomlord it work for sure, thats what i did..

      Delete
    5. go to ::www.youtube.com/watch?v=HcwNI0lNmUQ

      Delete
  2. Is there any way to do this without rooting the device. I heard that, rooting the device, voids warranty. I may try rooting after warranty period. but, until that, is there any other way?

    ReplyDelete
    Replies
    1. Some companies have a clause that rooting voids the warranty, others state that unlocking the bootloader voids it. If your phone's manufacturer states the latter, then you're absolutely safe. In case the manufacturer states the former, then the program linked on the blog (http://forum.xda-developers.com/showthread.php?t=1346198) also allows you to unroot your phone. There's no way the warranty guys can tell if your phone's been rooted and then unrooted. Unless ofcourse there are tell-tale signs of programs that require SU access.

      Delete
  3. Hi Rohit,
    Thanks. Do you have any idea about how to get WiFi Direct in Live with Walkman? In phone spec it is mentioned that LWW supports WiFi Direct.

    ReplyDelete
  4. Even after loading the usb module i'm not able to mount the pendrive. my pendrive is only shown in connected devices. i even tried other modules such as these http://forum.xda-developers.com/showthread.php?t=1588940..but no results!!

    Please help me...BTW I'm running android 4.0.4 build 4.1.B.0.587
    Thank You

    ReplyDelete
    Replies
    1. I'm not sure what the exact problem with 4.0.4 is but I was having a similar issue. Have a look at 'Note 2' in the post.

      Delete
  5. Hey Thanks a lot! Ill definately try this! Is there any forum or something where i will constantly be getting news/tips n trics etc about LWW??

    ReplyDelete
    Replies
    1. Not that I know of :-/ Though you could check out XDAdevelopers for general updates.

      Delete
    2. Visit http://www.xperiapoweruser.com/ for xperia 2011 Updates

      Delete
  6. http://www.xperiapoweruser.com/xperia-live-with-walkman-usb-otg-mass-storage/

    Visit http://www.xperiapoweruser.com/ for xperia 2011 Updates

    ReplyDelete
    Replies
    1. ^^Cool! Got it working finally huh?

      Delete
    2. yeah you should use USB OTG Helper too. Its far better than USB host controller app

      Delete
    3. when ic onnect, it display "nNo drives found" in usb otg helper

      Delete
  7. Hello bro, me having a se lww 2.3.4, kernal 2.6.32.9. I have two doubts,
    (1) checking the otg cable. you told to check with a mouse. When this done? I mean before rooting or after. And which cable is used? Hosted or normal?.
    (2) which cable mode is used for rooting?, hosted or normal?.
    Pls reply I am new to these things.

    ReplyDelete
  8. Good article! I am agree with the publisher's thoughts and opinions.
    Personal data deletion scenario is generally an Inconvenience for the end user.
    However for the ease of consumers, Specialists developed an alternative for loss of data situations.
    Consumer need to be well aware of the available information retrieval methods so that he is able to handle the data removal scenario in a much best way.
    repair corrupt pst file

    ReplyDelete
  9. Hi there, I found your blog via Google while searching for such kinda informative post and your post looks very interesting for me. hdmi cables

    ReplyDelete
  10. Hey there Sir, i've recently rooted my LWW but the bootloader is locked and i wanted to connect to connect A pendrive so i read ur blog....ive done as u said but it isnt working....my Android version is the STOCK ICS version rooted.....it jus occured to me dat shluld i flash my rom(ICS STOCK) to custom CM 10 nightly or any of dat sort to gain d advantge of connecting a pendrive???...WHat's android version????....REPLY ASAP!!!
    THANKS....

    ReplyDelete
  11. Has any1 tried printing through lww? I used a method shown on youtube,but printer cable is not read.

    ReplyDelete
  12. sargam electronics is the best Electronics company in delhi-ncr. if you need any electronic items than follows our website Sargam

    ReplyDelete
  13. Thank you for sharing this information and Very good looking blog on otg cable

    ReplyDelete
  14. Using an OTG Pen drive drive is not a rocket science and anybody can use it without undergoing any formal training or browsing user instructions. It has the convenient plug and play design where you can plug the pin in the slot provided on the device and it is ready to use.

    ReplyDelete
  15. Thanks for the information. Hope devotes will be careful after reading this post.Regards

    Cell Phone Covers

    ReplyDelete
  16. Some phones and tablets do not support this function so it is wise to search the web to find if your device is compatible with this function. I explained a little as to why I was looking for an alternative to buying one online and let me go a little more in depth as to why I chose the DIY route. The top two reasons are, it would be cheaper and I wouldn't have to wait for it, You can make one for under 2 dollars with stuff you more than likely have lying around your house! USB OTG (USB On The Go) is a standard that enables mobile devices to talk to one another. Traditionally mobile devices could only connect to a Mac/PC by USB, but USB OTG makes it possible for devices to connect directly to each other.And that's not all USB OTG can do. By enabling your device to act as a USB host – that is, to be the boss of other devices that you connect to it – you can use additional hardware such as storage, keyboards or even musical instruments together with your handset.

    ReplyDelete
  17. Nice idea. very usefull. thanks for sharing. But nowadays we are geeting this usb cable in market also with reasonable prices only.

    Sameera.
    Mobile cases and covers Designer.

    ReplyDelete
  18. This is an incredible rousing article.I am essentially satisfied with your great work.You put truly exceptionally accommodating data. Keep it up. Continue blogging. free calling app
    Talk to strangers

    ReplyDelete

Visitors