[LWN Logo]

Date: Sat, 22 May 1999 14:37:14 -0700 (PDT)
From: Linus Torvalds <torvalds@transmeta.com>
To: linux-usb@suse.com
Subject: Re: [linux-usb] Re: Names for USB devices.




On Thu, 20 May 1999, Vojtech Pavlik wrote:
> 
> Yes, this is very much like devfs, extended to handle hardware reconfiguration
> in a sensible manner.
> 
> The unability to handle hardware reconfiguration (either hot-plug or for
> example adding a SCSI disk when the machine is switched off) is a well known
> current weakness of Linux.

No.

You're thinking about this the wrong way.

The problem is generally unsolvable. There _is_ no solution. If you think
there is, then you're (a) wasting time searching for it and (b) your
eventual "solution" will be complex and not handle all the cases correctly
anyway. 

We CANNOT name USB devices in any coherent way. Why? Because there is no
such scheme to do it that makes any sense. The devices are basically
anonymous, and the only thing that can be used to distinguish them from
each other (the device ID etc) is something that most obviously must NOT
be used for naming.

Why is the problem impossible to solve?

Think about it for a while. You have a mouse. You have a second mouse.
Initially only one is attached. The user decides that he wants to use the
other one, so he plugs in mouse #2 and unplugs mouse #1. Very obviously
the new schenario MUST look the same as the original one if you were to
have a perfect naming system.

Equally obviously the new schenario must NOT look like the original one,
according to other (equally correct) concerns. Those other concerns might
be that the name of "mouse #1" must be constant at all times, as has the
name of "mouse #2" - which means that when both mice are connected, they
must have different names, and when mouse #1 is disconnected, mouse #2
will have a different name from the original configuration.

In short, the whole situation has an inconsistency that cannot be solved.

Ergo: there is no solution to the problem.

When there is no solution to a problem, you just go crazy looking for one. 
More importantly, people tend to start writing more and more code to try
to handle the cases "correctly", when whet they are really doing is adding
more and more heuristics to try to give some expected (for an arbitrary
definition of "expected") result in some specific single circumstance. 

I will refuse patches that think they solve the problem, because they will
_not_ be solving it, and anybody who thinks they solve it has obviously
not thought the thing through. They may solve one aspect of it, while
breaking another.

This is why I want to have a single "mouse" device. If you attach two
mice, they still look like a single mouse. That may not be what everybody
wants, but it has a few _major_ advantages:

 - It is simple. Enough said. It works already for the case of mice.

 - It is self-consistent. See above about why no other naming scheme can
   be. The only self-consistent naming scheme is to give each class of
   device its own name, and not even try to distinguish between classes. 

 - It is, in 95% of all cases, what the user actually wants. 

Before people get all hung up about naming, I think they should understand
the importance of consistency, and the importance of understanding the
limitations of certain systems.

		Linus

--
To get out of this list, please send email to majordomo@suse.com with
this text in its body: unsubscribe linux-usb