[package] libpcap: explicitely disable libnl support to prevent different build resul...
[openwrt.git] / target / linux / orion / base-files / etc / hotplug.d / usb / 10-usb
1 #!/bin/sh
2 #
3 # Copyright (C) 2009-2010 OpenWrt.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 usb_led=''
10 usb_device=''
11
12 led_set_attr() {
13 [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
14 }
15
16 usb_led_set_timer() {
17 led_set_attr "${usb_led}" 'trigger' 'timer'
18 led_set_attr "${usb_led}" 'delay_on' "$1"
19 led_set_attr "${usb_led}" 'delay_off' "$2"
20 }
21
22 usb_led_on() {
23 led_set_attr "${usb_led}" 'trigger' 'none'
24 led_set_attr "${usb_led}" 'brightness' 255
25 }
26
27 usb_led_off() {
28 led_set_attr "${usb_led}" 'trigger' 'none'
29 led_set_attr "${usb_led}" 'brightness' 0
30 }
31
32 get_usb_led() {
33 local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
34
35 case "${hardware}" in
36 'Linksys WRT350N v2')
37 usb_led='wrt350nv2:green:usb'
38 usb_device='1-1:1.0'
39 ;;
40 esac;
41 }
42
43 get_usb_led
44
45 case "${ACTION}" in
46 add)
47 # update LEDs
48 [ "${usb_device}" = "${DEVICENAME}" ] && usb_led_on
49 ;;
50 remove)
51 # update LEDs
52 [ "${usb_device}" = "${DEVICENAME}" ] && usb_led_off
53 ;;
54 esac
This page took 0.049708 seconds and 5 git commands to generate.