Hello community,
I have the problem, that my programm cannot find a device on USB. It has USB On the Go and I used a USB On the Go cable. My smartphone finds the USB device, so I cannot understand why my programm won't find it.
Here is my code:
I hope someone can help me.
sincerly, Tooob
Edit: I use a HTC desire
I have the problem, that my programm cannot find a device on USB. It has USB On the Go and I used a USB On the Go cable. My smartphone finds the USB device, so I cannot understand why my programm won't find it.
Here is my code:
B4X:
Sub Process_Globals
Dim usbb As UsbSerial
Dim aStreams As AsyncStreams
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim dev As Int
Dim u As Int
Activity.LoadLayout("main")
If usbb.HasPermission(dev) = False Then
usbb.RequestPermission(dev)
u = usbb.Open(115200,dev)
usbb.SetParameters(115200,usbb.DATABITS_8,usbb.STOPBITS_1,usbb.PARITY_NONE)
If u <> usbb.USB_NONE Then
ToastMessageShow("verbindung erfolgreich", False)
aStreams.Initialize(usbb.GetInputStream,usbb.GetOutputStream,"aStreams")
Else
ToastMessageShow("verbindung fehlgeschlagen",False)
End If
If usbb.UsbPresent(dev) = usbb.USB_NONE Then
Msgbox("Kein USb gerät angeschlossen","fehler")
End If
End If
End Sub
I hope someone can help me.
sincerly, Tooob
Edit: I use a HTC desire