fusioninventory / fusioninventory-for-glpi

FusionInventory plugin for GLPI
http://www.FusionInventory.org/
GNU Affero General Public License v3.0
361 stars 148 forks source link

Acer screen serial number #875

Open ddurieux opened 8 years ago

ddurieux commented 8 years ago

Author Name: Gonéri Le Bouder (Gonéri Le Bouder) Original Redmine Issue: 1673, http://forge.fusioninventory.org/issues/1673 Original Date: 2012-05-20


Remi Collet did a PHP version of his hack to get the full serial number of the Acer monitor. It would be great to integrate the hack in the next release (this guy is deserve a lot of kudo!):

    <?php
    $base64 = "AP///////wAEcmkADDwAlCgTAQNoKRd4yj2FplZKmiQSUFS/b4BxT4FAgYCBwIEAAQEBAQEBZiFWqlEAHjBGjzMAmuYQAAAeAAAA/QA3TB9QDgAKICAgICAgAAAA/ABYMTkzSFEKCgoKCgoKAAAA/wBMRUswRDA5OTg1NDUKAGoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
    $found = "LEK0D0998545";
    $want = "LEK0D09994003C0C8545";

    $edid = base64_decode($base64);
    $len = strlen($base64);
    $len = strlen($edid);

    $sn = unpack("V", substr($edid, 12, 4));
    $sn = $sn[1];

    $fab = unpack("n", substr($edid, 8, 2));
    $fab = chr(64+(($fab[1]&0x7c00)>>10)).chr(64+(($fab[1]&0x3e0)>>5)).chr(64+($fab[1]&0x1f));

    $serial = false;
    foreach (array(54,72,90,108) as $i) {
    $zero = unpack("n", substr($edid, $i, 2));
    $type = unpack("C", substr($edid, $i+3, 1));
    if ($zero[1]==0 && $type[1]==255) {
    $tmp = unpack("a*", substr($edid, $i+5, 13)."\0");
    $serial = trim($tmp[1]);
    }
    }
    printf("Manufact: %s\nSerial 1: %d\nSerial 2: %s\n", $fab, $sn, $serial);
    if ($serial && $fab="ACR" && strlen($serial)==12) {
    $full = substr($serial, 0, 8) . sprintf("%08X", $sn) . substr($serial, 8, 4);
    printf("Full S/N: %s\n", $full);
    }
ddurieux commented 8 years ago

Original Redmine Comment Author Name: David Durieux (@ddurieux) Original Date: 2012-05-21T11:00:50Z


Why not put this patch in the agent instead of server (may apply in this case to different servers use Agent)?

ddurieux commented 8 years ago

Original Redmine Comment Author Name: Gonéri Le Bouder (Gonéri Le Bouder) Original Date: 2012-05-22T08:01:32Z


I believe we should do both:

Since 2.1.x, the agent send the complet EDID information. In general, it's easier to upgrade the server. That's the reason why I think the agent should not try to understand by iteself what an EDID string is.

On the other side, I make sense to adjust the agent EDID parsing for those who don't use FusionInventory for GLPI (#1607).

ddurieux commented 8 years ago

Original Redmine Comment Author Name: David Durieux (@ddurieux) Original Date: 2012-05-22T08:02:56Z


Yes so patch the server is not good idea, best solution for all is to patch the agent

ddurieux commented 8 years ago

Original Redmine Comment Author Name: Gonéri Le Bouder (Gonéri Le Bouder) Original Date: 2012-05-22T08:04:37Z


The patch is short and easy to test, I don't get your point here.