Browse Source

- mdev-scripts: use LOG* aliases from /etc/init.d/globals

master
vanhofen 7 years ago
parent
commit
952afcf131
  1. 32
      skel-root/coolstream/hd1/lib/mdev/common/log
  2. 7
      skel-root/coolstream/hd1/lib/mdev/common/mdevlog
  3. 5
      skel-root/coolstream/hd1/lib/mdev/common/mdevmodule
  4. 5
      skel-root/coolstream/hd1/lib/mdev/common/mdevprobe
  5. 22
      skel-root/coolstream/hd1/lib/mdev/fs/mount
  6. 8
      skel-root/coolstream/hd1/lib/mdev/net/wlan
  7. 3
      skel-root/coolstream/hd1/lib/mdev/usb/eventvars
  8. 66
      skel-root/coolstream/hd1/lib/mdev/usb/usbcontrol
  9. 32
      skel-root/coolstream/hd2/lib/mdev/common/log
  10. 7
      skel-root/coolstream/hd2/lib/mdev/common/mdevlog
  11. 5
      skel-root/coolstream/hd2/lib/mdev/common/mdevmodule
  12. 5
      skel-root/coolstream/hd2/lib/mdev/common/mdevprobe
  13. 22
      skel-root/coolstream/hd2/lib/mdev/fs/mount
  14. 8
      skel-root/coolstream/hd2/lib/mdev/net/wlan
  15. 3
      skel-root/coolstream/hd2/lib/mdev/usb/eventvars
  16. 66
      skel-root/coolstream/hd2/lib/mdev/usb/usbcontrol

32
skel-root/coolstream/hd1/lib/mdev/common/log

@ -1,32 +0,0 @@
#!/bin/sh
# vim: se ft=sh:
log_debug () {
logger -t "${0##*/}[$$]" -p local0.debug "$@"
}
log_error () {
logger -t "${0##*/}[$$]" -p local0.error "$@"
}
log_info () {
logger -t "${0##*/}[$$]" -p local0.info "$@"
}
log_warn () {
logger -t "${0##*/}[$$]" -p local0.warn "$@"
}
# can't get the return code from a piped process
# cat /etc/passwd | log_error => $? is from log_error not cat ;(
log_rt_error () {
local fifo=/tmp/.log_rt_error_$$
trap "trap - HUP QUIT TERM CHLD; log_error exited prematurely; rm -f $fifo; exit 1" \
HUP QUIT TERM
mkfifo -m 600 $fifo
trap "trap - HUP QUIT TERM CHLD; rm -f $fifo" CHLD
log_error <$fifo &
"$@" 2>$fifo
}
log_clean () {
unset -f log_debug log_error log_info log_rt_error
}

7
skel-root/coolstream/hd1/lib/mdev/common/mdevlog

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
# log only when requested # log only when requested
[ 0 -eq $# ] && exit 0 [ $# -eq 0 ] && exit 0
. /lib/mdev/common/log . /etc/init.d/globals
env | egrep -v '^(HOME|PATH|PWD|CONFIG_.*)=' | log_debug
env | egrep -v '^(HOME|PATH|PWD|CONFIG_.*)=' | LOGDEBUG

5
skel-root/coolstream/hd1/lib/mdev/common/mdevmodule

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
. /lib/mdev/common/log . /etc/init.d/globals
log_info "${ACTION:-scan} module chain $@"
LOGINFO "${ACTION:-scan} module chain $@"
/lib/mdev/common/mdevprobe "$@" /lib/mdev/common/mdevprobe "$@"

5
skel-root/coolstream/hd1/lib/mdev/common/mdevprobe

@ -2,8 +2,9 @@
[ "$ACTION" = remove ] && action='-r -a' [ "$ACTION" = remove ] && action='-r -a'
. /lib/mdev/common/log . /etc/init.d/globals
for module in "$@"; do for module in "$@"; do
modprobe $action $module && modprobe $action $module &&
log_info "${ACTION:-scan} module $module succeed" LOGINFO "${ACTION:-scan} module $module succeed"
done done

22
skel-root/coolstream/hd1/lib/mdev/fs/mount

@ -2,8 +2,7 @@
# based on script from http://gitorious.org/neutrino-hd/buildsystem-cs # based on script from http://gitorious.org/neutrino-hd/buildsystem-cs
. /lib/mdev/common/log . /etc/init.d/globals
MOUNTBASE=/media MOUNTBASE=/media
MOUNTPOINT="$MOUNTBASE/$MDEV" MOUNTPOINT="$MOUNTBASE/$MDEV"
@ -11,8 +10,9 @@ ROOTDEV=$(readlink /dev/root)
# do not add or remove root device again... # do not add or remove root device again...
[ "$ROOTDEV" = "$MDEV" ] && exit 0 [ "$ROOTDEV" = "$MDEV" ] && exit 0
if [ -e /tmp/.nomdevmount ]; then if [ -e /tmp/.nomdevmount ]; then
log_info "no action on $MDEV -- /tmp/.nomdevmount exists" LOGINFO "no action on $MDEV -- /tmp/.nomdevmount exists"
exit 0 exit 0
fi fi
@ -65,20 +65,20 @@ case "$ACTION" in
if [ ${#MDEV} = 3 ]; then # sda, sdb, sdc => whole drive if [ ${#MDEV} = 3 ]; then # sda, sdb, sdc => whole drive
PARTS=$(sed -n "/ ${MDEV}[0-9]$/{s/ *[0-9]* *[0-9]* * [0-9]* //;p}" /proc/partitions) PARTS=$(sed -n "/ ${MDEV}[0-9]$/{s/ *[0-9]* *[0-9]* * [0-9]* //;p}" /proc/partitions)
if [ -n "$PARTS" ]; then if [ -n "$PARTS" ]; then
log_info "drive has partitions $PARTS, not trying to mount $MDEV" LOGINFO "drive has partitions $PARTS, not trying to mount $MDEV"
exit 0 exit 0
fi fi
fi fi
if grep -q "/dev/$MDEV" /proc/mounts; then if grep -q "/dev/$MDEV" /proc/mounts; then
log_info "/dev/$MDEV already mounted - not mounting again" LOGINFO "/dev/$MDEV already mounted - not mounting again"
exit 0 exit 0
fi fi
log_info "[$ACTION] mounting /dev/$MDEV to $MOUNTPOINT" LOGINFO "[$ACTION] mounting /dev/$MDEV to $MOUNTPOINT"
# remove old mountpoint symlinks we might have for this device # remove old mountpoint symlinks we might have for this device
rm -f $MOUNTPOINT rm -f $MOUNTPOINT
mkdir -p $MOUNTPOINT mkdir -p $MOUNTPOINT
for i in 1 2 3 4 5 6 7 8 9; do # retry 9 times for slow devices for i in 1 2 3 4 5 6 7 8 9; do # retry 9 times for slow devices
# log_info "mounting /dev/$MDEV to $MOUNTPOINT try $i" # LOGINFO "mounting /dev/$MDEV to $MOUNTPOINT try $i"
OUT1=$(mount -t auto /dev/$MDEV $MOUNTPOINT 2>&1 >/dev/null) OUT1=$(mount -t auto /dev/$MDEV $MOUNTPOINT 2>&1 >/dev/null)
RET1=$? RET1=$?
[ $RET1 = 0 ] && break [ $RET1 = 0 ] && break
@ -87,8 +87,8 @@ case "$ACTION" in
if [ $RET1 = 0 ]; then if [ $RET1 = 0 ]; then
create_symlinks create_symlinks
else else
log_warn "mount /dev/$MDEV $MOUNTPOINT failed with $RET1" LOGWARN "mount /dev/$MDEV $MOUNTPOINT failed with $RET1"
log_warn " $OUT1" LOGWARN " $OUT1"
rmdir $MOUNTPOINT rmdir $MOUNTPOINT
fi fi
if [ -x /bin/mdev_helper ]; then if [ -x /bin/mdev_helper ]; then
@ -96,7 +96,7 @@ case "$ACTION" in
fi fi
;; ;;
remove) remove)
log_info "[$ACTION] unmounting $MOUNTBASE/$MDEV" LOGINFO "[$ACTION] unmounting $MOUNTBASE/$MDEV"
grep -q "^/dev/$MDEV " /proc/mounts || exit 0 # not mounted... grep -q "^/dev/$MDEV " /proc/mounts || exit 0 # not mounted...
umount -lf $MOUNTBASE/$MDEV umount -lf $MOUNTBASE/$MDEV
RET=$? RET=$?
@ -104,7 +104,7 @@ case "$ACTION" in
rmdir $MOUNTPOINT rmdir $MOUNTPOINT
remove_symlinks remove_symlinks
else else
log_warn "umount $MOUNTBASE/$MDEV failed with $RET" LOGWARN "umount $MOUNTBASE/$MDEV failed with $RET"
fi fi
if [ -x /bin/mdev_helper ]; then if [ -x /bin/mdev_helper ]; then
/bin/mdev_helper /bin/mdev_helper

8
skel-root/coolstream/hd1/lib/mdev/net/wlan

@ -1,19 +1,19 @@
#!/bin/sh #!/bin/sh
. /lib/mdev/common/log . /etc/init.d/globals
case "$ACTION" in case "$ACTION" in
add|"") add|"")
if [ -s /etc/wpa_supplicant.conf ]; then if [ -s /etc/wpa_supplicant.conf ]; then
log_info "trying to bring $MDEV up" LOGINFO "trying to bring $MDEV up"
ifup $MDEV ifup $MDEV
else else
log_warn "/etc/wpa_supplicant.conf missing or empty, not trying to bring $MDEV up" LOGWARN "/etc/wpa_supplicant.conf missing or empty, not trying to bring $MDEV up"
fi fi
;; ;;
remove) remove)
log_info "trying to bring $MDEV down" LOGINFO "trying to bring $MDEV down"
ifdown $MDEV ifdown $MDEV
;; ;;
esac esac

3
skel-root/coolstream/hd1/lib/mdev/usb/eventvars

@ -1,5 +1,4 @@
#!/bin/false #!/bin/false
# vim: se ft=sh:
for path in $(find /sys/devices -name "$MDEV" 2>/dev/null); do for path in $(find /sys/devices -name "$MDEV" 2>/dev/null); do
DEVPATH=${path#/sys} DEVPATH=${path#/sys}
@ -23,7 +22,7 @@ INTERFACE=$(echo $MODALIAS | parse_interface)
for var in DEVPATH MODALIAS TYPE PRODUCT INTERFACE; do for var in DEVPATH MODALIAS TYPE PRODUCT INTERFACE; do
if [ -z "$(eval "echo \$${var}")" ]; then if [ -z "$(eval "echo \$${var}")" ]; then
logerror "Could not set uevent environment variable $var" LOGERROR "Could not set uevent environment variable $var"
exit 1 exit 1
fi fi
done done

66
skel-root/coolstream/hd1/lib/mdev/usb/usbcontrol

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
. /lib/mdev/common/log . /etc/init.d/globals
# setup environment for cold plug events # setup environment for coldplug events
[ -z "$ACTION" ] && . /lib/mdev/usb/eventvars [ -z "$ACTION" ] && . /lib/mdev/usb/eventvars
# get proper product and manufacturer description (only works for ACTION=add) # get proper product and manufacturer description (only works for ACTION=add)
@ -23,96 +23,96 @@ idVendor=$(echo ${idVendor} | sed 's/^[0]*//' | tr [:upper:] [:lower:])
idProduct=$(echo ${idProduct} | sed 's/^[0]*//' | tr [:upper:] [:lower:]) idProduct=$(echo ${idProduct} | sed 's/^[0]*//' | tr [:upper:] [:lower:])
channel=${MDEV%:1.0} channel=${MDEV%:1.0}
log_info "${ACTION} $channel ${manufacturer:-$idVendor} ${product:-$idProduct}" LOGINFO "${ACTION} $channel ${manufacturer:-$idVendor} ${product:-$idProduct}"
# for debug # for debug
#log_info "ACTION=${ACTION}" #LOGINFO "ACTION=${ACTION}"
#log_info "MDEV=${MDEV}" #LOGINFO "MDEV=${MDEV}"
#log_info "DEVPATH=${DEVPATH}" #LOGINFO "DEVPATH=${DEVPATH}"
#log_info "INTERFACE=${INTERFACE}" #LOGINFO "INTERFACE=${INTERFACE}"
#log_info "MODALIAS=${MODALIAS}" #LOGINFO "MODALIAS=${MODALIAS}"
#log_info "PRODUCT=${product} idProduct=${idProduct}" #LOGINFO "PRODUCT=${product} idProduct=${idProduct}"
#log_info "MANUFACTURER=${manufacturer} idVendor=${idVendor}" #LOGINFO "MANUFACTURER=${manufacturer} idVendor=${idVendor}"
# http://en.wikipedia.org/wiki/Universal_Serial_Bus#Device_classes # http://en.wikipedia.org/wiki/Universal_Serial_Bus#Device_classes
# http://www.usb.org/developers/defined_class # http://www.usb.org/developers/defined_class
[ 0 -eq "${TYPE%%/*}" ] && TYPE=$INTERFACE [ 0 -eq "${TYPE%%/*}" ] && TYPE=$INTERFACE
log_info "type ${TYPE}" LOGINFO "type ${TYPE}"
case $TYPE in case $TYPE in
1/*/*) 1/*/*)
log_info "$channel USB Audio Interface" LOGINFO "$channel USB Audio Interface"
;; ;;
2/*/*) 2/*/*)
log_info "$channel Communications and CDC Control" LOGINFO "$channel Communications and CDC Control"
;; ;;
3/*/*) 3/*/*)
log_info "$channel HID (Human Interface Device)" LOGINFO "$channel HID (Human Interface Device)"
# precheck vendor id for unsupported DPF in bootloader mode # precheck vendor id for unsupported DPF in bootloader mode
if [ "$idVendor" == "1908" ]; then if [ "$idVendor" == "1908" ]; then
service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct} service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct}
fi fi
;; ;;
5/*/*) 5/*/*)
log_info "$channel Physical Interface" LOGINFO "$channel Physical Interface"
;; ;;
6/*/*) 6/*/*)
log_info "$channel Image Interface" LOGINFO "$channel Image Interface"
;; ;;
7/*/*) 7/*/*)
log_info "$channel Printer Interface" LOGINFO "$channel Printer Interface"
;; ;;
8/*/*) 8/*/*)
log_info "$channel Mass Storage Interface" LOGINFO "$channel Mass Storage Interface"
# precheck vendor id for supported SPFs # precheck vendor id for supported SPFs
if [ "$idVendor" == "4e8" ]; then if [ "$idVendor" == "4e8" ]; then
service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct} service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct}
fi fi
;; ;;
9/*/*) 9/*/*)
log_info "$channel HUB Device" LOGINFO "$channel HUB Device"
;; ;;
10/*/*) 10/*/*)
log_info "$channel CDC Data Interface" LOGINFO "$channel CDC Data Interface"
;; ;;
11/*/*) 11/*/*)
log_info "$channel Smart Card Interface" LOGINFO "$channel Smart Card Interface"
;; ;;
13/*/*) 13/*/*)
log_info "$channel Content Security Interface" LOGINFO "$channel Content Security Interface"
;; ;;
14/*/*) 14/*/*)
log_info "$channel Video Interface" LOGINFO "$channel Video Interface"
;; ;;
15/*/*) 15/*/*)
log_info "$channel Personal Healthcare Interface" LOGINFO "$channel Personal Healthcare Interface"
;; ;;
16/*/*) 16/*/*)
log_info "$channel usb Audio/Video Devices Interface" LOGINFO "$channel usb Audio/Video Devices Interface"
;; ;;
17/*/*) 17/*/*)
log_info "$channel Billboard Device Class" LOGINFO "$channel Billboard Device Class"
;; ;;
220/*/*) 220/*/*)
log_info "$channel Diagnostic Device" LOGINFO "$channel Diagnostic Device"
;; ;;
224/*/*) 224/*/*)
log_info "$channel Wireless Controller Interface" LOGINFO "$channel Wireless Controller Interface"
;; ;;
239/*/*) 239/*/*)
log_info "$channel Miscellaneous" LOGINFO "$channel Miscellaneous"
;; ;;
254/*/*) 254/*/*)
log_info "$channel Application Specific" LOGINFO "$channel Application Specific"
;; ;;
255/*/*) 255/*/*)
log_info "$channel Vendor Specific" LOGINFO "$channel Vendor Specific"
# precheck vendor id for supported DPFs and SPFs # pre-check vendor id for supported DPFs and SPFs
if [ "$idVendor" = "1908" -o "$idVendor" == "4e8" ]; then if [ "$idVendor" = "1908" -o "$idVendor" == "4e8" ]; then
service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct} service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct}
fi fi
;; ;;
*) *)
log_info "FALLBACK: $channel device $MODALIAS" LOGINFO "FALLBACK: $channel device $MODALIAS"
;; ;;
esac esac

32
skel-root/coolstream/hd2/lib/mdev/common/log

@ -1,32 +0,0 @@
#!/bin/sh
# vim: se ft=sh:
log_debug () {
logger -t "${0##*/}[$$]" -p local0.debug "$@"
}
log_error () {
logger -t "${0##*/}[$$]" -p local0.error "$@"
}
log_info () {
logger -t "${0##*/}[$$]" -p local0.info "$@"
}
log_warn () {
logger -t "${0##*/}[$$]" -p local0.warn "$@"
}
# can't get the return code from a piped process
# cat /etc/passwd | log_error => $? is from log_error not cat ;(
log_rt_error () {
local fifo=/tmp/.log_rt_error_$$
trap "trap - HUP QUIT TERM CHLD; log_error exited prematurely; rm -f $fifo; exit 1" \
HUP QUIT TERM
mkfifo -m 600 $fifo
trap "trap - HUP QUIT TERM CHLD; rm -f $fifo" CHLD
log_error <$fifo &
"$@" 2>$fifo
}
log_clean () {
unset -f log_debug log_error log_info log_rt_error
}

7
skel-root/coolstream/hd2/lib/mdev/common/mdevlog

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
# log only when requested # log only when requested
[ 0 -eq $# ] && exit 0 [ $# -eq 0 ] && exit 0
. /lib/mdev/common/log . /etc/init.d/globals
env | egrep -v '^(HOME|PATH|PWD|CONFIG_.*)=' | log_debug
env | egrep -v '^(HOME|PATH|PWD|CONFIG_.*)=') | LOGDEBUG

5
skel-root/coolstream/hd2/lib/mdev/common/mdevmodule

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
. /lib/mdev/common/log . /etc/init.d/globals
log_info "${ACTION:-scan} module chain $@"
LOGINFO "${ACTION:-scan} module chain $@"
/lib/mdev/common/mdevprobe "$@" /lib/mdev/common/mdevprobe "$@"

5
skel-root/coolstream/hd2/lib/mdev/common/mdevprobe

@ -2,8 +2,9 @@
[ "$ACTION" = remove ] && action='-r -a' [ "$ACTION" = remove ] && action='-r -a'
. /lib/mdev/common/log . /etc/init.d/globals
for module in "$@"; do for module in "$@"; do
modprobe $action $module && modprobe $action $module &&
log_info "${ACTION:-scan} module $module succeed" LOGINFO "${ACTION:-scan} module $module succeed"
done done

22
skel-root/coolstream/hd2/lib/mdev/fs/mount

@ -2,8 +2,7 @@
# based on script from http://gitorious.org/neutrino-hd/buildsystem-cs # based on script from http://gitorious.org/neutrino-hd/buildsystem-cs
. /lib/mdev/common/log . /etc/init.d/globals
MOUNTBASE=/media MOUNTBASE=/media
MOUNTPOINT="$MOUNTBASE/$MDEV" MOUNTPOINT="$MOUNTBASE/$MDEV"
@ -11,8 +10,9 @@ ROOTDEV=$(readlink /dev/root)
# do not add or remove root device again... # do not add or remove root device again...
[ "$ROOTDEV" = "$MDEV" ] && exit 0 [ "$ROOTDEV" = "$MDEV" ] && exit 0
if [ -e /tmp/.nomdevmount ]; then if [ -e /tmp/.nomdevmount ]; then
log_info "no action on $MDEV -- /tmp/.nomdevmount exists" LOGINFO "no action on $MDEV -- /tmp/.nomdevmount exists"
exit 0 exit 0
fi fi
@ -65,20 +65,20 @@ case "$ACTION" in
if [ ${#MDEV} = 3 ]; then # sda, sdb, sdc => whole drive if [ ${#MDEV} = 3 ]; then # sda, sdb, sdc => whole drive
PARTS=$(sed -n "/ ${MDEV}[0-9]$/{s/ *[0-9]* *[0-9]* * [0-9]* //;p}" /proc/partitions) PARTS=$(sed -n "/ ${MDEV}[0-9]$/{s/ *[0-9]* *[0-9]* * [0-9]* //;p}" /proc/partitions)
if [ -n "$PARTS" ]; then if [ -n "$PARTS" ]; then
log_info "drive has partitions $PARTS, not trying to mount $MDEV" LOGINFO "drive has partitions $PARTS, not trying to mount $MDEV"
exit 0 exit 0
fi fi
fi fi
if grep -q "/dev/$MDEV" /proc/mounts; then if grep -q "/dev/$MDEV" /proc/mounts; then
log_info "/dev/$MDEV already mounted - not mounting again" LOGINFO "/dev/$MDEV already mounted - not mounting again"
exit 0 exit 0
fi fi
log_info "[$ACTION] mounting /dev/$MDEV to $MOUNTPOINT" LOGINFO "[$ACTION] mounting /dev/$MDEV to $MOUNTPOINT"
# remove old mountpoint symlinks we might have for this device # remove old mountpoint symlinks we might have for this device
rm -f $MOUNTPOINT rm -f $MOUNTPOINT
mkdir -p $MOUNTPOINT mkdir -p $MOUNTPOINT
for i in 1 2 3 4 5 6 7 8 9; do # retry 9 times for slow devices for i in 1 2 3 4 5 6 7 8 9; do # retry 9 times for slow devices
# log_info "mounting /dev/$MDEV to $MOUNTPOINT try $i" # LOGINFO "mounting /dev/$MDEV to $MOUNTPOINT try $i"
OUT1=$(mount -t auto /dev/$MDEV $MOUNTPOINT 2>&1 >/dev/null) OUT1=$(mount -t auto /dev/$MDEV $MOUNTPOINT 2>&1 >/dev/null)
RET1=$? RET1=$?
[ $RET1 = 0 ] && break [ $RET1 = 0 ] && break
@ -87,8 +87,8 @@ case "$ACTION" in
if [ $RET1 = 0 ]; then if [ $RET1 = 0 ]; then
create_symlinks create_symlinks
else else
log_warn "mount /dev/$MDEV $MOUNTPOINT failed with $RET1" LOGWARN "mount /dev/$MDEV $MOUNTPOINT failed with $RET1"
log_warn " $OUT1" LOGWARN " $OUT1"
rmdir $MOUNTPOINT rmdir $MOUNTPOINT
fi fi
if [ -x /bin/mdev_helper ]; then if [ -x /bin/mdev_helper ]; then
@ -96,7 +96,7 @@ case "$ACTION" in
fi fi
;; ;;
remove) remove)
log_info "[$ACTION] unmounting $MOUNTBASE/$MDEV" LOGINFO "[$ACTION] unmounting $MOUNTBASE/$MDEV"
grep -q "^/dev/$MDEV " /proc/mounts || exit 0 # not mounted... grep -q "^/dev/$MDEV " /proc/mounts || exit 0 # not mounted...
umount -lf $MOUNTBASE/$MDEV umount -lf $MOUNTBASE/$MDEV
RET=$? RET=$?
@ -104,7 +104,7 @@ case "$ACTION" in
rmdir $MOUNTPOINT rmdir $MOUNTPOINT
remove_symlinks remove_symlinks
else else
log_warn "umount $MOUNTBASE/$MDEV failed with $RET" LOGWARN "umount $MOUNTBASE/$MDEV failed with $RET"
fi fi
if [ -x /bin/mdev_helper ]; then if [ -x /bin/mdev_helper ]; then
/bin/mdev_helper /bin/mdev_helper

8
skel-root/coolstream/hd2/lib/mdev/net/wlan

@ -1,19 +1,19 @@
#!/bin/sh #!/bin/sh
. /lib/mdev/common/log . /etc/init.d/globals
case "$ACTION" in case "$ACTION" in
add|"") add|"")
if [ -s /etc/wpa_supplicant.conf ]; then if [ -s /etc/wpa_supplicant.conf ]; then
log_info "trying to bring $MDEV up" LOGINFO "trying to bring $MDEV up"
ifup $MDEV ifup $MDEV
else else
log_warn "/etc/wpa_supplicant.conf missing or empty, not trying to bring $MDEV up" LOGWARN "/etc/wpa_supplicant.conf missing or empty, not trying to bring $MDEV up"
fi fi
;; ;;
remove) remove)
log_info "trying to bring $MDEV down" LOGINFO "trying to bring $MDEV down"
ifdown $MDEV ifdown $MDEV
;; ;;
esac esac

3
skel-root/coolstream/hd2/lib/mdev/usb/eventvars

@ -1,5 +1,4 @@
#!/bin/false #!/bin/false
# vim: se ft=sh:
for path in $(find /sys/devices -name "$MDEV" 2>/dev/null); do for path in $(find /sys/devices -name "$MDEV" 2>/dev/null); do
DEVPATH=${path#/sys} DEVPATH=${path#/sys}
@ -23,7 +22,7 @@ INTERFACE=$(echo $MODALIAS | parse_interface)
for var in DEVPATH MODALIAS TYPE PRODUCT INTERFACE; do for var in DEVPATH MODALIAS TYPE PRODUCT INTERFACE; do
if [ -z "$(eval "echo \$${var}")" ]; then if [ -z "$(eval "echo \$${var}")" ]; then
logerror "Could not set uevent environment variable $var" LOGERROR "Could not set uevent environment variable $var"
exit 1 exit 1
fi fi
done done

66
skel-root/coolstream/hd2/lib/mdev/usb/usbcontrol

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
. /lib/mdev/common/log . /etc/init.d/globals
# setup environment for cold plug events # setup environment for coldplug events
[ -z "$ACTION" ] && . /lib/mdev/usb/eventvars [ -z "$ACTION" ] && . /lib/mdev/usb/eventvars
# get proper product and manufacturer description (only works for ACTION=add) # get proper product and manufacturer description (only works for ACTION=add)
@ -23,96 +23,96 @@ idVendor=$(echo ${idVendor} | sed 's/^[0]*//' | tr [:upper:] [:lower:])
idProduct=$(echo ${idProduct} | sed 's/^[0]*//' | tr [:upper:] [:lower:]) idProduct=$(echo ${idProduct} | sed 's/^[0]*//' | tr [:upper:] [:lower:])
channel=${MDEV%:1.0} channel=${MDEV%:1.0}
log_info "${ACTION} $channel ${manufacturer:-$idVendor} ${product:-$idProduct}" LOGINFO "${ACTION} $channel ${manufacturer:-$idVendor} ${product:-$idProduct}"
# for debug # for debug
#log_info "ACTION=${ACTION}" #LOGINFO "ACTION=${ACTION}"
#log_info "MDEV=${MDEV}" #LOGINFO "MDEV=${MDEV}"
#log_info "DEVPATH=${DEVPATH}" #LOGINFO "DEVPATH=${DEVPATH}"
#log_info "INTERFACE=${INTERFACE}" #LOGINFO "INTERFACE=${INTERFACE}"
#log_info "MODALIAS=${MODALIAS}" #LOGINFO "MODALIAS=${MODALIAS}"
#log_info "PRODUCT=${product} idProduct=${idProduct}" #LOGINFO "PRODUCT=${product} idProduct=${idProduct}"
#log_info "MANUFACTURER=${manufacturer} idVendor=${idVendor}" #LOGINFO "MANUFACTURER=${manufacturer} idVendor=${idVendor}"
# http://en.wikipedia.org/wiki/Universal_Serial_Bus#Device_classes # http://en.wikipedia.org/wiki/Universal_Serial_Bus#Device_classes
# http://www.usb.org/developers/defined_class # http://www.usb.org/developers/defined_class
[ 0 -eq "${TYPE%%/*}" ] && TYPE=$INTERFACE [ 0 -eq "${TYPE%%/*}" ] && TYPE=$INTERFACE
log_info "type ${TYPE}" LOGINFO "type ${TYPE}"
case $TYPE in case $TYPE in
1/*/*) 1/*/*)
log_info "$channel USB Audio Interface" LOGINFO "$channel USB Audio Interface"
;; ;;
2/*/*) 2/*/*)
log_info "$channel Communications and CDC Control" LOGINFO "$channel Communications and CDC Control"
;; ;;
3/*/*) 3/*/*)
log_info "$channel HID (Human Interface Device)" LOGINFO "$channel HID (Human Interface Device)"
# precheck vendor id for unsupported DPF in bootloader mode # precheck vendor id for unsupported DPF in bootloader mode
if [ "$idVendor" == "1908" ]; then if [ "$idVendor" == "1908" ]; then
service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct} service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct}
fi fi
;; ;;
5/*/*) 5/*/*)
log_info "$channel Physical Interface" LOGINFO "$channel Physical Interface"
;; ;;
6/*/*) 6/*/*)
log_info "$channel Image Interface" LOGINFO "$channel Image Interface"
;; ;;
7/*/*) 7/*/*)
log_info "$channel Printer Interface" LOGINFO "$channel Printer Interface"
;; ;;
8/*/*) 8/*/*)
log_info "$channel Mass Storage Interface" LOGINFO "$channel Mass Storage Interface"
# precheck vendor id for supported SPFs # precheck vendor id for supported SPFs
if [ "$idVendor" == "4e8" ]; then if [ "$idVendor" == "4e8" ]; then
service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct} service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct}
fi fi
;; ;;
9/*/*) 9/*/*)
log_info "$channel HUB Device" LOGINFO "$channel HUB Device"
;; ;;
10/*/*) 10/*/*)
log_info "$channel CDC Data Interface" LOGINFO "$channel CDC Data Interface"
;; ;;
11/*/*) 11/*/*)
log_info "$channel Smart Card Interface" LOGINFO "$channel Smart Card Interface"
;; ;;
13/*/*) 13/*/*)
log_info "$channel Content Security Interface" LOGINFO "$channel Content Security Interface"
;; ;;
14/*/*) 14/*/*)
log_info "$channel Video Interface" LOGINFO "$channel Video Interface"
;; ;;
15/*/*) 15/*/*)
log_info "$channel Personal Healthcare Interface" LOGINFO "$channel Personal Healthcare Interface"
;; ;;
16/*/*) 16/*/*)
log_info "$channel usb Audio/Video Devices Interface" LOGINFO "$channel usb Audio/Video Devices Interface"
;; ;;
17/*/*) 17/*/*)
log_info "$channel Billboard Device Class" LOGINFO "$channel Billboard Device Class"
;; ;;
220/*/*) 220/*/*)
log_info "$channel Diagnostic Device" LOGINFO "$channel Diagnostic Device"
;; ;;
224/*/*) 224/*/*)
log_info "$channel Wireless Controller Interface" LOGINFO "$channel Wireless Controller Interface"
;; ;;
239/*/*) 239/*/*)
log_info "$channel Miscellaneous" LOGINFO "$channel Miscellaneous"
;; ;;
254/*/*) 254/*/*)
log_info "$channel Application Specific" LOGINFO "$channel Application Specific"
;; ;;
255/*/*) 255/*/*)
log_info "$channel Vendor Specific" LOGINFO "$channel Vendor Specific"
# precheck vendor id for supported DPFs and SPFs # pre-check vendor id for supported DPFs and SPFs
if [ "$idVendor" = "1908" -o "$idVendor" == "4e8" ]; then if [ "$idVendor" = "1908" -o "$idVendor" == "4e8" ]; then
service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct} service extdisplay ${ACTION} ${MDEV} ${idVendor} ${idProduct}
fi fi
;; ;;
*) *)
log_info "FALLBACK: $channel device $MODALIAS" LOGINFO "FALLBACK: $channel device $MODALIAS"
;; ;;
esac esac

Loading…
Cancel
Save