~ubuntu-branches/ubuntu/utopic/usb-modeswitch/utopic

« back to all changes in this revision

Viewing changes to .pc/03_use_udev_specifics.patch/usb_modeswitch.sh

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2014-04-07 11:39:41 UTC
  • mfrom: (17.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20140407113941-b4dwfneyd07pgijf
Tags: 2.1.1+repack0-1ubuntu1
* Merge with Debian unstable; remaining changes: (LP: #1280546)
  - patch to rewrite dispatcher to C.
  - debian/patches/redirect_dispatcher_output.patch: redirect all dispatcher
    output when called from udev to /dev/null.
  - Replace libjim depends with libpipeline-dev, libudev-dev.
* Fixed some bugs in dispatcher rewrite. (LP: #1155975)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
 
# part of usb_modeswitch 1.2.3
 
2
# part of usb_modeswitch 2.1.1
3
3
device_in()
4
4
{
5
5
        if [ ! -e /var/lib/usb_modeswitch/$1 ]; then
56
56
                        if [ -e "$id_attr" ]; then
57
57
                                echo "$v_id $p_id ff" > $id_attr
58
58
                        else
59
 
                                modprobe -r usbserial
60
 
                                modprobe usbserial "vendor=0x$v_id" "product=0x$p_id"
 
59
                                modprobe -r usbserial 2>/dev/null
 
60
                                modprobe usbserial "vendor=0x$v_id" "product=0x$p_id" 2>/dev/null
61
61
                        fi
62
62
                fi
63
63
                ) &
75
75
esac
76
76
exec 1<&- 2<&- 5<&- 7<&-
77
77
(
78
 
count=120
 
78
count=20
79
79
while [ $count != 0 ]; do
80
80
        if [ ! -e "/usr/sbin/usb_modeswitch_dispatcher" ]; then
81
81
                sleep 1
82
82
                count=$(($count - 1))
83
83
        else
84
 
                exec usb_modeswitch_dispatcher --switch-mode $1 $0 &
 
84
                if [ -e "/etc/init/usb-modeswitch-upstart.conf" ]; then
 
85
                        exec /sbin/initctl emit --no-wait usb-modeswitch-upstart UMS_PARAM=$1
 
86
                elif [ -e "/etc/systemd/system/usb_modeswitch@.service" ]; then
 
87
                        exec /usr/bin/systemctl --no-block start usb_modeswitch@$1.service
 
88
                else
 
89
                        exec /usr/sbin/usb_modeswitch_dispatcher --switch-mode $1 &
 
90
                fi
85
91
                exit 0
86
92
        fi
87
93
done