[source] net: uqmi: fix blocking in endless loops when unplugging device

LEDE Commits lede-commits at lists.infradead.org
Mon Oct 9 08:35:55 PDT 2017


lynxis pushed a commit to source.git, branch master:
https://git.lede-project.org/a5d016f3615c10a326a507dcb24afe8adcd48396

commit a5d016f3615c10a326a507dcb24afe8adcd48396
Author: Alexandru Ardelean <ardeleanalex at gmail.com>
AuthorDate: Fri Sep 29 16:35:30 2017 +0300

    net: uqmi: fix blocking in endless loops when unplugging device
    
    If you unplug a QMI device, the /dev/cdc-wdmX device
    disappears but uqmi will continue to poll it endlessly.
    
    Then, when you plug it back, you have 2 uqmi processes,
    and that's bad, because 2 processes talking QMI to the
    same device [and the same time] doesn't seem to work well.
    
    Signed-off-by: Alexandru Ardelean <ardeleanalex at gmail.com>
---
 package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
index 35de6c5..f5c8768 100755
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -65,6 +65,7 @@ proto_qmi_setup() {
 	[ -n "$delay" ] && sleep "$delay"
 
 	while uqmi -s -d "$device" --get-pin-status | grep '"UIM uninitialized"' > /dev/null; do
+		[ -e "$device" ] || return 1
 		sleep 1;
 	done
 
@@ -102,6 +103,7 @@ proto_qmi_setup() {
 
 	echo "Waiting for network registration"
 	while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do
+		[ -e "$device" ] || return 1
 		sleep 5;
 	done
 



More information about the lede-commits mailing list