Agent/Backend/OS/MacOS/Ports.pm
Dmidecode does not exist n Mac computers. This module is migrated to MacOS directory and it returns results through system_profiler from the types: SPUSBDataType, SPFireWireDataType, SPThunderboltDa
Blueprint information
- Status:
- Complete
- Approver:
- mortheres
- Priority:
- Medium
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- Andreas Xenos
- Definition:
- Approved
- Series goal:
- Accepted for stable-2.0
- Implementation:
- Implemented
- Milestone target:
- None
- Started by
- mortheres
- Completed by
- mortheres
Whiteboard
package Ocsinventory:
sub check {
return(undef) unless -r '/usr/sbin/
return (undef) unless can_load(
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my @types = qw(SPUSBDataType SPFireWireDataType SPThunderboltDa
my $dataType = 0;
for (@types) {
# create the profile object and return undef unless we get something back
my $pro = Mac::SysProfile
my $data = $pro->gettype(
foreach my $port (@$data) {
my ($caption, $description, $name, $type) = '';
if ($dataType == 0) {
$description = $port->
} elsif ($dataType == 1) {
$name = 'FireWire';
$description = 'Max Speed: ' . $port->
} elsif ($dataType == 2) {
$name = $port->
} elsif ($dataType == 3) {
$type = 'Ethernet Controller';
}
});
}
}
}
1;
-------
Hi Andreas,
Thanks a lot for your proposal and code.
I decided to rename as Controllers.pm because I think the data are more related to controllers instead of ports. I made some code cleaning too for better code reading and maintainance. I have commented the SPUSBDataType line because I have to find a clean and generic patch (instead of create an hard coded SPUSBDataType statement in Sysprofile.pm) to propose it to Mac::Sysprofile maintainer to make SPUSBDataType works...So there is no USB data for the moment...
I have commited all of this in Launchpad stable branch : http://
To make Controllers.pm works as expected, you need to use the latest Launchpad 1090 commit because I add a DESCRIPTION missing field in addController() subroutine from Common.pm .