Contents of /trunk/usbip/usbipdevd2
Parent Directory | Revision Log
Revision 1529 -
(show annotations)
(download)
Mon Sep 19 15:56:48 2011 UTC (13 years ago) by niro
File size: 902 byte(s)
Mon Sep 19 15:56:48 2011 UTC (13 years ago) by niro
File size: 902 byte(s)
-new dev daemon for single usbip connctions with windows hosts
1 | #!/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 | [[ -z ${USBIP_TEMP} ]] && USBIP_TEMP="/var/lib/usbipdevd" |
10 | install -d ${USBIP_TEMP} |
11 | |
12 | while true |
13 | do |
14 | BUSID=$(bind_driver --list | grep -i "${USBIP_DEVICE_ID}" | sed 's|.*busid\ \([0-9].*\)\ (${USBIP_DEVICE_ID}).*|\1|') |
15 | |
16 | if [[ -n ${BUSID} ]] |
17 | then |
18 | # abort here if the busid is the same, because the client connection is lost on new exports |
19 | if [[ -f ${USBIP_TEMP}/${USBIP_DEVICE_ID//:/_} ]] && |
20 | [[ ${BUSID} = $(< ${USBIP_TEMP}/${USBIP_DEVICE_ID//:/_}) ]] |
21 | then |
22 | echo "USBID is the same; nothing changed" |
23 | else |
24 | echo "Exporting USB Device with ID ${BUSID}" |
25 | bind_driver --usbip ${BUSID} |
26 | echo "${BUSID}" > ${USBIP_TEMP}/${USBIP_DEVICE_ID//:/_} |
27 | fi |
28 | else |
29 | echo "USB Device '${USBIP_DEVICE_ID}' not found ..." |
30 | fi |
31 | |
32 | sleep ${USBIP_WAIT_TIMEOUT} |
33 | done |