Hi there,
Im working on a Android TV box and arduino connected by USB (USB device number 9025), Im using the felUsbSerial 1.12, I made the program find the correct device, open it and it works perfect, but only in Debug mode, if I switch to Release, I get a java error (using BridgeLogger: true )
I feel the code is OK, and something is working on another way by switching Debug/Release, it is some permission missing? any clue?
Thanks in advance
Im working on a Android TV box and arduino connected by USB (USB device number 9025), Im using the felUsbSerial 1.12, I made the program find the correct device, open it and it works perfect, but only in Debug mode, if I switch to Release, I get a java error (using BridgeLogger: true )
I feel the code is OK, and something is working on another way by switching Debug/Release, it is some permission missing? any clue?
Thanks in advance
B4X:
Dim UsbDevices() As UsbDevice
UsbDevices = manager.GetDevices
If UsbDevices.Length = 0 Then
ToastMessageShow("ERROR no hay dispositivos USB conectados", True)
Else
For z = 0 To UsbDevices.Length - 1
Dim UsbDvc As UsbDevice
UsbDvc = UsbDevices(z)
Log("USBDeviceNr. " & z & " - UsbPid = " & UsbDvc.ProductId & " Devicename:" & UsbDvc.DeviceName)
Log("USBDeviceNr. " & z & " - Vendor id = " & UsbDvc.VendorId & " Device ID: " & UsbDvc.DeviceId )
Log("listado de dispositivos")
Log("Vendor ID")
Log(UsbDvc.VendorId)
If UsbDvc.VendorId == 9025 Then
dispositivo = z
Log( "Este = " & dispositivo)
End If
Next
End If
If manager.GetDevices.Length = 0 Then
Log("No connected usb devices.")
ToastMessageShow("ERROR no hay dispositivos USB conectados", True)
Else
Dim device As UsbDevice = manager.GetDevices(dispositivo)
If manager.HasPermission(device) = False Then
ToastMessageShow("Please allow connection and click again.", True)
manager.RequestPermission(device)
Else
Log("Conectando " )
enchufado = True
usbserial.Initialize("serial", device, -1)
usbserial.BaudRate = 9600
usbserial.DataBits = usbserial.DATA_BITS_8
usbserial.StartReading
Log("Conectado! ")
ToastMessageShow("Connection OK", True)
End If
End If
B4X:
java.lang.Exception: Sub serial_dataavailable was not found.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:219)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)