--- trunk/usbip/usbippolld-sql 2007/05/10 14:13:41 179 +++ trunk/usbip/usbippolld-sql 2007/05/10 15:02:35 181 @@ -5,22 +5,25 @@ while true do - ALLCLIENTS=$(mysqldo "select ip from clients") + ALLCLIENTS=$(mysqldo "select id from clients") for client in ${ALLCLIENTS} do - if [[ $(mysqldo "select connected from clients where ip='${client}'") = 1 ]] + clientip=$(mysqldo "select ip from clients where id='${client}'") + + if [[ $(mysqldo "select connected from clients where id='${client}'") = 1 ]] then - BUSID=$(mysqldo "select busid from clients where ip='${client}'") + BUSID=$(mysqldo "select busid from clients where id='${client}'") - echo "-- polling client ${client} on dev ${BUSID}" - usbip -a ${client} ${BUSID} + echo "-- polling client #${client} - ${clientip} on dev ${BUSID}" + usbip -a ${clientip} ${BUSID} else - echo "-- client ${client} not found, removing from list" + echo "-- client #${client} - ${clientip} not found, removing from list" out=$(mktemp) - port=$(usbip -p &> ${out};grep -B3 -i "${client}" ${out} | grep Port | cut -d' ' -f2| sed "s|:||") + port=$(usbip -p &> ${out};grep -B3 -i "${clientip}" ${out} | grep Port | cut -d' ' -f2| sed "s|:||") [[ ! -z ${port} ]] && usbip -d ${port} + #mysqldo "delete from client where id='${client}'" fi sleep ${USBIP_WAIT_TIMEOUT}