List Connected USB Device Name

Hello all,

How would one capture the name of a newly connected USB device in a listbox? I dont wish to read the contents but just list the name of the device.

This is my first time venturing into this area and have no clue on where to start.

If someone could point me in the right direction to get started, it would be greatly appreciated.

Best Regards


MBS has a class for that - WinUSBDeviceMBS.

1 Like

There’s also this wonderful set of declares by Chris Carter that basically gives you everything DeviceManager gets

Unfortunately it’s 32-bit only.

1 Like

WinUSBDeviceMBS class can do that.
Also check WindowsDeviceMBS class.

For Mac you can take a look on the MacUSBDeviceMBS class and the IORegistryMBS class.
For cross platform development also check LibUSBDeviceMBS classes.

There is a lot in MBS Xojo Plugins :slight_smile:


Thank you all kindly for the replies. I will check out the MBS plugins!



This may be of some use:

Public Function GetUSB() as String
  'Return a list of USB devices
  'Different command for each platform
  Dim My_Shell As New Shell
  #If TargetWindows Then
    My_Shell.Execute "cd\ & wmic path CIM_LogicalDevice where ""Description like 'USB%'"" get /value"
  #Elseif TargetMacOS 
    My_Shell.Execute "system_profiler SPUSBDataType"
  #Elseif TargetLinux
    My_Shell.Execute "lsusb"
  dim s As String = ReplaceLineEndings(My_Shell.Result,EndOfLine)
  return s
End Function

Parsing the returned string can be a bit messy, but I have some code for that somewhere, if needed.