Contents of /trunk/usbip/get_device.sh
Parent Directory | Revision Log
Revision 139 -
(show annotations)
(download)
(as text)
Tue May 8 07:28:12 2007 UTC (16 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 755 byte(s)
Tue May 8 07:28:12 2007 UTC (16 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 755 byte(s)
-import of development scripts
1 | #!/bin/bash |
2 | |
3 | SERVER="128.20.180.180" |
4 | DEVID=046d:c805 |
5 | CLIENTIP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
6 | |
7 | tmp=/var/tmp/usbip |
8 | install -d ${tmp} |
9 | |
10 | if [[ -n $(lsusb | grep -i ${DEVID}) ]] |
11 | then |
12 | echo "Logitech Pen Connected" |
13 | fi |
14 | |
15 | BUSID=$(bind_driver --list | grep -i ${DEVID}| cut -d ' ' -f4) |
16 | echo "BUSID: ${BUSID}" |
17 | |
18 | if [[ -n ${BUSID} ]] |
19 | then |
20 | |
21 | # abort is nothing has changed |
22 | if [[ -f ${tmp}/${CLIENTIP}.txt ]] && |
23 | [[ ${BUSID} = $(< ${tmp}/${CLIENTIP}.txt) ]] |
24 | then |
25 | echo "USBID is the same; nothing changed" |
26 | exit 0 |
27 | fi |
28 | |
29 | echo "exporting Logitech Pen with ID ${BUSID}" |
30 | bind_driver --usbip ${BUSID} |
31 | |
32 | echo "${BUSID}" > ${tmp}/${CLIENTIP}.txt |
33 | scp ${tmp}/${CLIENTIP}.txt root@${SERVER}:/root/usbclients/ |
34 | [[ -d ${tmp} ]] && rm -rf ${temp} |
35 | fi |