Android Question How to discover what usb device pluged in is usb-serial

Rubens Jr.

Member
Licensed User
Hi !
Sorry, English is not my language ..

Using a usb hub with a usb-serial adapter and a usb-sound adapter :
usbmanager.GetDevices.Length return 2 (it is correct)
How can I discover what is a usb-serial and what is a sound card ?

I use a FelUsbSerial and need to know what device to open :
device = usbmanager.GetDevices (0) or
device = usbmanager.GetDevices (1)

Thanks

Rubens Jr.
 

teddybear

Well-Known Member
Licensed User
Hi !
Sorry, English is not my language ..

Using a usb hub with a usb-serial adapter and a usb-sound adapter :
usbmanager.GetDevices.Length return 2 (it is correct)
How can I discover what is a usb-serial and what is a sound card ?

I use a FelUsbSerial and need to know what device to open :
device = usbmanager.GetDevices (0) or
device = usbmanager.GetDevices (1)

Thanks

Rubens Jr.
Log(device) see what it is, it looks like this
B4X:
(UsbDevice) UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=6790,mProductId=29987,mClass=255,mSubclass=0,mProtocol=0,mManufacturerName=null,mProductName=USB2.0-Ser!,mVersion=2.54,mSerialNumberReader=android.hardware.usb.IUsbSerialReader$Stub$Proxy@aacc3c0, ...
 
Upvote 0

Rubens Jr.

Member
Licensed User
Log(device) see what it is, it looks like this
B4X:
(UsbDevice) UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=6790,mProductId=29987,mClass=255,mSubclass=0,mProtocol=0,mManufacturerName=null,mProductName=USB2.0-Ser!,mVersion=2.54,mSerialNumberReader=android.hardware.usb.IUsbSerialReader$Stub$Proxy@aacc3c0, ...
Ok.

Now I have to get the mVendorID and mProductid and compare it with manifest editor !

Thanks !
 
Upvote 0

Lello1964

Well-Known Member
Licensed User
Longtime User
I use this to get information from usb serial.
B4X:
Dim UsbDevices() As UsbDevice
    UsbDevices = manager.GetDevices
    UsbAcc = manager.GetAccessories
  
        For Each UsbDvc As UsbDevice In UsbDevices
            Log(UsbDvc.VendorId)
            Log(UsbDvc.ProductId)
            Dim info        As String
          
            Dim r As Reflector
            r.Target = UsbDvc
            Try
                r.Target =r.GetField("mSerialNumber")
                Log(r.Target)
                If r.Target="AL00AV6C" Then
                    Exit
                End If
            Catch
                Log(LastException)
            End Try
        Next
 
Last edited:
Upvote 0
Top