0

The app I am developing connects to a USB accessory which I simulate in the same pc I use to program/debug.
The problem is, whenever the Tablet changes to accessory mode I am unable to connect to the Logcat through USB.(The tablet name in adb changes to a number-Id)
I can connect to it via WiFi but whenever I reconnect the tablet (e.g. to reset the usb accessory mode) the adb connection resets back to usb.
I know it is possible to have the Logcat running on USB while in accessory mode. I just can't find out why this doesn't work for me.

I have followed the install steps for the adt-bundle; tried reinstalling; tried with Android Studio.

Any ideas?

SoulBA
  • 21
  • 7
  • Is your device rooted? If so, you should be able to permanently configure the ADB connection as WiFi, instead of having it revert back to USB. – adelphus Oct 23 '15 at 22:56
  • The device is not rooted. I want to do that without having to root the tablet. I want to be able to debug through USB. – SoulBA Oct 26 '15 at 12:35
  • I'm also doing this kind of projects. I don't have a dedicated custom Accessory to test my app. You said you simulated USB accessory in PC. Can you please tell me how to simulate pc as usb accessory? This will be very helpful. Thanks. – Praveen Kumar Feb 01 '16 at 09:38
  • Hi, Praveen. Our accessory is a robot connected through USB and running linux in a beagleboard. We can run the software from the robot in any Linux with the proper libraries. We just have to mockup the robot's hardware parts. – SoulBA Feb 02 '16 at 10:58

1 Answers1

0

I found the solution for my problem. By restarting the adb server using sudo I was able to get Logcat messages from the device while it is connected to my simulated usb accessory.

sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb devices

Thanks to Leon's answer here.

If you don't feel like using sudo, I've found that the following solution works:

Create a file named /tmp/android.rules with the following contents (hex vendor numbers were taken from the vendor list page):

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"

Run the following commands:

sudo cp /tmp/android.rules /etc/udev/rules.d/51-android.rules
sudo chmod 644   /etc/udev/rules.d/51-android.rules
sudo chown root. /etc/udev/rules.d/51-android.rules
sudo service udev restart
sudo killall adb

Disconnect the USB cable between the device and the computer.

Reconnect the phone.

Run adb devices to confirm that now it has permission to access the phone.

Taken from here.

Community
  • 1
  • 1
SoulBA
  • 21
  • 7