Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer)
dim v as variant = me.RowTag(row)
if v isa LibUSBDeviceMBS then
dim d as LibUSBDeviceMBS = v
List.AddRow "BusNumber", str(d.BusNumber)
List.AddRow "DeviceAddress", str(d.DeviceAddress)
List.AddRow "DeviceSpeed", str(d.DeviceSpeed)
dim dd as LibUSBDeviceDescriptorMBS = d.GetDeviceDescriptor
if dd <> nil then
List.AddFolder "Device Descriptor"
List.RowTag(List.LastIndex) = dd
dim NumConfigurations as integer = dd.NumConfigurations
for i as integer = 0 to NumConfigurations-1
dim dc as LibUSBConfigDescriptorMBS = d.GetConfigDescriptor(i)
List.AddFolder "Config Descriptor "+str(i)
List.RowTag(List.LastIndex) = dc
next
end if
end if
if v isa LibUSBDeviceDescriptorMBS then
dim d as LibUSBDeviceDescriptorMBS = v
dim dev as LibUSBDeviceMBS = FindDevice(row)
// to query device for descriptors, we need to connect.
if not dev.IsOpen then
if dev.Open then
System.DebugLog "Open okay."
else
System.DebugLog "Open failed."
end if
end if
List.AddRow "DescriptorType", str(d.DescriptorType)
List.AddRow "USBReleaseNumber", hex(d.USBReleaseNumber)
List.AddRow "DeviceClass", str(d.DeviceClass)
List.AddRow "DeviceSubClass", str(d.DeviceSubClass)
List.AddRow "DeviceProtocol", str(d.DeviceProtocol)
List.AddRow "MaxPacketSize0", str(d.MaxPacketSize0)
List.AddRow "VendorID", str(d.VendorID)
List.AddRow "ProductID", str(d.ProductID)
List.AddRow "DeviceReleaseNumber", str(d.DeviceReleaseNumber)
List.AddRow "IndexManufacturer", str(d.IndexManufacturer)
if dev.IsOpen then
dim s as string = dev.GetStringDescriptor(d.IndexManufacturer, 0)
if s <> "" then
List.AddRow "Manufacturer", s
else
s = dev.GetStringDescriptorAscii(d.IndexManufacturer)
List.AddRow "Manufacturer ASCII", s
end if
end if
List.AddRow "IndexProduct", str(d.IndexProduct)
if dev.IsOpen then
dim s as string = dev.GetStringDescriptor(d.IndexProduct, 0)
if s <> "" then
List.AddRow "Product", s
else
s = dev.GetStringDescriptorAscii(d.IndexProduct)
List.AddRow "Product ASCII", s
end if
end if
List.AddRow "IndexSerialNumber", str(d.IndexSerialNumber)
if dev.IsOpen then
dim s as string = dev.GetStringDescriptor(d.IndexSerialNumber, 0)
if s <> "" then
List.AddRow "SerialNumber", s
else
s = dev.GetStringDescriptorAscii(d.IndexSerialNumber)
List.AddRow "SerialNumber ASCII", s
end if
end if
List.AddRow "NumConfigurations", str(d.NumConfigurations)
end if
if v isa LibUSBConfigDescriptorMBS then
dim d as LibUSBConfigDescriptorMBS = v
dim NumInterfaces as integer = d.NumInterfaces
List.AddRow "DescriptorType", str(d.DescriptorType)
List.AddRow "TotalLength", str(d.TotalLength)
List.AddRow "NumInterfaces", str(NumInterfaces)
List.AddRow "ConfigurationValue", str(d.ConfigurationValue)
List.AddRow "Configuration", str(d.Configuration)
List.AddRow "Attributes", str(d.AttributesBitmap)
List.AddRow "MaxPower", str(d.MaxPower)
for i as integer = 0 to NumInterfaces-1
dim dc as LibUSBInterfaceMBS = d.GetInterface(i)
List.AddFolder "Interface "+str(i)
List.RowTag(List.LastIndex) = dc
next
end if
if v isa LibUSBInterfaceMBS then
dim d as LibUSBInterfaceMBS = v
dim Count as integer = d.Count
List.AddRow "Count", str(Count)
for i as integer = 0 to Count-1
dim dc as LibUSBInterfaceDescriptorMBS = d.InterfaceDescriptor(i)
List.AddFolder "Interface Descriptor "+str(i)
List.RowTag(List.LastIndex) = dc
next
end if
if v isa LibUSBInterfaceDescriptorMBS then
dim d as LibUSBInterfaceDescriptorMBS = v
dim NumEndpoints as integer = d.NumEndpoints
List.AddRow "DescriptorType", str(d.DescriptorType)
List.AddRow "InterfaceNumber", str(d.InterfaceNumber)
List.AddRow "AlternateSetting", str(d.AlternateSetting)
List.AddRow "NumEndpoints", str(NumEndpoints)
List.AddRow "InterfaceClass", str(d.InterfaceClass)
List.AddRow "InterfaceSubClass", str(d.InterfaceSubClass)
List.AddRow "InterfaceProtocol", str(d.InterfaceProtocol)
List.AddRow "IndexInterface", str(d.IndexInterface)
for i as integer = 0 to NumEndpoints-1
dim dc as LibUSBEndpointDescriptorMBS = d.EndpointDescriptor(i)
List.AddFolder "Endpoint Descriptor "+str(i)
List.RowTag(List.LastIndex) = dc
next
end if
if v isa LibUSBEndpointDescriptorMBS then
dim d as LibUSBEndpointDescriptorMBS = v
List.AddRow "DescriptorType", str(d.DescriptorType)
List.AddRow "EndpointAddress", str(d.EndpointAddress)
List.AddRow "AttributesBitmap", str(d.AttributesBitmap)
List.AddRow "MaxPacketSize", str(d.MaxPacketSize)
List.AddRow "Interval", str(d.Interval)
List.AddRow "Refresh", str(d.Refresh)
List.AddRow "SynchAddress", str(d.SynchAddress)
List.AddRow "TransferType", str(d.TransferType)
List.AddRow "EndpointDirection", str(d.EndpointDirection)
end if
End EventHandler
End Control