linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Lucas Tanure <tanure@linux.com>
Cc: linux-usb@vger.kernel.org, kernelnewbies@kernelnewbies.org
Subject: Re: USB Question about devices being reconnected to the host
Date: Thu, 15 Oct 2020 14:30:56 +0200	[thread overview]
Message-ID: <20201015123056.GA4021854@kroah.com> (raw)
In-Reply-To: <d4c94e87-a1bb-18d5-054f-2e6ed01fab5b@linux.com>

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?


> 
> 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

  reply	other threads:[~2020-10-15 12:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 12:17 USB Question about devices being reconnected to the host Lucas Tanure
2020-10-15 12:30 ` Greg KH [this message]
2020-10-15 13:22   ` Lucas Tanure

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201015123056.GA4021854@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tanure@linux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).