Android Serial Port (USB)

Put problems with the Android NDK in this forum.

Android Serial Port (USB)

Postby Berserker » Wed May 04, 2011 9:25 am

Hi, I need to write some "raw" data to the usb port for a project of mine (no prob if root should be required).
I found a port of libusb for Android here and I managed to compile with NDK. I linked the library to an executable of mine (executed as root), but the function "libusb_init" always returns an error. I found that the problem (by now...) is in the file "linux_usbfs.c", more precisely in this function:
Code: Select all
static const char *find_usbfs_path(void)
   const char *path = "/dev/bus/usb";
   const char *ret = NULL;

   if (check_usb_vfs(path)) {
      ret = path;
   } else {
      path = "/proc/bus/usb";
      if (check_usb_vfs(path))
         ret = path;

   usbi_dbg("found usbfs at %s", ret);
   return ret;

"/dev/bus/usb" obviously doesn't exist on my N1...can anyone help?
User avatar
Posts: 4
Joined: Wed Jun 30, 2010 4:57 pm


Re: Android Serial Port (USB)

Postby cubie » Thu May 05, 2011 5:12 pm

I'm also trying to get a simple USB app running under Android. How exactly are you calling the usb functions from your main application if you don't mind me asking?

"/dev/bus/usb" obviously doesn't exist on my N1...can anyone help?

Do you mean /proc/bus/usb ?
You must have usbfs mounted (as root) and have support for it in the kernel.
Run "mount" on your phone.
Is "none /proc/bus/usb usbdevfs defaults 0 0" present?

Can you run "sudo mount -t usbfs none /proc/bus/usb"?
Once Poster
Once Poster
Posts: 1
Joined: Thu May 05, 2011 5:03 pm


Return to NDK Problems

Who is online

Users browsing this forum: No registered users and 3 guests