# List Connected USB Device Name

**URL:** <https://forum.xojo.com/t/list-connected-usb-device-name/67618>\
**Category:** Windows\
**Created:** [December 27, 2021, 12:41pm UTC](https://forum.xojo.com/t/list-connected-usb-device-name/67618 "2021-12-27T12:41:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robin\_Doak](https://forum.xojo.com/user_avatar/forum.xojo.com/robin_doak/32/17658_2.png) [@Robin\_Doak](https://forum.xojo.com/u/Robin_Doak)\
**Post date:** [December 27, 2021, 12:41pm UTC](https://forum.xojo.com/t/list-connected-usb-device-name/67618/1 "2021-12-27T12:41:28Z")

</div>

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

Robin.

---

<div class="post-metadata">

**Author:** ![Peter\_Koren](https://forum.xojo.com/letter_avatar_proxy/v4/letter/p/f14d63/32.png) [@Peter\_Koren](https://forum.xojo.com/u/Peter_Koren)\
**Post date:** [December 27, 2021, 11:17pm UTC](https://forum.xojo.com/t/list-connected-usb-device-name/67618/2 "2021-12-27T23:17:02Z")

</div>

MBS has a class for that - WinUSBDeviceMBS.

---

<div class="post-metadata">

**Author:** ![Julia\_Truchsess](https://forum.xojo.com/user_avatar/forum.xojo.com/julia_truchsess/32/499_2.png) [@Julia\_Truchsess](https://forum.xojo.com/u/Julia_Truchsess)\
**Post date:** [December 27, 2021, 11:43pm UTC](https://forum.xojo.com/t/list-connected-usb-device-name/67618/3 "2021-12-27T23:43:40Z")

</div>

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

[http://www.cmas-net.co.uk/rslug/Eg-5-DeviceList.rbp](http://www.cmas-net.co.uk/rslug/Eg-5-DeviceList.rbp)

Unfortunately it’s 32-bit only.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [December 28, 2021, 10:03am UTC](https://forum.xojo.com/t/list-connected-usb-device-name/67618/4 "2021-12-28T10:03:26Z")

</div>

[WinUSBDeviceMBS](https://www.monkeybreadsoftware.net/class-winusbdevicembs.shtml) class can do that.  
Also check [WindowsDeviceMBS](https://www.monkeybreadsoftware.net/class-windowsdevicembs.shtml) class.

For Mac you can take a look on the [MacUSBDeviceMBS](https://www.monkeybreadsoftware.net/class-macusbdevicembs.shtml) class and the [IORegistryMBS](https://www.monkeybreadsoftware.net/module-ioregistrymbs.shtml) class.  
For cross platform development also check [LibUSBDeviceMBS](https://www.monkeybreadsoftware.net/class-libusbdevicembs.shtml) classes.

There is a lot in [MBS Xojo Plugins](https://www.monkeybreadsoftware.de/xojo/) 🙂

---

<div class="post-metadata">

**Author:** ![Robin\_Doak](https://forum.xojo.com/user_avatar/forum.xojo.com/robin_doak/32/17658_2.png) [@Robin\_Doak](https://forum.xojo.com/u/Robin_Doak)\
**Post date:** [December 28, 2021, 11:10am UTC](https://forum.xojo.com/t/list-connected-usb-device-name/67618/5 "2021-12-28T11:10:03Z")

</div>

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

Robin

---

<div class="post-metadata">

**Author:** ![Robert\_Weaver](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/919ad9/32.png) [@Robert\_Weaver](https://forum.xojo.com/u/Robert_Weaver)\
**Post date:** [December 28, 2021, 10:13pm UTC](https://forum.xojo.com/t/list-connected-usb-device-name/67618/6 "2021-12-28T22:13:07Z")

</div>

This may be of some use:

```auto
Public Function GetUSB() as String
  'Return a list of USB devices
  'Different command for each platform
  Dim My_Shell As New Shell
  My_Shell.TimeOut=-1
  #If TargetWindows Then
    'Windows
    My_Shell.Execute "cd\ & wmic path CIM_LogicalDevice where ""Description like 'USB%'"" get /value"
  #Elseif TargetMacOS 
    'Mac
    My_Shell.Execute "system_profiler SPUSBDataType"
  #Elseif TargetLinux
    'Linux
    My_Shell.Execute "lsusb"
  #Endif
  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.
