Release beta!!!
This procedure permit get the uniqueid for each modem gsm.
# cat /etc/udev/rules.d/10-gammu.rules
KERNEL=="ttyUSB*", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", PROGRAM="/usr/local/sbin/port_manager.php %k", SYMLINK+="%c", GROUP="uucp", MODE="0660"
# cat /usr/local/sbin/port_manager.php
#!/usr/bin/php -q
<?php
if(isset($argv[1]))
{
$port = trim($argv[1]);
$file = "/etc/gammurc";
$config = "[gammu]\nport = /dev/".$port."\nconnection = at\n";
file_put_contents($file, $config);
@exec("/usr/bin/gammu nothing --identify", $rs);
$r = "";
for($i=0;$i<count($rs);$i++)
{
$r.=$rs[$i]."\r\n";
}
if (preg_match("/IMEI(.+) : (.+)/",$r,$s)) {
$IMEI=trim(str_replace("\n","",$s[2]));
$output = file_get_contents("/usr/local/sbin/table.txt");
$output = explode("\n",$output);
foreach ($output as $value){
list($mapping, $imei) = preg_split('/,/',$value);
//$device = "/dev/".$mapping;
if ( $IMEI == $imei ) {
echo $mapping;
exit (0);
}
}
}
echo $port;
}
?>
# cat /usr/local/sbin/table.txt
port1,355112022089381
port2,356368024112600
# ls -al port2
lrwxrwxrwx 1 root root 7 2010-06-04 11:57 port2 -> ttyUSB2