Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 27 Jun 2016 12:16 PM by  mvly
Android Accessory?
 5 Replies
Sort:
You are not authorized to post a reply.
Author Messages
mvly
Basic Member
Basic Member
Posts:104


--
20 Jun 2016 06:20 PM

    I am trying to get Android accessory to work on the stable 2.3.4 Android OS of the torpedo. According to https://developer.android.com/guide/topics/connectivity/usb/accessory.html

    I need to use the Add-on support which I do by modifying the gradle build to use google api which has the add-on support.

     

    I added the file: com.android.future.usb.accessory.jar to the /system/framework folder and added the proper xml premissions and rebooted the device.

    See here for the permissions:

    https://android.googlesource.com/platform/frameworks/native/+/master/data/etc/android.hardware.usb.accessory.xml

     

    I when ahead and build the App with the Add-on, but I don't detect any usb devices when I plug it into a computer or another android device.

     

    Does the torpedo hardware/kernel support android accessory? I hear android accessory is built into any android OS > 3.1 (API 12). I know there is a ICS build for the torpedo but it does not work as smoothly as the 2.3.4 build. Should I look there for the accessory support?

    mvly
    Basic Member
    Basic Member
    Posts:104


    --
    21 Jun 2016 12:24 PM
    Also it seems like the Torpedo does not detect it properly. When I connect it to another Android device, it keeps saying

    android-work: did not send uevent (0, 0, null))

    repeating indefinitely until I remove the USB.

    The setup is Android 6.0 OTG host device ----> Torpedo Android 2.3.4

    mvly
    Basic Member
    Basic Member
    Posts:104


    --
    21 Jun 2016 04:14 PM

    Ok so I did some more research and tested with other devices and it looks like if the device on the other end cannot source enough current to keep the Torpedo on, this is what is causing the problem. I am powering the device through the USB. I switched out to a phone that can source the current and it was detected fine.

    mvly
    Basic Member
    Basic Member
    Posts:104


    --
    23 Jun 2016 01:03 PM
    Though the system detects the device attached :

    android_work: sent uevent USB_STATE=CONNECTED
    android_usb gadget: high speed config #1: android
    android_work: sent uevent USB_STATE=CONFIGURED

    I still have no accessory in the android code. Could the problem be in the com.android.location.provider.jar I loaded is not working?
    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    24 Jun 2016 01:26 PM
    Sorry for the delayed response. We had an e-mail outage, so any messages leaving our forum and support site were not being sent.


    If you connect the USB and power it externally does that make a difference?

    We don't have Android 6 on our products, but generally our setup is expecting the USB to be configured as a device/gadget and so we don't have much experience using the Android host side.

    adam
    mvly
    Basic Member
    Basic Member
    Posts:104


    --
    27 Jun 2016 12:16 PM

    No problem on the delay reply. I was tinkering more on the OS side looking at the kernel code.

    What I would like is to have the Torpedo be the USB accessory to a USB-Host Android phone running something greater than Android 4.4.

     

    On the Host side, I have coded an App to interface using the USB-Host Mode (OTG). This will supply the power and current to the Torpedo. The torpedo should be in USB Accessory mode. However, I cannot get the Torpedo to show up as a USB accessory device. Normally when you get a USB-Accessory supported device, you will get a notification asking if you want to connect to the USB host. However in the Torpedo case, nothing shows up on the OS. I do get the following in the debug port:

    android_work: sent uevent USB_STATE=CONNECTED

    android_usb gadget: high speed configure #1=android

    android_work: sent uevent USB_STATE=CONFIGURED

    However, I also get the above when I connect the torpedo to a USB port of a laptop to debug it.

     

    I know my host app is working because when installed on a phone running android 6.0 and connected to a USB-Accessory mode supported android phone, I get a notification indicating if I want to connect.

     

    Again I have installed the necessary libraries to get the USB-Accessory mode to work.

    I have looked at the kernel code and it looks like all the necessary code is there to make it work, i.e. f_accessory.c located in the kernel/driver/usb/gadget/ folder is used during compilation. 

     

    Right now my best guess is someone the Android OS is not connected up properly to detect and use the USB devices. If this is the case, I might have to move to the the ICS android version which is buggier than the Gingerbread build for the Torpedo. I would prefer to avoid migrating because there are kernel/OS changes I did to the the Gingerbread build.

    You are not authorized to post a reply.