Annotation of /trunk/usbip/usbipdevd2
Parent Directory | Revision Log
Revision 1537 -
(hide annotations)
(download)
Mon Sep 19 17:55:43 2011 UTC (13 years, 1 month ago) by niro
File size: 1340 byte(s)
Mon Sep 19 17:55:43 2011 UTC (13 years, 1 month ago) by niro
File size: 1340 byte(s)
-support newer usbipd (>=0.1.8)
1 | niro | 1529 | #!/bin/bash |
2 | |||
3 | export LC_ALL=C | ||
4 | |||
5 | source /etc/conf.d/usbipdevd | ||
6 | |||
7 | # some sane defaults | ||
8 | [[ -z ${USBIP_POLLING_TIME} ]] && USBIP_POLLING_TIME="10" | ||
9 | |||
10 | niro | 1537 | # version 0.1.7, no parseable list cmd |
11 | if [[ -x /usr/bin/bind_driver ]] | ||
12 | then | ||
13 | BINDCMD="/usr/bin/bind_driver " | ||
14 | else | ||
15 | BINDCMD="/usr/sbin/usbip_bind_driver" | ||
16 | fi | ||
17 | |||
18 | niro | 1529 | while true |
19 | do | ||
20 | niro | 1537 | # version 0.1.7, no parseable list cmd |
21 | if [[ ${BINDCMD} = /usr/bin/bind_driver ]] | ||
22 | then | ||
23 | BUSID=$(${BINDCMD} --list | grep -i "${USBIP_DEVICE_ID}" | sed 's:.*busid\ \([0-9].*\)\ (.*:\1:') # sanitizing syntax-highlighting ) | ||
24 | BUSBINDING=$(${BINDCMD} --list | grep -A1 "${USBIP_DEVICE_ID}" | grep -- '->' | sed 's:.*->\ \(.*\):\1:') | ||
25 | else | ||
26 | BUSID=$(${BINDCMD} --list | grep "${USBIP_DEVICE_ID}" | cut -d'#' -f1 | sed 's:.*=\(.*\):\1:') | ||
27 | BUSBINDING=$(${BINDCMD} --list | grep "${USBIP_DEVICE_ID}" | cut -d'#' -f3 | sed 's:.*=\(.*\):\1:') | ||
28 | fi | ||
29 | niro | 1529 | |
30 | if [[ -n ${BUSID} ]] | ||
31 | then | ||
32 | # abort here if the busid is the same, because the client connection is lost on new exports | ||
33 | niro | 1537 | case ${BUSBINDING} in |
34 | usbip) echo "USBID is the same; nothing changed" ;; | ||
35 | none) | ||
36 | echo "Exporting USB Device with ID ${BUSID}" | ||
37 | ${BINDCMD} --usbip ${BUSID} | ||
38 | ;; | ||
39 | *) echo "Warning: unkown BUSBINDING '${BUSBINDING}' of BUSID '${BUSID}'" ;; | ||
40 | esac | ||
41 | niro | 1529 | else |
42 | echo "USB Device '${USBIP_DEVICE_ID}' not found ..." | ||
43 | fi | ||
44 | |||
45 | niro | 1537 | sleep ${USBIP_POLLING_TIME} |
46 | niro | 1529 | done |