On 12/08/13 03:41, Xiaofan Chen wrote:
On Fri, Aug 9, 2013 at 6:51 PM, Toby Gray <toby.g...@realvnc.com> wrote:
If you are planning on testing on a device then you'll need to have root
access to it or fiddle around with building custom ROMs to setup
permissions on /dev/bus/usb/*/*.

Also be aware that the Android dynamic loader is more basic than the
normal Linux one so it's best to place libusb-1.0.so in /system/lib.

Could you give more details how you test libusbx under Android? What
is the device you are using and what kind of custom ROM you are using?

I've tried a few devices, both custom ROMs and rooted.

The custom ROM approach uses modifying ueventd.rc to change the permissions on /dev/bus/usb/*/*.

I myself have an Android tablet (have USB host support and real USB
host port along with the micro-USB port, tested the host support with
Microchip's app and seems to work fine) and an Android phone (not so
sure if it has USB host support and not plan to do anything USB with it).

Assuming that you have rooted the device then the easiest thing to do is something along the lines of the following:

  # Make the system partition writeable
  adb shell su -c "mount -o remount,rw /system"

  # Install libusb
  adb push obj/local/armeabi/libusb1.0.so /sdcard/
  adb shell su -c "cat > /system/lib/libusb1.0.so < /sdcard/libusb1.0.so"
  adb shell rm /system/lib/libusb1.0.so
  # Install the samples and tests
  for B in listdevs fxload xusb sam3u_benchmark hotplugtest stress
  do
    adb push "obj/local/armeabi/$B" /sdcard/
    adb shell su -c "cat > /system/bin/$B < /sdcard/$B"
    adb shell su -c "chmod 0755 /system/bin/$B"
    adb shell rm "/sdcard/$B"
  done

  # Make the system partition read only again
  adb shell su -c "mount -o remount,ro /system"

  # Run listdevs
  adb shell su -c "listdevs"

If your device only has a single USB port (so can't be a USB host and have a USB ADB connection) then you can use the following commands to use ADB over wifi:

  adb shell netcfg
  # Note the wifi IP address of the phone
  adb tcpip 5555
  # Use the IP address from netcfg
  adb connect 192.168.1.123:5555

Or you could use one of the many local terminal applications available for Android devices.

If you are making an Android application and want to use libusb then including the libusbx/android/jni/libusb.mk makefile in your NDK makefile will allow you to use libusb APIs from other native code.

I assume it'd be helpful for others to have this information recorded somewhere. Would a wiki page or an update to the README be more appropriate?

Regards,

Toby
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to