Hello all, i'm working on a project which involves communicating with a medical device which streams the data out of a usb connection, i have that part working, i can receive and convert the binary information to a readable data.
My question is, how can I get the vendor and product ID of the device connected with the USB library, has anyone done this before, if so can anyone point me in the right direction, i have this code which returns some information but i can't make heads or tails from it, this code returns 2 devices, but i don't know which one is which.
and this are the devices that are logged:
If someone has any experience with this library i will really appreciate your help.
Thanks,
Walter
My question is, how can I get the vendor and product ID of the device connected with the USB library, has anyone done this before, if so can anyone point me in the right direction, i have this code which returns some information but i can't make heads or tails from it, this code returns 2 devices, but i don't know which one is which.
B4X:
Sub Start_Serial As Boolean
If usb.UsbPresent = usb.USB_NONE Then
Log("Msgbox - no device")
'Msgbox("No USB device or accessory detected!", "Error")
'Log("Msgbox - returned")
Return
End If
Log("Checking permission")
If (usb.HasPermission) Then
Dim dev As Int
dev = usb.Open(19200)
If dev <> usb.USB_NONE Then
Log("Connected successfully!")
'Log(usb1.GetDevices)
Dim dev1 As List
dev1.Initialize
dev1 = usb1.GetDevices 'I assign the found devices to a list
For i = 0 To dev1.Size - 1
Log("device :" & dev1.Get(i)) 'i log the devices found
Next
astreams.Initialize(usb.GetInputStream, usb.GetOutputStream, "astreams")
Else
usb.RequestPermission
Log("Error opening USB port")
End If
Else
usb.RequestPermission
End If
End Sub
and this are the devices that are logged:
deviceUsbDevice) UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=1478,mProductId=36940,mClass=0,mSubclass=0,mProtocol=0,mInterfaces=[Landroid.os.Parcelable;@42b1bf38]
deviceUsbDevice) UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=4292,mProductId=60000,mClass=0,mSubclass=0,mProtocol=0,mInterfaces=[Landroid.os.Parcelable;@42b1d580]
If someone has any experience with this library i will really appreciate your help.
Thanks,
Walter