aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Shelton <stuart@shelton.me>2015-05-13 22:41:14 +0100
committerStuart Shelton <stuart@shelton.me>2015-05-13 22:42:57 +0100
commitedf0e0c958948081649be5878b396b4241b47ec9 (patch)
tree12fd09560b07dad1517b35d45e99e906eaf339b7 /sys-apps/busybox
parentAdd app-admin/monit-5.12.2 (diff)
downloadsrcshelton-edf0e0c958948081649be5878b396b4241b47ec9.tar.gz
srcshelton-edf0e0c958948081649be5878b396b4241b47ec9.tar.bz2
srcshelton-edf0e0c958948081649be5878b396b4241b47ec9.zip
Update sys-apps/busybox with improved mdev handling of USB network devices
Diffstat (limited to 'sys-apps/busybox')
-rw-r--r--sys-apps/busybox/Manifest2
-rw-r--r--sys-apps/busybox/files/mdev/usb123
2 files changed, 90 insertions, 35 deletions
diff --git a/sys-apps/busybox/Manifest b/sys-apps/busybox/Manifest
index 43f7be6f..c7a2b6d5 100644
--- a/sys-apps/busybox/Manifest
+++ b/sys-apps/busybox/Manifest
@@ -38,7 +38,7 @@ AUX mdev/dvbdev 356 SHA256 ef091bb4c8943a99b9a97b556cdc15ddd20275f5afa8287e20141
AUX mdev/ide_links 440 SHA256 3fccc9ee437e3dcc8ac73bfe3713334a7156a112fe442e052fff4f26ff0f6a88 SHA512 0142234d0bda86ad1e5f88f1da34669e5fda46a0fd52ce507bd49ce74d2b7c12c323e8db863bccb924e6d632b568db8b243361b217c5b2e1d92a25feb6e62dec WHIRLPOOL ce02358a65ad2beeab12485379e322736c7b6b58ff44a20b880d9bab8806e04890a385b94228f2db685150dfe0a3c716f842ce5c1c7f579c8208ab4e9a6ae852
AUX mdev/mdev_debug 547 SHA256 31eaf6d69ee082594ddcdcb86a684a152887cfc10212f6196372a356ea6bf749 SHA512 78083c94606ba54e24e92975a0ad3a1fb04bc7609b53d64d9e4ca24b837167c599c757431bc31b192ac74958d728eb3d532dbcb44962d70099e43c4e5b49e64a WHIRLPOOL e91193240396993e50ce02b3fdf6e9bf4e3f233877ef8abca7d89d68f75b501430c1f98acf5916dd1c27d68a993ff3be9e79046b3653eed9990981bc08a3a40c
AUX mdev/mdev_nomatch 381 SHA256 0c8ef7e13b4d1a116d4dc3fa9b26eb6fa928dcb0b6615e09936ecece4f939e3b SHA512 0b7f4a4cbf6e45ec4fab5416b6932ae68e69edffc244b3a1af9a5c90ee9790a183a071bafe8bed0b5b7f54142593a83e045a9618c199bf60941aa7e304bcdefe WHIRLPOOL 6c9c7f59cab14b5ae5da648dc2dab3e935a465e1a423067ccec8b1138307cb5110b6d04911b6921c61bf500aac5fc41683e0d242d873db9107e2edb6e62282da
-AUX mdev/usb 13025 SHA256 dda34d97ac406c7367622f3aaf13fb46c6f962972ba42986c851d5cd8004868c SHA512 2a9ae79b699ced774f743748290e24985b07678475f0c21993f61360e4c4367735cd05dd7be919fa994bdbbcb805b694536d506f336e7a987c2789a61b13906b WHIRLPOOL 4685252a89866d23d6e7e39868f4bedea58036b3044caf67a7151f5b961f50dec54b0a6c122a5925e3f78d8d01df44f789d9b59909de4988bbf64a4c9e659b28
+AUX mdev/usb 15232 SHA256 67c1b90d681123cffd0d6f5923325d051aee668104b433d9155e021d62d0c4b6 SHA512 5b060bc762c6f3148faa2018736e04c49ecbe65d1575af78c23a78e738375d840e6fa4207832709cf38878a1500667c69626401c209ec788ed16f2683ebc1009 WHIRLPOOL 2a4e0ec9d449346e06cea24f093a51cfb4f59c9eac8916edb1dcfede5a56782070e31c220ed3442b7bd87f9bced7c77e1cce0cc69f9f3564f430305c8d9219fe
AUX mdev/usbdev 1625 SHA256 38d9818cf5ab202ce84af9a73036c4b8cce27cccb051be288ce9ad9cf55130fa SHA512 34a9235f35cecba139be9fa1694c77a7ca874e6f18a164019b5c4a5be57d4e50e108ae7e51f65c28c4916d53f6056d999876dee5768ff15f74ae86cec08ff34a WHIRLPOOL 8395ace4b5d35d91d33ac7d623a22fd3b13786ce139f8a60101a5510c343a2288226fed99117e24f347606ab7300b6d3b726713e0666163cc0e24f9507a1bb67
AUX mdev/usbdisk_link 1075 SHA256 7e89349eff60a294fdeeab9eee6839509f2604006f46b23a2c2ec98b7bea8ba3 SHA512 76f8a393cc881e754bd98cc390772fb55e0c99ea1c66e854c03958008135b6a7b880b8c4782d1513b1d0f7e1218d4672860bfd7b7f578f10c331b7fdee82b5e0 WHIRLPOOL 5202266ca26c071606ee364870a5686b93ec98979533862d24bbc2b942a7238a576b56c96ccdb4ab8057b320ed2031fe4acbefa1223da0c47535fd10441bccf7
AUX ntpd.confd 186 SHA256 4bff7f5c66f4eece52e4381fd2706e591f10eb50f3c3a4132344d34150dc54de SHA512 b0ef111ea7dd6a096acf711d2d84a7c3d38e7e8c181f734053d38c565ab44ecf843ef32c0de0c4e7ecec990e97468a2545f83821beedb125cd6723ed74c67ad8 WHIRLPOOL a1b228ae22c61de6ecc7fa58edcd4c3941b3762a45fcc38d05bd1c9428bc553b1a158c101d65a99ba63d4bc19b269e834b3f0eba40a5a1c81e0ae876a2ecb42c
diff --git a/sys-apps/busybox/files/mdev/usb b/sys-apps/busybox/files/mdev/usb
index 0f5547ec..b46dd01d 100644
--- a/sys-apps/busybox/files/mdev/usb
+++ b/sys-apps/busybox/files/mdev/usb
@@ -119,7 +119,7 @@ if [[ -d "/sys${DEVPATH}/" ]]; then
fi
if [[ -e "/sys${DEVPATH}/manufacturer" ]]; then
- SERIAL="$( cat "/sys${DEVPATH}/manufacturer" )"
+ MANUFACTURER="$( cat "/sys${DEVPATH}/manufacturer" )"
fi
fi
@@ -220,7 +220,7 @@ case "${ACTION}" in
fi
chown usbmux:usb "bus/usb/${BUS}/${USB_DEV}" >/dev/null 2>&1
- log "Running 'usbmuxd'"
+ log "Running 'usbmuxd' ..."
${MUXD} -U "${muxduser}" >/dev/null 2>&1 </dev/null &
unset muxduser num conf
@@ -229,15 +229,25 @@ case "${ACTION}" in
if [[ -n "${PRODUCT:-}" && "${PRODUCT}" == "iPhone" ]]; then
# There can be only one...
ln -sf "bus/usb/${BUS}/${USB_DEV}" iphone
- log "Running 'ipheth-pair'"
+ log "Running '$( basename "${IPHETH}" )' ..."
"${IPHETH}" >/dev/null 2>&1 </dev/null &
fi
- if [[ -n "${SERIAL:-}" ]]; then
+ if ! [[ -n "${SERIAL:-}" ]]; then
+ log "Device serial unknown, not restarting network interfaces"
+ else
+ echo "${USB_VENDOR}:${USB_PRODUCT}:${SERIAL}" > "bus/usb/${BUS}/.${USB_DEV}.id"
case "${SERIAL}" in
- "xxxx")
- [[ -x /etc/init.d/net.iphone0 ]] && \
- /etc/init.d/net.iphone0 --quiet restart >/dev/null 2>&1 </dev/null &
+ #"xxxx")
+ # if [[ -x /etc/init.d/net.iphone0 ]]; then
+ # log "Stopping any existing dhcpcd clients ..."
+ # dhcpcd -x
+ # log "Restarting service 'net.iphone0' for device with serial number '${SERIAL}' ..."
+ # /etc/init.d/net.iphone0 --quiet restart >/dev/null 2>&1 </dev/null &
+ # fi
+ # ;;
+ *)
+ log "Unknown serial number '${SERIAL}'"
;;
esac
fi
@@ -328,14 +338,25 @@ case "${ACTION}" in
if [[ -n "${SERIAL:-}" ]]; then
case "${SERIAL}" in
- "HUAWEI_MOBILE")
- [[ -x /etc/init.d/net.mifi0 ]] && \
- /etc/init.d/net.mifi0 --quiet restart >/dev/null 2>&1 </dev/null &
- ;;
#"xxxx")
- # [[ -x /etc/init.d/net.mifi1 ]] && \
- # /etc/init.d/net.mifi1 --quiet restart >/dev/null 2>&1 </dev/null &
+ # if [[ -x /etc/init.d/net.mifi0 ]]; then
+ # log "Stopping any existing dhcpcd clients ..."
+ # dhcpcd -x
+ # log "Restarting service 'net.mifi0' for device with serial number '${SERIAL}' ..."
+ # /etc/init.d/net.mifi0 --quiet restart >/dev/null 2>&1 </dev/null &
+ # fi
# ;;
+ "0123456789ABCDEF")
+ if [[ -x /etc/init.d/net.mifi0 ]]; then
+ log "Stopping any existing dhcpcd clients ..."
+ dhcpcd -x
+ log "Restarting service 'net.mifi0' for device with serial number '${SERIAL}' ..."
+ /etc/init.d/net.mifi0 --quiet restart >/dev/null 2>&1 </dev/null &
+ fi
+ ;;
+ *)
+ log "Unknown serial number '${SERIAL}'"
+ ;;
esac
fi
fi
@@ -346,37 +367,68 @@ case "${ACTION}" in
remove)
log "Performing 'remove' ACTION"
+ if [[ -s "bus/usb/${BUS}/.${USB_DEV}.id" ]]; then
+ DATA="$( < "bus/usb/${BUS}/.${USB_DEV}.id" )"
+ USB_VENDOR="$( cut -d':' -f 1 <<<"${DATA}" )"
+ USB_PRODUCT="$( cut -d':' -f 2 <<<"${DATA}" )"
+ SERIAL="$( cut -d':' -f 3 <<<"${DATA}" )"
+ unset DATA
+ log "Node '${MDEV}' from sysfs path '${DEVPATH}' and cache 'bus/usb/${BUS}/.${USB_DEV}.id' is '${USB_VENDOR}:${USB_PRODUCT}' ('${PRODUCT}') with serial '${SERIAL}'"
+ fi
+
if [[ -n "${SERIAL:-}" ]]; then
case "${SERIAL}" in
- "HUAWEI_MOBILE")
- [[ -x /etc/init.d/net.mifi0 ]] && \
- /etc/init.d/net.mifi0 --quiet stop >/dev/null 2>&1 </dev/null &
- ;;
#"xxxx")
- # [[ -x /etc/init.d/net.mifi1 ]] && \
- # /etc/init.d/net.mifi1 --quiet stop >/dev/null 2>&1 </dev/null &
+ # if [[ -x /etc/init.d/net.mifi0 ]]; then
+ # log "Stopping service 'net.mifi0' for device with serial number '${SERIAL}' ..."
+ # /etc/init.d/net.mifi0 --quiet stop >/dev/null 2>&1 </dev/null
+ # log "Stopping dhcpcd client ..."
+ # dhcpcd -x
+ # fi
# ;;
+ "0123456789ABCDEF")
+ if [[ -x /etc/init.d/net.mifi0 ]]; then
+ log "Stopping service 'net.mifi0' for device with serial number '${SERIAL}' ..."
+ /etc/init.d/net.mifi0 --quiet stop >/dev/null 2>&1 </dev/null
+ log "Stopping dhcpcd client ..."
+ dhcpcd -x
+ fi
+ ;;
+ *)
+ log "Unknown serial number '${SERIAL}'"
+ ;;
esac
fi
if [[ -x "${MUXD}" ]]; then
- if [[ -n "${USB_VENDOR:-}" && -n "${USB_PRODUCT:-}" && "${USB_VENDOR}" == "05ac" ]]; then
- log "Apple USB device has been removed..."
-
- if [[ -n "${SERIAL:-}" ]]; then
- case "${SERIAL}" in
- "xxxx")
- [[ -x /etc/init.d/net.iphone0 ]] && \
- /etc/init.d/net.iphone0 --quiet stop >/dev/null 2>&1 </dev/null &
- ;;
- esac
- fi
+ if ! [[ -n "${USB_VENDOR:-}" && -n "${USB_PRODUCT:-}" ]]; then
+ log "USB device vendor '${USB_VENDOR:-}' or product '${USB_PRODUCT:-}' not set - not stopping network devices"
+ else
+ if [[ "${USB_VENDOR}" == "05ac" ]]; then
+ log "Apple USB device has been removed..."
+
+ if [[ -n "${SERIAL:-}" ]]; then
+ case "${SERIAL}" in
+ #"xxxx")
+ # if [[ -x /etc/init.d/net.iphone0 ]]; then
+ # log "Stopping service 'net.iphone0' for device with serial number '${SERIAL}' ..."
+ # /etc/init.d/net.iphone0 --quiet stop >/dev/null 2>&1 </dev/null
+ # log "Stopping dhcpcd client ..."
+ # dhcpcd -x
+ # fi
+ # ;;
+ *)
+ log "Unknown serial number '${SERIAL}'"
+ ;;
+ esac
+ fi
- if echo "${USB_PRODUCT}" | grep -qE "^12[9a]" >/dev/null 2>&1; then
- log "Stopping 'usbmuxd'"
- ${MUXD} -x >/dev/null 2>&1 </dev/null &
+ if echo "${USB_PRODUCT}" | grep -qE "^12[9a]" >/dev/null 2>&1; then
+ log "Stopping 'usbmuxd'"
+ ${MUXD} -x >/dev/null 2>&1 </dev/null &
+ fi
+ [[ -e iphone ]] && rm -f iphone 2>/dev/null
fi
- [[ -e iphone ]] && rm -f iphone 2>/dev/null
fi
fi
@@ -405,6 +457,9 @@ case "${ACTION}" in
esac
# Remove device node and potential empty directories
+ if rm -f "bus/usb/${BUS}/.${USB_DEV}.id" 2>/dev/null; then
+ log "rm -f 'bus/usb/${BUS}/.${USB_DEV}.id' succeeded"
+ fi
if rm -f "bus/usb/${BUS}/${USB_DEV}" 2>/dev/null; then
log "rm -f 'bus/usb/${BUS}/${USB_DEV}' succeeded"
if rmdir -p "bus/usb/${BUS}" 2>/dev/null; then