B4A Library felUsbSerial - Alternative Usb Serial library

Status
Not open for further replies.

red30

Active Member
Licensed User
USB host feature is not implemented perfectly on all devices. Which USB device are you connecting to the Android?
"I connect to the microcontroller PIC18F14K50, which operates in USB CDC mode.everything works ok on all devices that work with OTG, but the tablet RoverPad Sky Glory S7 did not see the connected device. I did as written here (https://www.b4x.com/android/forum/t...rs232-adaptor-driver.11449/page-3#post-121125), - it works. I plugged the other tablet (Explay Scream 3G), made everything as the link still does not see the connected device. But the "USB Host Controller" software sees the device! You understand?"
 

miguelcleman

Member
Licensed User
It´s possible make a usb serial connection has fixed or permanent permission? (whitout msgbox confirmation?)

sory, my english is very bad!
 

drponciano

Member
Licensed User
Hello: When I try to complie the example I get the following error:

usbserial.Initialize(\
javac 1.8.0_102
src\b4a\example\main.java:375: error: package android.hardware.usb does not exist
_usbserial.Initialize("serial",(android.hardware.usb.UsbDevice)(_device.getObject()),(int) (-1));

Seems like it has to do with USBMANAGER. Any idea what am I doing wrong?
 

rtek1000

Active Member
Licensed User
Hi @Erel,

You know one user has a problem with the other library, and you suggested this one, but I tested it and they both do not work.

If the connected device (such as Arduino) sends data quickly without a space (pause) between transmissions, this library and the other one stops.

But the official FTDI app works great, (up to 921600 bauds, flow ctrl: none) and your surce code is available at:
Http://www.ftdichip.com/Support/SoftwareExamples/Android/J2xx_HyperTerm.zip
Http://www.ftdichip.com/Android.htm
Https://play.google.com/store/apps/details?id=com.ftdi.j2xx.hyperterm

Make sure that you or your team can make a new library, or update one, with FTDI source.

Thank you very much!
 

drponciano

Member
Licensed User
Thanks Erel. I had a very old android.jar and now, with the new one, I don't have the compiler error. Using felUSBSerial library the problem gets worse as AsyncStream is called every 15Kbytes instead of the 8k bytes with UBSSerial library. Quite an interesting situation, no?
 

drponciano

Member
Licensed User
Thanks Erele. That is, sureley, what I'm looking for and will solve my problem but, at run time, I get the following error in line

jo.InitializeStatic("com.felhr.usbserial.SerialBuffer").SetField("DEFAULT_READ_BUFFER_SIZE", 2048)


** Activity (main) Pause, UserClosed = false **
** Service (starter) Create **
Error occurred on line: 16 (Starter)
java.lang.IllegalAccessException: field is marked 'final'
at java.lang.reflect.Field.setField(Native Method)
at java.lang.reflect.Field.set(Field.java:585)
at anywheresoftware.b4j.object.JavaObject.SetField(JavaObject.java:174)
at java.lang.reflect.Method.invokeNative(Native Method)

...

** Service (starter) Start **
** Activity (main) Resume **

Any chance a similar solution using USBSERIAL 2.4?

Sorry for taking so much of your time but appreciate your help.
 
Last edited:

drponciano

Member
Licensed User
Thanks Erel. Done with reflector. Still chuncks of 15782 bytes with felusbserial as before. Using USBSerial 2.4 the packet is 7936 bytes or about 1.5 seconds of data.
 

Beja

Expert
Licensed User
Usage is simple. You find the UsbDevice with USB library and then initialize felUsbSerial, configure it and start reading.
Hi Erel,
Start reading as I understand is for reading INTO the phone or Android device (like reading sensor values...etc).. Is it also possible to write to the outside world with this library? In other words, I want to use a smartphone with an app with this library to access and control a machine by connecting the smartphone's usb with the target machine's usb port.

Thanks
 

Beja

Expert
Licensed User
Another question:
Today I tried to run the app but there's no response from the "Connect" button.. it's enabled and can be pressed and raised but there's no action.. even when I disconnected the device, it didn't give me the error msg that now device is connected.
I hope there will be some suggestions or a solution to this.
 
Status
Not open for further replies.
Top