UsbSerial library - Supports FTDI, Arduinos and other USB serial devices

Discussion in 'Old Libraries Archive' started by Erel, Jan 3, 2013.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    It is still under development. I will update the wrapper once it gets updated (if an update is required at all).
     
  2. alexhi

    alexhi Member Licensed User

    Last edited: Feb 13, 2013
  3. Erel

    Erel Administrator Staff Member Licensed User

    Have you tried to use the update with the current wrapper? It will probably work. You should just change the name of the jar to match the previous one (or edit the XML file DependsOn field).
     
  4. Rigsby

    Rigsby Member Licensed User

     
  5. eelias

    eelias Active Member Licensed User

    Erel,

    I followed the information from this tutorial do add the rights to the application, however I am using PL2303 library.

    The problem is that it keeps asking for right to access the USB-Serial cable (prolific 2303)

    This is my manifest file:

    Code:
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "4" android:targetSdkVersion="12"/>
    <uses-permission android:name=
    "android.permission.INTERNET" />
    <supports-screens android:largeScreens=
    "true" 
        android:normalScreens=
    "true" 
        android:smallScreens=
    "true" 
        android:anyDensity=
    "true"/>)
    SetApplicationAttribute(android:icon, 
    "@drawable/icon")
    SetApplicationAttribute(android:
    label"$LABEL$")
    AddApplicationText(<
    activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>)
    AddActivityText(main, <
    intent-filter>
            <action android:name=
    "android.hardware.usb.action.USB_DEVICE_ATTACHED" />
        </
    intent-filter>
        <meta-data android:name=
    "android.hardware.usb.action.USB_DEVICE_ATTACHED"
            android:resource=
    "@xml/device_filter" />)
    'End of default text.
    I have changed the device_filter.xml to add my device:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <!-- 
    0x0403 / 0x6001: FTDI FT232R UART -->
        <usb-device vendor-
    id="1027" product-id="24577" />

        <!-- 
    0x2341 / Arduino -->
        <usb-device vendor-
    id="9025" />

        <!-- 
    0x16C0 / 0x0483: Teensyduino  -->
        <usb-device vendor-
    id="5824" product-id="1155" />

        <!-- 
    0x2303 / 0x067b: Prolific SerialUSB  -->
        <usb-device vendor-
    id="8963" product-id="1659" />

    </resources>
    After it gets the rights it access the usb with no problem, send and receive byte fine.

    But after some time, like 30 minutes (i believe it is related to screen trying to sleep, besides it is configured to be always on when powered) if you try to use the USB again the program crashes, when it gets back as for rights again. So i believe it crashed because the rights were revoked.

    What can I do, I have customer right now waiting for a solution with equipment stopped!!!

    Eduardo Elias
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    The permission is never revoked.

    I recommend you to use a service to handle the communication.
     
  7. sergioausrio

    sergioausrio New Member Licensed User

    CP2102 support in this Lib where great. I have some Devices with CP2102 Controller. It would be great to connect them with my Android! Cant wait...:D
     
  8. mterveen

    mterveen Member Licensed User

    erel - how does the google project jar compare/correlate to the d2xx.jar that ftdi has released earlier this month? have you or anyone tried the ftdi jar?
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    I haven't tried the new FTDI library. This library works fine with FTDI chips.
     
  10. bluedude

    bluedude Well-Known Member Licensed User

    Not working with Arduino Mega ADK

    I tried this with my Arduino Mega ADK but it does not work.

    When connecting the Phone and Arduino nothing happens at all.

    Cheers,
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    Does your device recognize the USB device? You can use USB library to find the connected devices.
     
  12. bluedude

    bluedude Well-Known Member Licensed User

    Recognizing

    Nope, does not do anything. Also my old code with the USB Manager etc. does not work anymore with the ADK.

    With the old code it complains about no installed apps support the accessory while that always worked.

    Maybe the last Android update on my Galaxy Nexus is killing my code.

    Cheers,
     
  13. Erel

    Erel Administrator Staff Member Licensed User

  14. yo3ggx

    yo3ggx Active Member Licensed User

    CP2102 works with this wrapper

    Hi all,

    I just want to confirm that using the latest version of the library source file to compile a new jar I have now support for CP2102 on my tablet (Samsung Galaxy Tab 7.7).
    It would be great if PL2303 will be included too, to have everything in a single library.

    Thank you Erel for your great work.
    It is so simple to use...:)

    Dan
     
  15. sergioausrio

    sergioausrio New Member Licensed User

    Hello Dan,
    how did you do it? I tried it on my Samsung Galaxy Tab 10.1 with Erels Example -> Error opening USB port! I can not connect to the CP2102. Can you tell us your source code?
     
  16. yo3ggx

    yo3ggx Active Member Licensed User

    CP2102 support

    Hi,

    You have to recompile usb-serial-for-android using the latest available source code from the repository. No need to modify anything in the wrapper built by Erel. Just replace the jar file in the library folder.

    If you want to use one compiled by me, you can find it attached (unzip and copy to Library folder over the previous one).
    Do not forget to Refresh the libraries in B4A.

    Hope this help.

    Dan
    P.S. tested with a CP2102 module and a loopback (rx link to tx)
     

    Attached Files:

  17. yo3ggx

    yo3ggx Active Member Licensed User

    CP2102 support

    I forgot to say that you have to add the following lines in device_filter.xml file:

    <!-- 0x10C4 / 0xEA60: CP210x UART Bridge -->
    <usb-device vender-id="4292" product-id="60000"/>

    and this is all.
    I just implemented this in my app using only Bluetooth before and is working like a charm over USB now.
    My tablet is a Samsung Galaxy TAB 7.7 with ICS (4.0.4).

    Dan
     
  18. Scantech

    Scantech Well-Known Member Licensed User

    Hello,

    I downloaded the Jar file and added additional filter in xml, but no go. I have this ELM 327 OBD II USB and I believe it is the CP210X type. Now, when I plug it in, it lets me choose an app, but mine is not included. It did power up the unit with this latest Jar file. Need to play around more and figure this out.

    Thanks for recompiling the jar.
     
  19. yo3ggx

    yo3ggx Active Member Licensed User

    Check if VID and PID are the same for your device.
    A simple way is to connect it to a Windows computer and look into the devices.

    Play first with the Erel example and put a link between Rx and Tx to get an echo.
     
  20. Scantech

    Scantech Well-Known Member Licensed User

    I have this in device info
    USB\VID_067B&PID_2303&REV_0300
    USB\VID_067B&PID_2303
     
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice