diff options
Diffstat (limited to 'openembedded/packages/linux-hotplug/files/usbd.agent')
-rwxr-xr-x | openembedded/packages/linux-hotplug/files/usbd.agent | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/openembedded/packages/linux-hotplug/files/usbd.agent b/openembedded/packages/linux-hotplug/files/usbd.agent new file mode 100755 index 0000000000..6613b4810a --- /dev/null +++ b/openembedded/packages/linux-hotplug/files/usbd.agent | |||
@@ -0,0 +1,63 @@ | |||
1 | #!/bin/ash | ||
2 | |||
3 | # DEBUG=yes export DEBUG | ||
4 | #set -x | ||
5 | |||
6 | . /etc/hotplug/hotplug.functions | ||
7 | . /etc/default/usbd | ||
8 | cd $HOTPLUG_DIR | ||
9 | |||
10 | [ -z "$INTERFACE" ] && exit 1 | ||
11 | [ -z "$ACTION" ] && exit 1 | ||
12 | [ -z "$usbdmodule" ] && exit 0 | ||
13 | |||
14 | debug_mesg "USBD $ACTION Action Recived" | ||
15 | |||
16 | case $INTERFACE in | ||
17 | |||
18 | monitor) | ||
19 | case $ACTION in | ||
20 | # called to load all usb device modules | ||
21 | load) | ||
22 | modprobe usbdcore | ||
23 | modprobe net_fd | ||
24 | modprobe $usbdmodule | ||
25 | ;; | ||
26 | |||
27 | # called to handle suspend power management event | ||
28 | suspend) | ||
29 | rmmod $usbdmodule | ||
30 | ;; | ||
31 | |||
32 | # called to reload after resume power management event | ||
33 | restore-loaded) | ||
34 | modprobe $usbdmodule | ||
35 | sleep 2 | ||
36 | ;; | ||
37 | |||
38 | # called to unload after resume power management event | ||
39 | restore-unloaded) | ||
40 | modprobe -r net_fd | ||
41 | ;; | ||
42 | |||
43 | # called to unload all usb device modules | ||
44 | unload) | ||
45 | modprobe -r $usbdmodule | ||
46 | ;; | ||
47 | |||
48 | *) | ||
49 | debug_mesg USBD $ACTION event not handled | ||
50 | exit 1 | ||
51 | ;; | ||
52 | esac | ||
53 | ;; | ||
54 | *) | ||
55 | debug_mesg USBD $INTERFACE-$ACTION event not handled | ||
56 | exit 1 | ||
57 | ;; | ||
58 | esac | ||
59 | |||
60 | [ -e /proc/usb-monitor ] && echo "Done" > /proc/usb-monitor | ||
61 | |||
62 | exit 0 | ||
63 | |||