in reply to Re: WMI: Bus relations
in thread WMI: Bus relations

I don't think it's the loop, but here's the code:
#!/usr/local/perl -w use Win32::OLE('in'); use strict; # Variables my @devIds = (); my @devPnPDevIds = (); my $wmiService = Win32::OLE->GetObject("winmgmts:\\\\.\\root\\cimV2"); my $colDisks = $wmiService->ExecQuery("Select * from CIM_LogicalDevice +"); foreach my $obj ( in( $colDisks ) ) { if($obj->{DeviceID} =~ /.*VID_0AF0&PID_(\d*)&MI_\d*\\(\d&.*&\d&).*/i +) { my $tmpId = $obj->{DeviceID}; $tmpId =~ s/\\/\\\\/g; my $tmpPnpId = $obj->{PNPDeviceID}; $tmpPnpId =~ s/\\/\\\\/g; push(@devIds,$tmpId); push(@devPnPDevIds,$tmpPnpId); } } for(my $tel = 0; $tel < @devPnPDevIds; $tel++) { print "The detected PNP device ID is: ".$devPnPDevIds[$tel]."\n"; my $deviceID = $devPnPDevIds[$tel]; my $subDevices = $wmiService->ExecQuery('ASSOCIATORS OF {Win32_PnPEn +tity.DeviceID="'.$deviceID.'"} WHERE AssocClass=Win32_PnPDevice'); foreach my $subDevProp ( in( $subDevices ) ) { print "CreationClassName: ".$subDevProp->{CreationClassName}."\n"; print "Caption: ".$subDevProp->{Caption}."\n"; print "Description: ".$subDevProp->{Description}."\n"; print "DeviceID: ".$subDevProp->{DeviceID}."\n"; print "HardwareID: ".$subDevProp->{HardwareID}."\n"; print "PNPDeviceID: ".$subDevProp->{PNPDeviceID}."\n"; print "Service: ".$subDevProp->{Service}."\n"; print "SystemName: ".$subDevProp->{SystemName}."\n"; } }
My guess is I'm missing some bus relations which I can't retrieve with "Win32_Bus". (The IDs I get with this call are not unique, hence I cann't use it).

Am I missing something in this query?

Update: Guess I'm looking for a logical bus, not a phisical one. But were (and how) to find it...?


Update:
Win32_Bus retrieves the phisical Bus devices. This is not the thing I needed, since more devices are connected on 1 physical bus.
I did found a solution however.
I have to querry the PDO (Physical Device Object). These can give me enough date (along with the deviceID) to combine all instances, created by the drivers, that belong to a single device.