From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D756AC433DF for ; Thu, 15 Oct 2020 13:22:41 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DCA44206CA for ; Thu, 15 Oct 2020 13:22:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCA44206CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1kT3D2-0007Y2-78; Thu, 15 Oct 2020 09:22:20 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kT3D1-0007Xw-1A for kernelnewbies@kernelnewbies.org; Thu, 15 Oct 2020 09:22:19 -0400 Received: by mail-wm1-f66.google.com with SMTP id e23so3168892wme.2 for ; Thu, 15 Oct 2020 06:22:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=dg+DyVAu6RTSAvj/uSkVO8Wdtjrpab6/Nr3YoBxQCAw=; b=qmB1zdwvZH1/vuxnThA6MFt5Qa53Ijtexccmf/w7GqJOXy3ry1UPWZfEdzbjzTcMti NFjZK9hMqORvEG1nUbQVco2fWVi5d2ygKbUjDZbbmRpEg9NfRw+v/g2TsoL6pVJxdwS7 r4EHj7KTI/lO/Z3neNcqXMf5sWkSEIfHjzrMc0Bpbmqs2p3h8m1VxN8/I7r3cjne5t33 ji0JboH7mUptE3KXDGhr7N/XpJWXZMJosgnYL+1/T2GXYDcjls6PbuNEbiaIx4H0txx4 ykl7AzMjIKTeF0JB7kCDeEFiQ1tYDdeBrh+CgZsqCVBGB6YnxkM2bji+toiPTabHdNvw Bjng== X-Gm-Message-State: AOAM533Dkirm8n9xMefIKoBcYYkv2ipZXwCxwQ1jCNj8tE7jsyQ05Vsl dClHGPOut301OBCFOuPfTF7qy8y6h5w+aKZ1 X-Google-Smtp-Source: ABdhPJzulD133RfaYPv2iWp1hKJ9l/cqB/CmkxhWrnu/12z2QHCTK6cXF3+5g9NR9BTEka22JuA0gg== X-Received: by 2002:a1c:3243:: with SMTP id y64mr3990357wmy.175.1602768136941; Thu, 15 Oct 2020 06:22:16 -0700 (PDT) Received: from [192.168.86.26] (cpc87451-finc19-2-0-cust61.4-2.cable.virginm.net. [82.11.51.62]) by smtp.gmail.com with ESMTPSA id 205sm4538233wme.38.2020.10.15.06.22.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Oct 2020 06:22:16 -0700 (PDT) Subject: Re: USB Question about devices being reconnected to the host To: Greg KH References: <20201015123056.GA4021854@kroah.com> From: Lucas Tanure Message-ID: <429802b5-46f1-9631-25f6-d50ddb622cb0@linux.com> Date: Thu, 15 Oct 2020 14:22:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201015123056.GA4021854@kroah.com> Content-Language: en-US Cc: linux-usb@vger.kernel.org, kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: tanure@linux.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kernelnewbies-bounces@kernelnewbies.org On 10/15/20 1:30 PM, Greg KH wrote: > On Thu, Oct 15, 2020 at 01:17:45PM +0100, Lucas Tanure wrote: >> Hi, >> >> I'm learning about USB drivers and I would like to know about disconnecting >> and reconnecting usb devices. >> >> I can see my probe function being called and also the disconnect function. >> But if I reconnect the device there is no call from the kernel to notify my >> driver about the device being reconnected. > > That's not good, your driver should be told this. > >> I can also see that the module for my driver was not unloaded, so I dont >> understand the life cycle of a USB device. > > Modules are never auto-unloaded. > >> If the module is not unloaded at disconnection and re-loaded for a new >> device being connected, how can the driver know the device is there after a >> disconnection? > > The probe function should be called, are you sure it isn't? I re-did the test couple more times and I can see now the probe function being called. Thanks > > >> >> Thanks >> Lucas >> >> This is my dmesg for the driver at the end of this email: >> >> [ 34.706041] usb 1-1.1.2: new high-speed USB device number 5 using dwc_otg >> [ 34.837647] usb 1-1.1.2: New USB device found, idVendor=04b4, >> idProduct=00f1, bcdDevice= 0.00 >> [ 34.837666] usb 1-1.1.2: New USB device strings: Mfr=1, Product=2, >> SerialNumber=0 >> [ 34.837679] usb 1-1.1.2: Product: FX3 >> [ 34.837693] usb 1-1.1.2: Manufacturer: Cypress >> [ 34.902480] usbdev_probe >> [ 34.902681] usbcore: registered new interface driver My USB Device >> [ 45.416310] usb 1-1.1.2: USB disconnect, device number 5 >> [ 45.416655] usbdev_disconnect >> [ 61.326035] usb 1-1.1.2: new high-speed USB device number 6 using dwc_otg >> [ 61.457674] usb 1-1.1.2: New USB device found, idVendor=04b4, >> idProduct=00f1, bcdDevice= 0.00 >> [ 61.457692] usb 1-1.1.2: New USB device strings: Mfr=1, Product=2, >> SerialNumber=0 >> [ 61.457706] usb 1-1.1.2: Product: FX3 >> [ 61.457720] usb 1-1.1.2: Manufacturer: Cypress > > That is odd, sorry, don't know what to suggest. > > greg k-h > _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies