Re: [PATCH 4/4] usb: register usb port to usb_bus_type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013/3/29 6:56, Greg KH wrote:
On Thu, Mar 28, 2013 at 03:16:08PM -0400, Alan Stern wrote:
On Thu, 28 Mar 2013, 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?

In the past I have answered questions from people wanting to know how
to write a program that could go from bus & device numbers to paths in
sysfs.  The answer was to look at all the links in /sys/bus/usb/devices
for names beginning with a digit or with "usb", eliminate those whose
names contain ':' as they are interfaces rather than devices, and then
check the busnum and devnum files in each of the remaining directories.

Also, libusb/libusbx uses a similar scheme to search through the
entries in /sys/bus/usb/devices, looking for parent-child
relationships.

Sorry for late reply due to time difference.

Ok, then we can't put them in this class, it will have to be separate or
things will break.

This means we should create a new bus_type for usb port?

Has anyone tried this patch with libusb?
Actually, I test it via lsusb. Both two versions of port1-1.3
and 1-1.port3 work. I guess it needs more extensive tests.
According Alan comment's, I think there are two ways to resolve
user-space conflict problems. One is to give a good name for usb
port under /sys/bus/usb/devices/. The other is to create a new
bus_type for usb_port.


greg k-h


--
Best Regards
Tianyu Lan
linux kernel enabling team
--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux