|
|
|
Re: some questions about usb_serial_probe | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
On Thu, 19 Jul 2012, loody wrote:
> > You didn't look at usb_serial_probe. At the end of that function there
> I found what you mentioned.
> for (i = 0; i < num_ports; ++i) {
> ................
> retval = device_add(&port->dev);
> ...................
Yes, that's it.
> > is a loop which runs over all the ports and registers them one at a
> > time with the device layer. When it is registered, the port is passed
> > to usb_serial_device_probe, which then registers the port with the tty
> > layer.
> The port we pass to usb_serial_device_probe are usb_serial_port
> instead of tty_port, we get it through "to_usb_serial_port(dev);"
Each usb_serial_port contains a tty_port embedded within it.
> in usb_serial_device_probe, it do following things.
> 1. try to call port_probe, which seems do some control for usb_port
> instead of tty port.
The two are pretty much the same thing. Look through the driver
sources to see how often "port->port" occurs.
> 2. calling device_create_file(dev, &dev_attr_port_number);
> dev in above function is embedded in usb_port not in tty_port.
> 3. tty_register_device(usb_serial_tty_driver, minor, dev); this is
> most likely where we register tty port.
> but all three parameters have no relations to tty port.
Well, minor comes from the usb_serial_port, and the tty_port is part of
the usb_serial_port.
> if above flow is correct, how tty layer know how many tty_ports this
> usb device have?
It doesn't know. All it knows is that a bunch of tty_port devices have
been registered; it doesn't know that they all belong to the same USB
device.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html

[Linux Media] [Video for Linux] [Linux Input] [Linux Audio Users] [Photo] [Yosemite News] [Yosemite Photos] [Free Online Dating] [Linux Kernel] [Linux SCSI] [Old Linux USB Devel Archive] [More Archives]
![]() |
![]() |