# create symlink to cellphone device port tag="/dev/cellphone" modemport=`/bin/grep MODEMPORT $1` modemport=${modemport#*=} # if this connection needs the cell phone pseudo-device if [ "x$modemport" == "x$tag" ] then # if the cell phone is connected if usb_data=($(/sbin/lsusb | grep "Motorola PCS")) then # convert bus,dev to ttyUSB device ID bus=${usb_data[1]#0} bus=${bus#0} dev=${usb_data[3]#0} dev=${dev#0} dev=${dev%:} # get the current USB port from its name in the /sys path usb_port=$(ls /sys/class/usb_device/usbdev${bus}.${dev}/device/*:1.0 | grep ttyUSB) # create cellphone symlink ln -nsf /dev/$usb_port $tag fi fi