Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,736,817 Members 53,963 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
harshaxdadevelopers
Old
(Last edited by harshaxdadevelopers; 1st November 2012 at 08:40 PM.) Reason: Grammar
#1  
Junior Member - OP
Thanks Meter 5
Posts: 16
Join Date: Jan 2011
Prompt [Q] HELP: Android USB debug mode works in Windows not in Ubuntu

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

Code:
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
Code:
$ 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
Code:
/data/property/persist.service.adb.enable
is 1 too.
The Following 2 Users Say Thank You to harshaxdadevelopers For This Useful Post: [ Click to Expand ]
 
post-mortem
Old
#2  
Senior Member
Thanks Meter 521
Posts: 1,488
Join Date: Oct 2012
What is your computer setup? Are you using a Windows machine, with Ubuntu in a vm? Dual-boot? Other?
XDA-Developers was founded on the simple principal that SHARING IS GOOD and when many people SHARE what they know, EVERYONE benefits. We exist upon this Ethos, we RESPECT each other, we SHARE with each other, we do not judge one another and we HELP all who ask. We believe that while some may have more knowledge than another, none are more important.
----------

> 10 Nandroid backup
> 20 Flash experimental .zip
> 30 IF (works) THEN GOTO 50
> 40 Nandroid restore
> 50 Eat cake
 
harshaxdadevelopers
Old
#3  
Junior Member - OP
Thanks Meter 5
Posts: 16
Join Date: Jan 2011
My setup:
Dual boot.
Ubuntu 12.04 and Windows 7.
 
post-mortem
Old
#4  
Senior Member
Thanks Meter 521
Posts: 1,488
Join Date: Oct 2012
Ok, how about if you plug in the USB with the computer's power off, then boot into Ubuntu?
XDA-Developers was founded on the simple principal that SHARING IS GOOD and when many people SHARE what they know, EVERYONE benefits. We exist upon this Ethos, we RESPECT each other, we SHARE with each other, we do not judge one another and we HELP all who ask. We believe that while some may have more knowledge than another, none are more important.
----------

> 10 Nandroid backup
> 20 Flash experimental .zip
> 30 IF (works) THEN GOTO 50
> 40 Nandroid restore
> 50 Eat cake
 
jurben
Old
(Last edited by jurben; 7th April 2013 at 03:51 AM.) Reason: find out the solution
#5  
Member
Thanks Meter 36
Posts: 92
Join Date: Sep 2012
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: http://www.draisberghof.de/usb_modes...php?f=3&t=1351

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
Code:
######################################################## 
# Mito A78

DefaultVendor=0x1c9e
DefaultProduct=0x9e08

TargetVendor=0x1c9e
TargetProduct=0x9e18

SierraMode=1

CheckSuccess=20

NoDriverLoading=1
found it.

after writing the rules, insert
Code:
# 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
Code:
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.
The Following User Says Thank You to jurben For This Useful Post: [ Click to Expand ]
 
spicysomtam
Old
#6  
Junior Member
Thanks Meter 5
Posts: 9
Join Date: Jan 2010
Default 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.
 
spicysomtam
Old
#7  
Junior Member
Thanks Meter 5
Posts: 9
Join Date: Jan 2010
Default Looks like a low level USB issue

Switched on tracing on adbd on the phone side. Looks like a phone/usb low level issue:

Code:
--- 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
system/core/adb/usb_linux_client.c::usb_kick():usb_kick


---------- 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: [ Click to Expand ]
 
spicysomtam
Old
#8  
Junior Member
Thanks Meter 5
Posts: 9
Join Date: Jan 2010
Default 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.
 
spicysomtam
Old
#9  
Junior Member
Thanks Meter 5
Posts: 9
Join Date: Jan 2010
Default Now working under Linux!

You need the vendor id in adb_usb.ini:

Code:
cat ~/.android/adb_usb.ini 
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x1c9e
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: [ Click to Expand ]
 
spicysomtam
Old
#10  
Junior Member
Thanks Meter 5
Posts: 9
Join Date: Jan 2010
Default 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:

Code:
# 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:

Code:
# 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: [ Click to Expand ]
Tags
adb, ubuntu
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes