Analysis & Opinion

Top Forum Discussions

[Q] HELP: Android USB debug mode works in Windows not in Ubuntu

16 posts
Thanks Meter: 5
By harshaxdadevelopers, Junior Member on 1st November 2012, 08:37 PM
Post Reply Subscribe to Thread Email Thread
The Android device in question is a Micromax A87(a relatively unknown brand in global market but I hope that should'nt matter).

In Ubuntu, I have double checked the udev rules. They all look perfect. (I cross checked using another phone too). The USB debug mode doesn't show up no matter what. And I have the adb_usb.ini in the right place. I have tried running all possible combinations of running
adb, adb start-server as root. But

adb devices
shows no devices at all.

However, with the USB debugging option enabled on phone, it worked on Win7 after windows installed a Common handset driver.

Now the interesting part.
If I go back to Ubuntu without disconnecting the cable and do
$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
1234567890ABCDEF	device
The product id is 1234567890ABCDEF and I am able to see it and everthing works fine!!
But the moment I disconnect the USB cable, its gone.

So I guess it's not the development machine that is at fault. The device seems to be setting a property while in Windows which stays latched till the usb connection goes off.

What could be a way to get this to work? (Besides developing on Windows )

Btw the
is 1 too.
Last edited by harshaxdadevelopers; 1st November 2012 at 08:40 PM. Reason: Grammar
The Following 2 Users Say Thank You to harshaxdadevelopers For This Useful Post: [ View ]
2nd November 2012, 12:33 AM |#2  
Senior Member
Thanks Meter: 518
What is your computer setup? Are you using a Windows machine, with Ubuntu in a vm? Dual-boot? Other?
2nd November 2012, 08:45 AM |#3  
OP Junior Member
Thanks Meter: 5
My setup:
Dual boot.
Ubuntu 12.04 and Windows 7.
2nd November 2012, 06:30 PM |#4  
Senior Member
Thanks Meter: 518
Ok, how about if you plug in the USB with the computer's power off, then boot into Ubuntu?
6th April 2013, 11:16 PM |#5  
Senior Member
Thanks Meter: 49
i have the clone of this phone. mine is Mito A78.
lsusb command shows it as 1c9e:9e08
so idVendor =1c9e and idProduct = 9e08

for now, what you say (plugin to windows and reboot to ubuntu without unplug the phone) is the solution.
i will see if lsusb output still the same.

okay, have checked on windows pc, it should be switched to idVendor =1c9e and idProduct = 9e18

anyway, what you say is a clue that the solution may be around usb_modeswitch and modem manager

further search on usb_modeswitch 1c9e 9e08 found the solution here:

have tried, but not yet switched to idVendor =1c9e and idProduct = 9e18

have to find the correct rules on /etc/usb_modeswitch.d/1c9e:9e08
# Mito A78





found it.

after writing the rules, insert
# Mito A78
ATTR{idVendor}=="1c9e", ATTR{idProduct}=="9e08", RUN+="usb_modeswitch '%b/%k'"
to /lib/udev/rules.d/40-usb_modeswitch.rules
i than have to run
sudo usb_modeswitch -v 0x1c9e -p 0x9e08 -S -R -W
and then the phone switched to idVendor =1c9e and idProduct = 9e18 and adb can access the phone.
Last edited by jurben; 7th April 2013 at 03:51 AM. Reason: find out the solution
The Following User Says Thank You to jurben For This Useful Post: [ View ]
16th April 2013, 03:02 PM |#6  
Junior Member
Thanks Meter: 5
I-mobile IQ 5.1 has same issue, but adb still can't see device
The usb_modeswitch is exactly the same for this phone (same usb vid/pid). However adb still doesn't find the phone under Windows and Ubuntu. lsusb shows the product id switch did work and it all looks right.

Under windows it spins up a cdrom device from the phone so you can install the windows drivers (this lives as an *.iso file under /system); after the driver install, you get the adb device in device manager and two com ports,with all devices having a pid of 9e18 (original 9e08). However adb does not see the device!

I recon there is something wrong on the phone side. This is a very new phone (only release about 5 days ago), so I suspect this is one of the early release bugs...

Since I don't even have a custom recovery for it (CWM, etc) I can even backup my phone and try and do a factory reset.
17th April 2013, 04:31 AM |#7  
Junior Member
Thanks Meter: 5
Looks like a low level USB issue
Switched on tracing on adbd on the phone side. Looks like a phone/usb low level issue:

--- adb starting (pid 14270) ---
system/core/adb/adb.c::main():Handling main()
system/core/adb/adb.c::adb_main():Local port disabled
system/core/adb/usb_linux_client.c::usb_init():failed to open /dev/android_adb_enable
system/core/adb/usb_linux_client.c::usb_init():[ usb_init - starting thread ]
system/core/adb/adb.c::adb_main():adb_main(): pre init_jdwp()
system/core/adb/jdwp_service.c::jdwp_control_init():jdwp control socket started (5)
system/core/adb/adb.c::adb_main():adb_main(): post init_jdwp()
system/core/adb/adb.c::adb_main():Event loop starting
system/core/adb/usb_linux_client.c::usb_open_thread():[ usb_thread - opening device ]
system/core/adb/usb_linux_client.c::usb_open_thread():[ opening device succeeded ]
system/core/adb/usb_linux_client.c::usb_open_thread():[ usb_thread - registering device ]
system/core/adb/transport.c::register_usb_transport():transport: 0x11364a0 init'ing for usb_handle 0x1136410 (sn='')
system/core/adb/transport_usb.c::init_usb_transport():transport: usb
system/core/adb/transport.c::register_transport():transport: (null) registered
system/core/adb/transport.c::transport_registration_func():transport: (null) (10,11) starting
system/core/adb/transport.c::output_thread():(null): starting transport output thread on fd 11, SYNC online (2)
system/core/adb/transport.c::dump_packet():fd=11: to remote: [SYNC] arg0=1 arg1=2 (len=0)  
system/core/adb/transport.c::transport_socket_events():transport_socket_events(fd=10, events=0001,...)
system/core/adb/transport.c::dump_packet():fd=10: from remote: [SYNC] arg0=1 arg1=2 (len=0)  
system/core/adb/adb.c::handle_packet():handle_packet() SYNC
system/core/adb/transport.c::dump_packet():fd=10: to remote: [SYNC] arg0=1 arg1=2 (len=0)  
system/core/adb/transport.c::output_thread():(null): data pump started
system/core/adb/usb_linux_client.c::usb_read():about to read (fd=9, len=24)
system/core/adb/transport.c::input_thread():(null): starting transport input thread, reading from fd 11
system/core/adb/transport.c::dump_packet():fd=11: from remote: [SYNC] arg0=1 arg1=2 (len=0)  
system/core/adb/transport.c::input_thread():(null): transport SYNC online
system/core/adb/jdwp_service.c::jdwp_process_event():Adding pid 11279 to jdwp process list
system/core/adb/jdwp_service.c::jdwp_process_event():Adding pid 11325 to jdwp process list
system/core/adb/jdwp_service.c::jdwp_process_event():Adding pid 11818 to jdwp process list
system/core/adb/jdwp_service.c::jdwp_process_event():Adding pid 13994 to jdwp process list
system/core/adb/jdwp_service.c::jdwp_process_event():Adding pid 13951 to jdwp process list
system/core/adb/jdwp_service.c::jdwp_process_event():Adding pid 13913 to jdwp process list
system/core/adb/jdwp_service.c::jdwp_process_event():Adding pid 13856 to jdwp process list
system/core/adb/usb_linux_client.c::usb_read():ERROR: fd = 9, n = -1, errno = 5 (I/O error)
system/core/adb/transport_usb.c::remote_read():remote usb: read terminated (message)
system/core/adb/transport.c::output_thread():(null): remote read failed for transport
system/core/adb/transport.c::output_thread():(null): SYNC offline for transport
system/core/adb/transport.c::dump_packet():fd=11: to remote: [SYNC] arg0=0 arg1=0 (len=0)  
system/core/adb/transport.c::output_thread():(null): transport output thread is exiting

---------- Post added at 04:31 AM ---------- Previous post was at 04:27 AM ----------

I also tried the Chainfire adbd insecure and its exactly the same in the debugging.
The Following User Says Thank You to spicysomtam For This Useful Post: [ View ]
17th April 2013, 07:32 AM |#8  
Junior Member
Thanks Meter: 5
Now working on win7 64!
Followed this link and managed to get it working. The PID value was set to 9e18. In essence the andriod usb driver was missing (install via the andriod.bat andriod package manager).

Also works in virtualbox winxp vm on Linux (ubuntu 12.10; actually Mint 14). Just mapped in my win7 64 partition to get access to the andriod sdk/usb driver.

Now that I know its not a handset issue, can return to trying to get the Linux side working.
17th April 2013, 09:47 AM |#9  
Junior Member
Thanks Meter: 5
Now working under Linux!
You need the vendor id in adb_usb.ini:

cat ~/.android/adb_usb.ini 
# USE 'android update adb' TO GENERATE.
If you will run adb as root, make sure you also create the file for root too.

Tip: You will be logged into the phone as the 'shell' user. Try and 'su -' to get root access, and then click on your su dialog on the phone to grant access.

Final issue is that plugging in the device should do the switch automatically; I will update you on that when I have that fixed.
The Following 2 Users Say Thank You to spicysomtam For This Useful Post: [ View ]
17th April 2013, 03:13 PM |#10  
Junior Member
Thanks Meter: 5
udev sorted on ubuntu
Ok, we are rocking on udev on ubuntu 12.10. Seems like udev doesn't like ATTR keywords, although ATTRS makes everything burst into life (man page says ATTR is useable). Steps that worked for me:

# cp /lib/udev/rules.d/40-usb_modeswitch.rules /etc/udev/rules.d/usb_modeswitch.rules
# vi  /etc/udev/rules.d/usb_modeswitch.rules
Add the following entry near the bottom under the last entry:

# I-Mobile IQ5.1
ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e08", RUN+="usb_modeswitch '%b/%k'"
Create /etc/usb_modeswitch.d/1c9e:9e08 as described earlier by jurban.

Unplug the phone. Plug it in. Do an lsusb. Firstly shows up as dev 1c9e:9e08. Enter lsusb again. Shows up as 1c9e:9e18. Now adb will show the device as jurban shows above. All good to go!
The Following 2 Users Say Thank You to spicysomtam For This Useful Post: [ View ]
Post Reply Subscribe to Thread

adb, ubuntu

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes