Android Question B4A fellusbserial question?

Pietro Pancino

Member
Licensed User
Longtime User
Hi all!
I am using fellusbserial to connect my B4A app to an electronic board througt an usb com dongle from FTDI.
Everything work fine, I can connect to the USB device and communicate.
The problem is at device startup, I am alway obliged to "allow myapp to access the usb device?", even if I check "use by default for this USB device"...
Does this paramater can be checked for ever after app installation? because It's not possible for the app user to check it at each device startup...

Many thanks!
 

Pietro Pancino

Member
Licensed User
Longtime User
Hi Erel!
Yes, here is the content of usb_device_filter.xml file

usb_device_filter.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- &h0403 / &h6001: FTDI FT232R UART -->
    <usb-device vendor-id="1027" product-id="24577" />

</resources>

Here the manifest content:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

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/usb_device_filter" />
)

Maybe the problem comes from the platform itself on android 7.1.1. SANTINO LT 5.0
The device power is cut as is, so I also tryed the reboot command on Terminal emulator in order to reboot wihtout cuting the power. idem
I don't know what to do... MY global App need to communicate with a specific hardware, This hard-ware had several RS232 port and one FTDI USB interface.

There is a also a serial port RS232 on UART on the SANTINO, but it is reserved by android for debug, so I don't know how to use it.
I found specifics XML configuration file on manufacturer web site usefull to disable the debug interface on uart, but I don't know what to do with.

DisableSerialDiag.xml:
<?xml version="1.0" encoding="ASCII" standalone="yes" ?>
<configurationFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <variables>
        <setting
            key="enable_serialdiag"
            title="Enable serial Diag-Port"
            type="bool"
            enable_key=""
            enable_sense="true"
            value="false"
            regkey="HKLM\Software\RedBoot\EnableSerialDiag">
        </setting>
  </variables>
</configurationFile>

I don't know where to put this file... In /res/xml at root?

If you have any idea, :))))
 
Upvote 0

Pietro Pancino

Member
Licensed User
Longtime User
Hi Erel,

I did all modifications as explained in the link (post-801794), always the same, I am obliged to check and accept at each power on...
Maybe my device is bugged, I don't understand.

In the original exemple of fellusbserial; I notice that the xml file was in read only mode. Is the Xml file deleted by default at power on?

I have joind my app, If you have a bit of time to look at that...

Thank you
 

Attachments

  • test_fellusb.zip
    52 KB · Views: 93
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The manifest is wrong. It should be:
B4X:
CreateResource(xml, device_filter.xml,
<resources>
<usb-device vendor-id="1027" product-id="24577" />  
</resources>
)

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" />)

In the original exemple of fellusbserial; I notice that the xml file was in read only mode. Is the Xml file deleted by default at power on?
The read-only file was needed before the manifest editor feature was added.
 
Upvote 0
Top