Magellan Linux

Diff of /trunk/usbip/usbipdevd-sql

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 174 by niro, Wed May 9 15:05:23 2007 UTC revision 186 by niro, Tue May 15 14:52:40 2007 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3  source /etc/conf.d/usbipdevd  source /etc/conf.d/usbipdevd
   
 SQL_USER=jomo  
 SQL_PASS=j0m0  
 SQL_HOST=128.20.41.110  
 SQL_DB=jomo  
   
4  source /usr/lib/alxconfig-ng/functions/mysqlfunctions  source /usr/lib/alxconfig-ng/functions/mysqlfunctions
5    
6  CLIENTIP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')  CLIENTIP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')
7    
8  mysqldo "insert into clients (ip,connected) values('128.20.39.217','1')"  # create a new ip entry if none exist
9    if [[ -z $(mysqldo "select ip from clients where ip='${CLIENTIP}'") ]]
10    then
11     mysqldo "insert into clients (ip,connected) values('${CLIENTIP}','0')"
12    fi
13    
14  while true  while true
15  do  do
# Line 29  do Line 27  do
27   else   else
28   echo "exporting Logitech Pen with ID ${BUSID}"   echo "exporting Logitech Pen with ID ${BUSID}"
29   bind_driver --usbip ${BUSID}   bind_driver --usbip ${BUSID}
30   mysqldo "update clients set ip='${CLIENTIP}', connected='1', busid='${BUSID}' where ip='${CLIENTIP}'"   mysqldo "update clients set connected='1', busid='${BUSID}' where ip='${CLIENTIP}'"
31   fi   fi
32   else   else
33   echo "No Logitech Pen (${USBIP_DEVICE_ID}) found ..."   echo "No Logitech Pen (${USBIP_DEVICE_ID}) found ..."
34   mysqldo "update clients set ip='${CLIENTIP}', connected='0', busid='${BUSID}' where ip='${CLIENTIP}'"   mysqldo "update clients set connected='0', busid='${BUSID}' where ip='${CLIENTIP}'"
35   fi   fi
36    
37   sleep ${USBIP_WAIT_TIMEOUT}   sleep ${USBIP_WAIT_TIMEOUT}
38  done  done
   
 mysqldo "delete from clients where ip='${CLIENTIP}')"  
   

Legend:
Removed from v.174  
changed lines
  Added in v.186