On Fri, Mar 29, 2013 at 03:08:17AM +0800, Lan Tianyu wrote: > On 2013/3/29 2:53, Greg KH wrote: > >On Thu, Mar 28, 2013 at 02:44:01PM -0400, Alan Stern wrote: > >>On Thu, 28 Mar 2013, Greg KH wrote: > >> > >>>>>>ls /sys/bus/usb/devices > >>>>>>1-0:1.0 2-0:1.0 port1-1 port1-1.3 port2-1.2 port2-2 port4-3 > >>>>>>1-1 2-1 port1-1.1 port1-1.4 port2-1.3 port3-1 port4-4 > >>>>>>1-1.1 2-1:1.0 port1-1.2 port1-1.5 port2-1.4 port3-2 usb1 > >>>>>>1-1:1.0 3-0:1.0 port1-1.2.1 port1-1.6 port2-1.5 port3-3 usb2 > >>>>>>1-1.1:1.0 3-1 port1-1.2.2 port1-2 port2-1.6 port3-4 usb3 > >>>>>>1-1.2 3-1:1.0 port1-1.2.3 port2-1 port2-1.7 port4-1 usb4 > >>>>>>1-1.2:1.0 4-0:1.0 port1-1.2.4 port2-1.1 port2-1.8 port4-2 > >>>>> > >>>>>What does it look like if you reverse the naming scheme (hub dev name + > >>>>>"port")? Doesn't that show the devices in a bit more logical way? > >>>>Hi Greg: > >>>> Do you mean e.g "port1.2-1", originally it's "port2-1.1". > >>>>2-1 is hub dev name? > >>> > >>>No, I mean "2-1.port1" as these are the ports on the device, the device > >>>prefix should go first, right? > >>> > >>>> If right, how about root hub port and it should be port2.usb1? > >>> > >>>"usb1.port2" > >> > >>Is this a good idea? There are userspace programs that look through > >>the list of files in /sys/bus/usb/devices, and they probably expect > >>filenames beginning with a number or with 'usb' to be USB devices and > >>interfaces. > > > >What userspace programs? > > > >And if they do that, then we shouldn't put the ports in here at all. > This means usb port should be assigned to usb_bus_type. > How about creating a usb_port class and assign usb port devices to it? > ATA layer does something like this. Make it a bus_type and that will be fine with me (we are trying to keep the spread of new classes down wherever possible, although for something like this maybe it does make sense...) greg k-h -- 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