Magellan Linux

Contents of /alx-src/branches/alx-web-070/include/hwinfo.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7106 - (show annotations) (download)
Wed Sep 9 08:43:18 2015 UTC (8 years, 7 months ago) by niro
File size: 1021 byte(s)
-added rootfs hardware detection
1 <?
2 include('common-functions.php');
3
4 if(isset($_POST['cmd']) && isset($_POST['ip'])) {
5 $ip = $_POST['ip'];
6 $cmd = $_POST['cmd'];
7
8 if ( $cmd == 'printer' )
9 {
10 $retval = @sshdo('/usr/sbin/hwinfo --printer --short', $ip);
11 $printers = $retval[1];
12 // delete 'printer:' line
13 $printers = str_replace('printer:','',$printers);
14 $printers = str_replace('/dev/usb/lp0','usb1:',$printers);
15 $printers = str_replace('/dev/usb/lp1','usb2:',$printers);
16 $printers = str_replace('/dev/lp0','lpt1:',$printers);
17 $printers = str_replace('/dev/ttyS0','com1:',$printers);
18 $printers = str_replace('/dev/ttyS1','com2:',$printers);
19 echo strtoupper($cmd).": ".$printers;
20 }
21 else if ( $cmd == 'rootfs' )
22 {
23 $retval = @sshdo('cat /proc/mounts | grep -v "^rootfs" | grep " / " | cut -d" " -f3', $ip); $rootfs = trim($retval[1]);
24 echo "Root Filesystem Type: ".$rootfs;
25 }
26 else
27 {
28 $retval = @sshdo('/usr/sbin/alx-hwdetection '.$cmd, $ip);
29 $driver = trim($retval[1]);
30 echo strtoupper($cmd)." Driver: ".$driver;
31 }
32 }
33 ?>