2 # part of usb_modeswitch 1.1.9
5 if [ ! -e /var
/lib
/usb_modeswitch
/$1 ]; then
10 if [ $
(expr "$line" : "$2:$3") != 0 ]; then
13 done </var
/lib
/usb_modeswitch
/$1
14 if [ $
(expr "$line" : "$2:$3") != 0 ]; then
20 if [ $
(expr "$1" : "--.*") ]; then
30 if [ "$v_id" = "0x" ]; then
34 v_id
="$(printf %04x $(($v_id)))"
35 p_id
="$(printf %04x $(($p_id)))"
43 dir
=$
(ls -d /sys
$2/ttyUSB
* 2>/dev
/null
)
44 if [ ! -z "$dir" ]; then
48 device_in
"bind_list" $v_id $p_id
49 if [ "$?" = "1" ]; then
50 id_attr
="/sys/bus/usb-serial/drivers/option1/new_id"
51 if [ ! -e "$id_attr" ]; then
52 /sbin
/modprobe option
2>/dev
/null || true
54 if [ -e "$id_attr" ]; then
55 echo "$v_id $p_id" > $id_attr
57 /sbin
/modprobe
-r usbserial
58 /sbin
/modprobe usbserial
"vendor=0x$v_id" "product=0x$p_id"
65 device_in
"link_list" $v_id $p_id
66 if [ "$?" = "1" ]; then
67 if [ -e "/usr/bin/tclsh" ]; then
68 exec /usr
/bin
/tclsh
/usr
/sbin
/usb_modeswitch_dispatcher
$1 $2 $v_id $p_id 2>/dev
/null
74 exec 1<&- 2<&- 5<&- 7<&-
77 while [ $count != 0 ]; do
78 if [ ! -e "/usr/bin/tclsh" ]; then
82 exec /usr
/bin
/tclsh
/usr
/sbin
/usb_modeswitch_dispatcher
"$@" 2>/dev
/null
&