[Gllug] Dell Service Tag number
Martin A. Brooks
martin at clues.ltd.uk
Thu Jun 26 12:09:42 UTC 2003
On Thu, 2003-06-26 at 13:48, devans at presscentre.net wrote:
> Thanks for your email. Yes, I came across dmidecode, but on a PowerEdge 2450 it
> does'nt appear to work. I'm not sure why it displays 12345. To my knowledge the
> tag has not been changed.
I had to do this recently in a client's datacentre, the data ends up in
$res
#!/usr/bin/perl
# (C) 2000 Geir Inge Jensen
#
# Rewritten to be more robust on several platforms by Olav Kolbu
# 2003/03/13 - Hacked mercilessly by Mart Brooks for LON4
$|=1;
@sets = ([0xfb1e6, 0, 40, -138, 2518],
[0xfa237, 0, 40, -138, 1813],
[0xfa237, 0, 40, -140, 1813],
[0xfaf76, 0, 40, -138, 2534],
[0xfb286, 0, 40, -138, 2502],
[0xfb436, 0, 40, -138, 2486],
[0xf9fd7, 0, 40, -138, 2117],
[0xfb286, 0, 40, -138, 2518],
[0xfa227, 0, 40, -140, 1813],
[0xfa227, 0, 40, -138, 1813]);
@patterns = ('^Dell', '[:print:]', '^\w+$',
'^\d{2}/\d{2}/\d{4}$', '[:print:]');
@header = ('','','','','','') if (-t);
$nl = (-t) ? "\n" : ", ";
$/ = "\0";
open(MEM, "</dev/mem") || die "Unable to open /dev/mem: $!";
foreach $set (@sets) {
$res = $header[0] . $hostname;
$bad = $i = 0; seek(MEM, 0, 0);
foreach $offset (@$set) {
seek(MEM, $offset, 1);
#printf "\n0x%.8x: " , tell(MEM); $nl = "";
($data = <MEM>) =~ s/[ \t\0\r\n]*$//g;
#print "GOT $data\n";
if ( $data !~ $patterns[$i] ) {
$bad = 1;
last;
}
next unless ($i++ || (-t));
$data =~ s/ROM BIOS PLUS // unless (-t);
#$res .= $nl . $header[$i] . $data;
$res.="$data,";
}
last if not $bad;
}
close(MEM);
--
Martin A. Brooks, Clues Ltd
http://www.clues.ltd.uk/
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list