Subversion Repositories ALCASAR

Rev

Rev 2853 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2853 Rev 2915
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: autoregistration.php 2853 2020-07-19 21:50:07Z rexy $
2
# $Id: autoregistration.php 2915 2021-02-07 22:59:23Z rexy $
3
 
3
 
4
#Define
4
#Define
5
$gammu_wrong_port = "";
5
$gammu_wrong_port = "";
6
$gammu_puk = "";
6
$gammu_puk = "";
7
$gammu_simfail = "";
7
$gammu_simfail = "";
Line 24... Line 24...
24
# Test if a modem is plugged on serial-usb port
24
# Test if a modem is plugged on serial-usb port
25
$open_port=exec("ls /dev/ttyUSB*",$openned_ports); // list of USB-Serial ports openned by a modem
25
$open_port=exec("ls /dev/ttyUSB*",$openned_ports); // list of USB-Serial ports openned by a modem
26
if (!empty($open_port))
26
if (!empty($open_port))
27
{
27
{
28
	$find_key="true";
28
	$find_key="true";
29
	$vendor=exec("udevadm info -n $openned_ports[1] | grep 'MODEL=' | cut -d'=' -f2"); 
29
	$vendor=exec("udevadm info -n $openned_ports[0] | grep 'MODEL=' | cut -d'=' -f2"); 
30
	$model=exec("udevadm info -n $openned_ports[1] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
30
	$model=exec("udevadm info -n $openned_ports[0] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
31
	$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep '^port\s\?=' | cut -d ' ' -f3"); // Gammu_smsd listen port 
31
	$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep '^port\s\?=' | cut -d ' ' -f3"); // Gammu_smsd listen port 
32
	while ( list(,$row) = each($openned_ports))
32
	while ( list(,$row) = each($openned_ports))
33
	{
33
	{
34
		if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ?
34
		if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ?
35
		{
35
		{