From nobody Fri Apr 3 20:54:57 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B48561A2392; Thu, 2 Apr 2026 08:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775118750; cv=none; b=HVVtoFv3EnD+yOATaPk5v/QruY8/1gxo9zztSoxNSEbABcX7N9WO/x47ld/eAUj4S+Q1jTVwjhINL2zYorulevH/NLfFCXLnjolfrQDR6aUwuBRdsCKS77Lklhu/eXQ4MI/JR+GkTp461v32faXjaZ8j50rA175B9mOJkk07LOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775118750; c=relaxed/simple; bh=fOJfz8QaRTCWY3SH78d+BvA+X4yyBlHXy2JJ/+vuHdw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t5FeKj7o1t0Bc4iFTYDwf+elYQOrIlD7Yxo8GKyd+av/PFaaoRYc2IshggsPCDTIDcRstpdlFhXCYUW/zhNL5YgM0ylY8BOTnMWY0pRkqw2frDVV4UZxFLavn6jNj9kCSQb12OBMLCwgAzWW9SQJrUTyoLng81U/p26TL5ouzlU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=oCwcJAg7; arc=none smtp.client-ip=117.135.210.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="oCwcJAg7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=us F5A5XHu71jCxuS8pXh3vH3U6H9eKPHBRdR5KQCpOw=; b=oCwcJAg7rydyEZUlf7 jH6G2V3mYs2en5OYQX7VZ6BGGDMjmTZ8URauEeC2wK5Lbb9SKoRNOxxXO2NUazzA q9ExqEMXqQrDtY9rP4Nl2yWAs3jyuVwLLavXc37344QB1gNPqzAhU+deFsZ+YYYQ pUjGdMoWddLgUppl+HD7jzMi4= Received: from thinkpadx13gen2i.. (unknown []) by gzga-smtp-mtada-g0-1 (Coremail) with SMTP id _____wD3_WyGKc5p00YACw--.10390S2; Thu, 02 Apr 2026 16:32:07 +0800 (CST) From: Zongmin Zhou To: skhan@linuxfoundation.org Cc: gregkh@linuxfoundation.org, i@zenithal.me, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, valentina.manea.m@gmail.com, Zongmin Zhou Subject: [PATCH v4] usbip: tools: add hint when no exported devices are found Date: Thu, 2 Apr 2026 16:32:04 +0800 Message-Id: <20260402083204.53179-1-min_halo@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <8d7000a9-981c-468a-bd4b-60111e0b77e9@linuxfoundation.org> References: <8d7000a9-981c-468a-bd4b-60111e0b77e9@linuxfoundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD3_WyGKc5p00YACw--.10390S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJw17Xw13JFy7GFyxWrW5Awb_yoW5ZFy8pF WUJFW0krWUXFsxXw4qvF4xAFW0ganxX3y0gr1fJw15WrsFya4ag3sxtFnYkay7Ga1UXasF 9Fsrt3yDGa4UXw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07joBT5UUUUU= X-CM-SenderInfo: pplqsxxdorqiywtou0bp/xtbC0Qh6JmnOKYjKUwAA3a Content-Type: text/plain; charset="utf-8" From: Zongmin Zhou When refresh_exported_devices() finds no devices, it's helpful to inform users about potential causes. This could be due to: 1. The usbip driver module is not loaded. 2. No devices have been exported yet. Add an informational message to guide users when ndevs =3D=3D 0. Also update the condition in usbip_host_driver_open() and usbip_device_driver_open() to check both ret and ndevs =3D=3D 0, and change err() to info(). Message visibility by scenario: - usbipd (console mode): Show on console/serial, this allows instant visibility for debugging. - usbipd -D (daemon mode): Message logged to syslog, can keep logs for later traceability in production. Also can use "journalctl -f" to trace on console. Suggested-by: Shuah Khan Signed-off-by: Zongmin Zhou --- Changes in v4: - Printing behavior adjusted as suggested. Changes in v3: - Just add an informational message when no devices are found. Changes in v2: - Use system calls directly instead of checking sysfs dir. tools/usb/usbip/libsrc/usbip_device_driver.c | 6 +++--- tools/usb/usbip/libsrc/usbip_host_common.c | 3 +++ tools/usb/usbip/libsrc/usbip_host_driver.c | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/usb/usbip/libsrc/usbip_device_driver.c b/tools/usb/usbip= /libsrc/usbip_device_driver.c index 927a151fa9aa..1dfbb76ab26c 100644 --- a/tools/usb/usbip/libsrc/usbip_device_driver.c +++ b/tools/usb/usbip/libsrc/usbip_device_driver.c @@ -137,9 +137,9 @@ static int usbip_device_driver_open(struct usbip_host_d= river *hdriver) INIT_LIST_HEAD(&hdriver->edev_list); =20 ret =3D usbip_generic_driver_open(hdriver); - if (ret) - err("please load " USBIP_CORE_MOD_NAME ".ko and " - USBIP_DEVICE_DRV_NAME ".ko!"); + if (ret || hdriver->ndevs =3D=3D 0) + info("please load " USBIP_CORE_MOD_NAME ".ko and " + USBIP_DEVICE_DRV_NAME ".ko"); =20 return ret; } diff --git a/tools/usb/usbip/libsrc/usbip_host_common.c b/tools/usb/usbip/l= ibsrc/usbip_host_common.c index ca78aa368476..01599cb2fa7b 100644 --- a/tools/usb/usbip/libsrc/usbip_host_common.c +++ b/tools/usb/usbip/libsrc/usbip_host_common.c @@ -149,6 +149,9 @@ static int refresh_exported_devices(struct usbip_host_d= river *hdriver) } } =20 + if (hdriver->ndevs =3D=3D 0) + info("Please load appropriate modules or export devices."); + return 0; } =20 diff --git a/tools/usb/usbip/libsrc/usbip_host_driver.c b/tools/usb/usbip/l= ibsrc/usbip_host_driver.c index 573e73ec36bd..bd8a6b84de0e 100644 --- a/tools/usb/usbip/libsrc/usbip_host_driver.c +++ b/tools/usb/usbip/libsrc/usbip_host_driver.c @@ -32,9 +32,10 @@ static int usbip_host_driver_open(struct usbip_host_driv= er *hdriver) INIT_LIST_HEAD(&hdriver->edev_list); =20 ret =3D usbip_generic_driver_open(hdriver); - if (ret) - err("please load " USBIP_CORE_MOD_NAME ".ko and " - USBIP_HOST_DRV_NAME ".ko!"); + if (ret || hdriver->ndevs =3D=3D 0) + info("please load " USBIP_CORE_MOD_NAME ".ko and " + USBIP_HOST_DRV_NAME ".ko"); + return ret; } =20 --=20 2.43.0