From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E2713D7D6E for ; Wed, 1 Apr 2026 16:06:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775059586; cv=none; b=nU5NmHeuJ+fCtlxiIpADq0+u0p2mKa2nX+KffopNhuw84VqijOaKdIVCWcHFhlnxZwQ8Ee10l4drcvfX47qGBqVnyiN4xoFTkh06QASOat3uJ51CRE71ayFnq/MenxkU0HH+F6ASbb/yvUCBtBtZRCPh5mwTiu7f4qfJYiTEcLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775059586; c=relaxed/simple; bh=6LdhDgXuA2Ka2rLh8KrXng3dhEvau1aDwfZLzxn+JYw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Xl56z/vrlOPlB81BJ1WLG26FWG/lQMTIutfj0OdBPMuVZKbXa/Od0ahz4cVQUjVK/uiUmtfuGlMTxYXnwizhnbufb19iYpj8QHiTNIBlF3MNA3sMcHaSSKgiamf1JWhsq4Tb5zPLxD1TlJZ4BmLIgp7peRt9jbuea/2w8HpRXOA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WfvM/HP8; arc=none smtp.client-ip=209.85.210.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WfvM/HP8" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-7d74aa6bcdbso3925325a34.2 for ; Wed, 01 Apr 2026 09:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1775059584; x=1775664384; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=x9vtejKV+n/AnqzwqKmW8RD+vTXqQVuVAPaAcB1DYq4=; b=WfvM/HP8vEiwmbmhfqxIRnP02iZz6rCKIscL5+9X3L+l0uBV0L9QI597UvyVl62OUS eX/G0AH5TzPcz9IHkAPHYR5BlJ/SIgvmDYaXLUt8ObOPRK1T4WrCCZsZwrChdqlCyhNE GSw+/rEC15YY5V0NysBvCSNqDUkB10vqmBEi4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775059584; x=1775664384; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=x9vtejKV+n/AnqzwqKmW8RD+vTXqQVuVAPaAcB1DYq4=; b=aLZddS1TMj76aap+1Ka8f7uWqmcEujBMChMUYK9p54y2lB1japLZBri2OUGvDJojf+ HjzjN2MDBojv5c3V0LJ532XfwL6mY7Ipq6YUsYCVKbkaDqJRe9FO8PvlZbjMzhejzIUY pmiCnPdSgAuaERCWtU10BKe37RtaG1gRKo1W20KusoIS5fOBUqqutAPBQQrggjUusByu 0dkxerNlnmB202HLzgAn901qYRxOoyTfp1U89Kf2LanczW09JHGqmMvAYsIpRvWA+LZb kFT4KzCcMICdLHsoYliMGXBmGCgVcNmXgtFmZ3WLPJneY5WlqVY4hV5cIdm4nhSOWwG8 M3nQ== X-Forwarded-Encrypted: i=1; AJvYcCV6zNI250CnGLukLM+v84FiXZvm9JTS+y6lPV7U5gxNovlnF2VwuIRvJzjINWl3iLCaMtz8X2f7WFamoU8=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6NSG/k8QMukqPj5Mkrk7w8AbEpsTRPjwb/xOjWutw1ZxfCjR2 BfBrNYM0+G9RdGiu3kswnrT9sA7GfE6u67smy8w6BFylVa2HlBiet0vzj2Nttb037W0= X-Gm-Gg: ATEYQzwbXNQ6HSlTL7bp9t871h2afE50MQrfsFl6Y8DGpdvL/YqTvAqJgjTOYq2gVc8 DqyUDITvGqb8gJYsdEy7KeMHPhNzGA58/ERjYNZJy48qkmGVPHAbmqJYs2GMRotOuT/h9h62uXr fdOT25aertqPkPR6BfK+WyCmSMy6MVUXHWpwTB9nB/XRVMOR+jTXjoMuHXdhG5vfffMw4xirOiM zoRNh8UyGNamGcjHM75okzOQWA6LNxHLTdC5B4u9A3gAmVFMe1UtOvI/OpNafxMV+HWkJ/5yFZv KeZY1x6ASDtJ/7rJZ6Mm2p5MhK57K+RBNhJ3q1svl56+hUJduvZNDbRq5uQnSunUTAY1/7C2kiE yEVLDCji44gt8kzpxeBJNXtx/VS5usnBYIeYRJUI+UcZga3OTyTWEZtNJT6azgIYPALjxIFS/jD sipgIykui8deYzlvna35sH4y3g/zvz8hiWnyK+klYQ1BGAyw== X-Received: by 2002:a05:6830:3c8a:b0:7d7:d097:96dc with SMTP id 46e09a7af769-7db99257eb5mr2504282a34.5.1775059583748; Wed, 01 Apr 2026 09:06:23 -0700 (PDT) Received: from [192.168.1.14] ([38.175.187.108]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7dba71256a7sm177994a34.2.2026.04.01.09.06.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Apr 2026 09:06:23 -0700 (PDT) Message-ID: <8d7000a9-981c-468a-bd4b-60111e0b77e9@linuxfoundation.org> Date: Wed, 1 Apr 2026 10:06:21 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] usbip: tools: add hint when no exported devices are found To: Zongmin Zhou Cc: gregkh@linuxfoundation.org, i@zenithal.me, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, valentina.manea.m@gmail.com, Zongmin Zhou , Shuah Khan References: <3ff00e2e-1c45-45be-a65c-16da9b2ae5a5@linuxfoundation.org> <20260331095830.124543-1-min_halo@163.com> <6ed1738b-9d15-4311-a0f5-9b1a7db69f8c@163.com> Content-Language: en-US From: Shuah Khan In-Reply-To: <6ed1738b-9d15-4311-a0f5-9b1a7db69f8c@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3/31/26 20:47, Zongmin Zhou wrote: > > On 2026/4/1 08:27, Shuah Khan wrote: >> On 3/31/26 03:58, Zongmin Zhou wrote: >>> 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 == 0. >>> >>> 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 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_host_common.c | 7 +++++++ >>>   1 file changed, 7 insertions(+) >>> >>> diff --git a/tools/usb/usbip/libsrc/usbip_host_common.c b/tools/usb/usbip/libsrc/usbip_host_common.c >>> index ca78aa368476..cd92baee310c 100644 >>> --- a/tools/usb/usbip/libsrc/usbip_host_common.c >>> +++ b/tools/usb/usbip/libsrc/usbip_host_common.c >>> @@ -149,6 +149,13 @@ static int refresh_exported_devices(struct usbip_host_driver *hdriver) >>>           } >>>       } >>>   +    if (hdriver->ndevs == 0) { >>> +        if (!strcmp(hdriver->udev_subsystem, "usb")) >>> +            info("Please check if %s driver is loaded or export devices.",USBIP_HOST_DRV_NAME); >> >> Check coding guidelines and match the new code to the existing. Need a space between >> the string and the next argument. >> >> >>> +        else >>> +            info("Please check if %s driver is loaded or export devices.",USBIP_DEVICE_DRV_NAME); >> >> When will this be true? Isn't refresh_exported_devices() called from >> >> Thinking about this more, since you have to differentiate between >> host and device, it makes sense to make this change to >> >> usbip_device_driver_open() and usbip_host_driver_open() >> There is an err() message already in both of these routines. >> that prints the right information. >> > Shuah, > > Regarding your comment about the existing err() message in these routines: > > The existing err("please load *.ko") message only triggers when usbip_generic_driver_open() > returns a non-zero value. Since refresh_exported_devices() always returns 0 > (even when ndevs == 0 and no devices are found), usbip_generic_driver_open() > only returns non-zero when udev_new() fails. > > Therefore, when ndevs == 0, the existing err() message is never printed, > so it doesn't actually help users diagnose the "no devices found or driver not load" situation. Correct. There is no need to remove this. What I am suggesting is these messages from usbip_device_driver_open() and usbip_host_driver_open() What I am suggesting changing usbip_device_driver_open() and usbip_host_driver_open() like this: if (ret || hdriver->ndevs == 0) info("please load " USBIP_CORE_MOD_NAME ".ko and " USBIP_DEVICE_DRV_NAME ".ko!"); This should solve the problem for you ... I don't like the idea of adding string compares to refresh_exported_devices() if (!strcmp(hdriver->udev_subsystem, "usb")) to differentiate when you can simply leverage the existing code by adding one more conditional and changing the err() to info() thanks, -- Shuah