This is a very late answer, but I also run into this problem and I have found a solution to find the "Bus reported device description" after searching on the Internet. I do not need "Bus Relations" in my case but I guess it may be retrieved in a similar way. I am using Windows 10 21H1 and MATLAB R2021a.
In short, my solution has 4 steps:
- Find all the active COM port devices.
- Find the friendly names of all devices.
- Based on 1 and 2, get the friendly names of all active COM port devices.
- Based on 3, get the "Bus reported device description" of all active COM port devices.
Code:
% To improve speed (x10) add jsystem to the path from here:
% https://github.com/avivrosenberg/matlab-jsystem/blob/master/src/jsystem.m
if exist('jsystem','file')
fsystem = @jsystem;
else
fsystem = @system;
end
% Find all the active COM ports
com = 'REG QUERY HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM';
[err,str] = fsystem(com);
if err
error('Error when executing the system command "%s"',com);
end
% Find the friendly names of all devices
ports = regexp(str,'\\Device\\(?<type>[^ ]*) *REG_SZ *(?<port>COM\d+)','names','dotexceptnewline');
cmd = 'REG QUERY HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ /s /f "FriendlyName" /t "REG_SZ"';
[~,str] = fsystem(cmd); % 'noshell'
% Get the friendly names of all active COM port devices
names = regexp(str,'FriendlyName *REG_SZ *(?<name>.*?) \((?<port>COM\d+)\)','names','dotexceptnewline');
[i,j] = ismember({ports.port},{names.port});
[ports(i).name] = names(j(i)).name;
% Get the "Bus reported device description" of all active COM port devices
for i = 1:length(ports)
cmd = sprintf('powershell -command "(Get-WMIObject Win32_PnPEntity | where {$_.name -match ''(%s)''}).GetDeviceProperties(''DEVPKEY_Device_BusReportedDeviceDesc'').DeviceProperties.Data"',ports(i).port);
[~,ports(i).USBDescriptorName] = fsystem(cmd);
end
This solution works but may not be clean. I am not a Windows expert anyway. Suggestions are highly appreciated.